SDSU CS 696 Emerging Technologies: Distributed Objects
Spring Semester, 1998
Some RMI API

To Lecture Notes Index
© 1998, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 21-Apr-98

Contents of Doc 6, Some RMI API

  1. References
  2. Some Important RMI API
    1. java.rmi.registry.Registry
    2. java.rmi.registry.LocateRegistry
    3. java.rmi.Naming
    4. java.rmi.Remote
    5. RemoteException
    6. java.rmi.RMISecurityManager

References


On-line Java API


Doc 6, Some RMI API Slide # 2

Some Important RMI API

java.rmi.registry.Registry

Methods
bind(String, Remote)
Binds the name to the specified remote object.
list()
Returns an array of the names in the registry.
lookup(String)
Returns the remote object associated with the specified name in the registry.
rebind(String, Remote)
Rebind the name to a new object, replacing any existing binding.
unbind(String)
Unbind the name.

bind, unbind, rebind work only when used on machine that contains RMI Registry
Static Variables

REGISTRY_PORT
Well known port for registry (1099)

Doc 6, Some RMI API Slide # 3

java.rmi.registry.LocateRegistry

Static Methods

createRegistry(int)
Create and export a registry on the local host.
getRegistry()
Returns the remote object Registry for the local host.
getRegistry(int)
Returns the remote object Registry on the current host at the specified port.
getRegistry(String)
Returns the remote object Registry on the specified host at a default (i.e., well-known) port number.
getRegistry(String, int)
Returns the remote object Registry on the specified host at the specified port.

Doc 6, Some RMI API Slide # 4

java.rmi.Naming


Naming
parses rmi URL
uses LocateRegistry and Registry to do the actual work

The rmi URL for a remote object:

   rmi://host:port/name 

rmi:
is optional

host
host name of registry
defaults to current host

port
port number of registry
defaults to standard registry port number 1099

name
name for remote object
Methods
bind(String, Remote)
list(String)
lookup(String)
rebind(String, Remote)
unbind(String)


Doc 6, Some RMI API Slide # 5

java.rmi.Remote


No methods

Identifies all remote objects

All classes that implement remote must be public


RemoteException


Parent exception of all remote exceptions

Remote exceptions
AccessException ServerError
AlreadyBoundException ServerException
ConnectException ServerRuntimeException
ConnectIOException SkeletonMismatchException
ExportExceptionSkeletonNotFoundException
MarshalException SocketSecurityException
NoSuchObjectException StubNotFoundException
NotBoundException UnexpectedException
RemoteException UnknownHostException
RMISecurityException UnmarshalException



Doc 6, Some RMI API Slide # 6

java.rmi.RMISecurityManager

Some items that are checked
checkAccept(String, int)
For now loaded classes can't accept connections on any port.
checkAccess(Thread)
Loaded classes are not allowed to manipulate threads.
checkConnect(String, int)
Loaded classes can make connections if called through the RMI transport.
checkDelete(String)
Check if a file with the specified system dependent file name can be deleted.
checkExec(String)
Loaded classes are not allowed to fork processes.
checkExit(int)
Loaded classes are not allowed to exit the VM.
checkLink(String)
Loaded classes are not allowed to link dynamic libraries.
checkListen(int)
For now loaded classes can't listen on any port.
checkMemberAccess(Class, int)
Check if client is allowed reflective access to a member or a set of members for the specified class.
checkMulticast(InetAddress)
Checks to see if current execution context is allowed to use (join/leave/send/receive) IP multicast (disallowed from loaded classes).
checkPackageAccess(String)
Check if a loaded class can access a package.
checkPackageDefinition(String)
Check if a loaded class can define classes in a package.
checkPrintJobAccess()
checkPropertiesAccess()
checkPropertyAccess(String)
Loaded classes can access the system property named by key only if its twin key.rmi property is set to true.
checkRead(FileDescriptor)


visitors since 05-Feb-98