org.objectweb.carol.cmi
Class RegistryImpl

java.lang.Object
  extended byorg.objectweb.carol.cmi.RegistryImpl
All Implemented Interfaces:
org.objectweb.carol.cmi.RegistryInternal, java.rmi.Remote

public final class RegistryImpl
extends java.lang.Object
implements org.objectweb.carol.cmi.RegistryInternal

Server part of the CMI registry.

Author:
Simon Nieuviarts

Field Summary
static java.lang.String REG_PREFIX
          Registry prefix
 
Method Summary
 void bindCluster(java.lang.String n, byte[] obj)
          Bind a cluster entry
 void bindCluster(java.lang.String n, byte[] obj, java.net.URL[] urls)
          Bind a cluster entry
 void bindSingle(java.lang.String n, java.rmi.Remote obj)
          Bind a single entry
static org.objectweb.carol.cmi.RegistryInternal getRegistry()
          Get a reference to the current registry
 java.lang.String[] list()
          Get the entries list
 java.lang.Object lookup(java.lang.String n)
          Retrieve an object by a name
 java.lang.Object lookup(java.lang.String n, java.net.URL[] urls)
          Retrieve an object by a name
static void main(java.lang.String[] args)
          Test purposes
 void rebindCluster(java.lang.String n, byte[] obj)
          Rebind a cluster entry
 void rebindCluster(java.lang.String n, byte[] obj, java.net.URL[] urls)
          Rebind a cluster entry
 void rebindSingle(java.lang.String n, java.rmi.Remote obj)
          Rebind a single entry
static RegistryKiller start(int port)
          Start the registry
 void test()
          Test method
 void unbind(java.lang.String n)
          Unbind an entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REG_PREFIX

public static final java.lang.String REG_PREFIX
Registry prefix

See Also:
Constant Field Values
Method Detail

start

public static RegistryKiller start(int port)
                            throws java.rmi.RemoteException
Start the registry

Parameters:
port - port number
Returns:
Handle to allow the registry killing
Throws:
java.rmi.RemoteException - if an exception is encountered

getRegistry

public static org.objectweb.carol.cmi.RegistryInternal getRegistry()
                                                            throws ServerConfigException
Get a reference to the current registry

Returns:
regsitry reference
Throws:
ServerConfigException - if the registry is not started

lookup

public java.lang.Object lookup(java.lang.String n,
                               java.net.URL[] urls)
                        throws java.rmi.NotBoundException,
                               java.rmi.RemoteException
Retrieve an object by a name

Specified by:
lookup in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - name to search
urls - classpath to use to carry out the lookup
Returns:
object associated
Throws:
java.rmi.NotBoundException - if entry is not found
java.rmi.RemoteException - if an exception is encountered

lookup

public java.lang.Object lookup(java.lang.String n)
                        throws java.rmi.NotBoundException,
                               java.rmi.RemoteException
Retrieve an object by a name

Specified by:
lookup in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - name to search
Returns:
object associated
Throws:
java.rmi.NotBoundException - if entry is not found
java.rmi.RemoteException - if an exception is encountered

bindSingle

public void bindSingle(java.lang.String n,
                       java.rmi.Remote obj)
                throws java.rmi.AlreadyBoundException,
                       java.rmi.RemoteException
Bind a single entry

Specified by:
bindSingle in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - name
obj - object
Throws:
java.rmi.AlreadyBoundException - if the entry is already bound
java.rmi.RemoteException - if an exception is encountered

rebindSingle

public void rebindSingle(java.lang.String n,
                         java.rmi.Remote obj)
                  throws java.rmi.RemoteException
Rebind a single entry

Specified by:
rebindSingle in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - name
obj - object
Throws:
java.rmi.RemoteException - if an exception is encountered

bindCluster

public void bindCluster(java.lang.String n,
                        byte[] obj,
                        java.net.URL[] urls)
                 throws java.rmi.AlreadyBoundException,
                        java.rmi.RemoteException
Bind a cluster entry

Specified by:
bindCluster in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - key
obj - array of objects
urls - classpath to use to carry out the bind
Throws:
java.rmi.AlreadyBoundException - if the entry is already bound
java.rmi.RemoteException - if an exception is encountered

bindCluster

public void bindCluster(java.lang.String n,
                        byte[] obj)
                 throws java.rmi.AlreadyBoundException,
                        java.rmi.RemoteException
Bind a cluster entry

Specified by:
bindCluster in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - cluster name
obj - array of objects
Throws:
java.rmi.AlreadyBoundException - if the entry is already bound
java.rmi.RemoteException - if an exception is encountered

unbind

public void unbind(java.lang.String n)
            throws java.rmi.NotBoundException,
                   java.rmi.RemoteException
Unbind an entry

Specified by:
unbind in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - entry to unregister
Throws:
java.rmi.NotBoundException - if entry is not found
java.rmi.RemoteException - if an exception is encountered

rebindCluster

public void rebindCluster(java.lang.String n,
                          byte[] obj,
                          java.net.URL[] urls)
                   throws java.rmi.RemoteException
Rebind a cluster entry

Specified by:
rebindCluster in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - cluster name
obj - array of objects
urls - classpath to use to carry out the rebind
Throws:
java.rmi.RemoteException - if an exception is encountered

rebindCluster

public void rebindCluster(java.lang.String n,
                          byte[] obj)
                   throws java.rmi.RemoteException
Rebind a cluster entry

Specified by:
rebindCluster in interface org.objectweb.carol.cmi.RegistryInternal
Parameters:
n - cluster name
obj - array of objects
Throws:
java.rmi.RemoteException - if an exception is encountered

list

public java.lang.String[] list()
                        throws java.rmi.RemoteException
Get the entries list

Specified by:
list in interface org.objectweb.carol.cmi.RegistryInternal
Returns:
entries
Throws:
java.rmi.RemoteException - if Exception is encountered

test

public void test()
          throws java.rmi.RemoteException
Test method

Specified by:
test in interface org.objectweb.carol.cmi.RegistryInternal
Throws:
java.rmi.RemoteException - if exception is encountered

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test purposes

Parameters:
args - program args
Throws:
java.lang.Exception - if error