sdsu.rmi.registry
Class UniVMRegistry

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--sdsu.rmi.registry.UniVMRegistry

public class UniVMRegistry
extends java.rmi.server.UnicastRemoteObject
implements RemoteRegistrar

UniVMRegistry allows server objects created in the VM that is running the rmi registy. This means you do not have to create a new VM and an new process for each object in the registry. The ".class" files, including the stub and skeletons for an object added to the registry must be accessable using the classpath of the process that created the UniVMRegistry and the rmiregistry.

The UniVMRegistry is a normal rmi registry with an object of type Registrant bound at the name "RemoteRegistrar". Use Registrar to register object to on a UniVMRegistry.

The easiest way to run a UniVMRegistry is using the command

 	java sdsu.rmi.registry.UniVMRegistry -p=5555 &
 
after you have an rmiregistry running on the given port. If the "-p" flag is not given, the default rmiregistry port 1099 is used.

Version:
0.9.1 2 Feb. 1998
Author:
Roger Whitney (whitney@cs.sdsu.edu)
See Also:
Registrar, Serialized Form

Field Summary
static java.lang.String RMI_NAME
           
 
Constructor Summary
UniVMRegistry()
          Install a UniVMRegistry on the default rmiregistry port.
UniVMRegistry(int port)
          Install a UniVMRegistry on the given port.
 
Method Summary
 void bind(java.lang.String name, java.rmi.Remote object)
          Binds the name to the specified remote object.
 void bind(java.lang.String name, java.lang.String remoteObjectClassName)
          Binds the name to the specified remote object.
 java.lang.String[] list()
          Returns an array of the names in the registry.
static void main(java.lang.String[] args)
          Install a UniVMRegistry.
 void rebind(java.lang.String name, java.rmi.Remote object)
          Binds a Remote object created from the class className in the rmiregistry.
 void rebind(java.lang.String name, java.lang.String className)
          Binds a Remote object created from the class className in the rmiregistry.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RMI_NAME

public static final java.lang.String RMI_NAME
Constructor Detail

UniVMRegistry

public UniVMRegistry()
              throws java.rmi.RemoteException
Install a UniVMRegistry on the default rmiregistry port. If a registry is active on that port make it a UniVMRegistry.

UniVMRegistry

public UniVMRegistry(int port)
              throws java.rmi.RemoteException
Install a UniVMRegistry on the given port. If a registry is active on that port make it a UniVMRegistry.
Method Detail

rebind

public void rebind(java.lang.String name,
                   java.lang.String className)
            throws java.rmi.RemoteException
Binds a Remote object created from the class className in the rmiregistry. Replaces and object currently bound at same name. The registry's classpath must include the className.
Specified by:
rebind in interface RemoteRegistrar
Parameters:
className - Full class name, used to create remote object.
name - Name to which object is bound
Throws:
java.rmi.RemoteException - thrown if there is any problem binding object.

rebind

public void rebind(java.lang.String name,
                   java.rmi.Remote object)
            throws java.rmi.RemoteException
Binds a Remote object created from the class className in the rmiregistry. Replaces and object currently bound at same name.
Specified by:
rebind in interface RemoteRegistrar
Parameters:
object - Remote object which is bound.
name - Name to which object is bound.
Throws:
java.rmi.RemoteException - thrown if there is any problem binding object.

bind

public void bind(java.lang.String name,
                 java.lang.String remoteObjectClassName)
          throws java.rmi.RemoteException,
                 java.rmi.AlreadyBoundException
Binds the name to the specified remote object.
Specified by:
bind in interface RemoteRegistrar
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AlreadyBoundException - If name is already bound.

bind

public void bind(java.lang.String name,
                 java.rmi.Remote object)
          throws java.rmi.RemoteException,
                 java.rmi.AlreadyBoundException
Binds the name to the specified remote object.
Specified by:
bind in interface RemoteRegistrar
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AlreadyBoundException - If name is already bound.

list

public java.lang.String[] list()
                        throws java.rmi.RemoteException,
                               java.rmi.AccessException
Returns an array of the names in the registry.
Specified by:
list in interface RemoteRegistrar
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.

main

public static void main(java.lang.String[] args)
Install a UniVMRegistry. To specify the port use the "-p" flag to specify a port other than the default rmiregistry port. If registry already exists on that port make it a UniVMRegistry. Prints out all names that are currently bound to objects in the registry.