psl.worklets
Class WVM_Registry

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--sun.rmi.registry.RegistryImpl
                    |
                    +--psl.worklets.WVM_Registry
All Implemented Interfaces:
java.rmi.registry.Registry, java.rmi.Remote, java.io.Serializable

class WVM_Registry
extends sun.rmi.registry.RegistryImpl

The Worklets implemented RMI Registry We subclass the Sun implementation of the registry to add registration features to the bind, rebind, and unbind methods, and so that we can restrict who can rebind the names.


Field Summary
private  java.util.Map _names
          Collection of name/WVM_URL values
private  java.util.Map _regKeys
          Collection of WVM_URL/registrationKey values
 
Fields inherited from class sun.rmi.registry.RegistryImpl
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface java.rmi.registry.Registry
REGISTRY_PORT
 
Constructor Summary
(package private) WVM_Registry(int port)
          Creates a WVM_Registry on the given port
 
Method Summary
private  void _registerHost(java.lang.String name, java.rmi.Remote obj)
          Register an object with the RMI bound name
private  void _removeHost(java.lang.String name)
          Remove the RMI bound name from the registration.
 void bind(java.lang.String name, java.rmi.Remote obj)
          Binds the Remote object to the given name
(package private)  java.util.Map getRegistrationKeys()
          Gets the available registration keys
static void main(java.lang.String[] args)
          Creates an external registry from a command line
 void rebind(java.lang.String name, java.rmi.Remote obj)
          Rebinds the Remote object to the given name if the binding object is a WVM_RMI_Transporter
 void unbind(java.lang.String name)
          Unbinds the name from the registry.
 
Methods inherited from class sun.rmi.registry.RegistryImpl
checkAccess, getID, list, lookup
 
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_regKeys

private java.util.Map _regKeys
Collection of WVM_URL/registrationKey values


_names

private java.util.Map _names
Collection of name/WVM_URL values

Constructor Detail

WVM_Registry

WVM_Registry(int port)
       throws java.rmi.RemoteException
Creates a WVM_Registry on the given port

Throws:
java.rmi.RemoteException - if the WVM_Registry could not be created
Method Detail

getRegistrationKeys

java.util.Map getRegistrationKeys()
Gets the available registration keys

Returns:
the collection of WVM_URL/registrationKey values.

_registerHost

private void _registerHost(java.lang.String name,
                           java.rmi.Remote obj)
                    throws java.rmi.RemoteException
Register an object with the RMI bound name

Throws:
java.rmi.RemoteException - if the name/obj cannot be bound

_removeHost

private void _removeHost(java.lang.String name)
Remove the RMI bound name from the registration.


bind

public void bind(java.lang.String name,
                 java.rmi.Remote obj)
          throws java.rmi.AlreadyBoundException,
                 java.rmi.RemoteException
Binds the Remote object to the given name

Specified by:
bind in interface java.rmi.registry.Registry
Overrides:
bind in class sun.rmi.registry.RegistryImpl
Throws:
java.rmi.AlreadyBoundException - if the name is already used
java.rmi.RemoteException - if the object cannot be bound

rebind

public void rebind(java.lang.String name,
                   java.rmi.Remote obj)
            throws java.rmi.RemoteException,
                   java.rmi.AccessException
Rebinds the Remote object to the given name if the binding object is a WVM_RMI_Transporter

Specified by:
rebind in interface java.rmi.registry.Registry
Overrides:
rebind in class sun.rmi.registry.RegistryImpl
Throws:
java.rmi.RemoteException - if the object cannot be bound
java.rmi.AccessException - if the object does not have permission to rebind with the name

unbind

public void unbind(java.lang.String name)
            throws java.rmi.RemoteException,
                   java.rmi.NotBoundException
Unbinds the name from the registry.

Specified by:
unbind in interface java.rmi.registry.Registry
Overrides:
unbind in class sun.rmi.registry.RegistryImpl
Throws:
java.rmi.RemoteException - if the name could not be unbound
java.rmi.NotBoundException - if the name is not bound in the registry

main

public static void main(java.lang.String[] args)
Creates an external registry from a command line