|
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
- References
- Some Important RMI API
- java.rmi.registry.Registry
- java.rmi.registry.LocateRegistry
- java.rmi.Naming
- java.rmi.Remote
- RemoteException
- java.rmi.RMISecurityManager
On-line Java API
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)
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.
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)
No methods
Identifies all remote objects
All classes that implement remote must be public
Parent exception of all remote exceptions
Remote exceptions
AccessException | ServerError |
AlreadyBoundException | ServerException |
ConnectException | ServerRuntimeException |
ConnectIOException | SkeletonMismatchException |
ExportException | SkeletonNotFoundException |
MarshalException | SocketSecurityException |
NoSuchObjectException | StubNotFoundException |
NotBoundException | UnexpectedException |
RemoteException | UnknownHostException |
RMISecurityException | UnmarshalException |
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