sdsu.rmi.registry
Class Registrar

java.lang.Object
  |
  +--sdsu.rmi.registry.Registrar

public class Registrar
extends java.lang.Object
implements java.rmi.registry.Registry

Registrar is a client that can be used to register remote objects with a UniVMRegistry. Create a Registrar with host and port of the machine that is running the UniVMRegistry. You can bind objects to a UniVMRegistry on a remote host. Object bound to the UniVMRegistry are run in the VM running the UniVMRegistry, not the VM running the Registrar.

Version:
0.9 21 January 1998
Author:
Roger Whitney (whitney@cs.sdsu.edu)
See Also:
UniVMRegistry

Constructor Summary
Registrar()
          Create a Registrar for the UniVMRegistry on current host using the default rmi registry port.
Registrar(int port)
          Create a Registrar for the UniVMRegistry on current host using the given port.
Registrar(java.lang.String host)
          Create a Registrar for the UniVMRegistry on given host using the default rmi registry port.
Registrar(java.lang.String host, int port)
          Create a Registrar for the UniVMRegistry on given host using the given port.
 
Method Summary
 void bind(java.lang.String name, java.rmi.Remote object)
          Binds the name to the specified remote object.
 java.lang.String[] list()
          Returns an array of the names in the registry.
 java.rmi.Remote lookup(java.lang.String name)
          Returns the remote object associated with the specified name in the registry.
 void rebind(java.lang.String name, java.rmi.Remote object)
          Rebind the name to a new object, replacing any existing binding.
 void rebind(java.lang.String name, java.lang.String className)
          Rebind the name to a new object, created from the class indicated by className, replacing any existing binding.
 void unbind(java.lang.String name)
          Unbind the name.
static java.lang.String verboseRebind(int port, java.lang.String name, java.lang.String className)
          Binds the name to the specified remote object on locat registry on given port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registrar

public Registrar()
          throws java.rmi.RemoteException
Create a Registrar for the UniVMRegistry on current host using the default rmi registry port.

Registrar

public Registrar(int port)
          throws java.rmi.RemoteException
Create a Registrar for the UniVMRegistry on current host using the given port.

Registrar

public Registrar(java.lang.String host)
          throws java.rmi.RemoteException
Create a Registrar for the UniVMRegistry on given host using the default rmi registry port.

Registrar

public Registrar(java.lang.String host,
                 int port)
          throws java.rmi.RemoteException
Create a Registrar for the UniVMRegistry on given host using the given port.
Method Detail

list

public java.lang.String[] list()
                        throws java.rmi.RemoteException
Returns an array of the names in the registry.
Specified by:
list in interface java.rmi.registry.Registry
Throws:
java.rmi.RemoteException - If remote operation failed.

rebind

public void rebind(java.lang.String name,
                   java.lang.String className)
            throws java.rmi.RemoteException
Rebind the name to a new object, created from the class indicated by className, replacing any existing binding. The remote registry's classpath must include the className.
Parameters:
className - Full class name, used to create remote object. Class must implement java.rmi.Remote
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.

rebind

public void rebind(java.lang.String name,
                   java.rmi.Remote object)
            throws java.rmi.RemoteException
Rebind the name to a new object, replacing any existing binding.
Specified by:
rebind in interface java.rmi.registry.Registry
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.

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 java.rmi.registry.Registry
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AlreadyBoundException - If name is already bound.

unbind

public void unbind(java.lang.String name)
            throws java.rmi.RemoteException,
                   java.rmi.NotBoundException,
                   java.rmi.AccessException
Unbind the name.
Specified by:
unbind in interface java.rmi.registry.Registry
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.NotBoundException - if there is no object with this name in the registry.
java.rmi.AccessException - If this operation is not permitted.

lookup

public java.rmi.Remote lookup(java.lang.String name)
                       throws java.rmi.RemoteException,
                              java.rmi.NotBoundException,
                              java.rmi.AccessException
Returns the remote object associated with the specified name in the registry.
Specified by:
lookup in interface java.rmi.registry.Registry
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.NotBoundException - if there is no object with this name in the registry.
java.rmi.AccessException - If this operation is not permitted.

verboseRebind

public static java.lang.String verboseRebind(int port,
                                             java.lang.String name,
                                             java.lang.String className)
                                      throws java.rmi.RemoteException
Binds the name to the specified remote object on locat registry on given port. Returns a list names which objects are bound to in the registry.
Throws:
java.rmi.RemoteException - If remote operation failed.