org.objectweb.jeremie.services.registry
Class Naming

java.lang.Object
  extended by org.objectweb.jeremie.services.registry.Naming

public final class Naming
extends Object

Provides a URL-based addressing interface for applications to access a Jeremie registry and perform registry operations. The registry may be on a distant machine.

Methods of this class take a URL-formatted string argument of the form:

jrmi://host:port/file

where the scheme "jrmi:" and the "host:port" part can be empty. The host and port indicate the machine where the Jeremie registry is running; if empty, it is taken to be the local machine using the default port. The file part of the URL indicates the name of an object reference to be stored in or retrieved from the registry.

The implementation of this class uses the interface provided by LocateRegistry to obtain a local bootstrap stub of the registry.

See Also:
Registry, org.objectweb.jeremie.services.registry.lib.LocateRegistry

Method Summary
static void bind(String fullName, Remote obj)
          Accesses a Jeremie registry and binds a remote object reference.
static String[] list(String fullName)
          Accesses a Jeremie registry and lists all the names bound in the registry.
static Remote lookup(String fullName)
          Accesses a Jeremie registry and retrieves a remote object reference.
static void rebind(String fullName, Remote obj)
          Accesses a Jeremie registry and binds a remote object reference.
static void unbind(String fullName)
          Accesses a Jeremie registry and unbinds a remote object reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lookup

public static Remote lookup(String fullName)
                     throws MalformedURLException,
                            NotBoundException,
                            RemoteException
Accesses a Jeremie registry and retrieves a remote object reference.

Parameters:
fullName - the location of the registry and the name of the object reference to be retrieved.
Returns:
the designated object reference
Throws:
MalformedURLException - if fullName is a badly formed URL.
NotBoundException - if no object reference of that name is bound in the designated registry
RemoteException - in the case of all other errors (registry not running on the designated host, or on the designated port, etc.)

bind

public static void bind(String fullName,
                        Remote obj)
                 throws MalformedURLException,
                        AlreadyBoundException,
                        RemoteException
Accesses a Jeremie registry and binds a remote object reference.

Parameters:
fullName - the location of the registry and the name of the object reference to be bound.
Throws:
AlreadyBoundException - if that name is already bound to an object reference in the designated registry
MalformedURLException - if fullName is a badly formed URL.
RemoteException - in the case of all other errors (registry not running on the designated host, or on the designated port, etc.)

rebind

public static void rebind(String fullName,
                          Remote obj)
                   throws MalformedURLException,
                          RemoteException
Accesses a Jeremie registry and binds a remote object reference. Overrides any existing binding of the designated name.

Parameters:
fullName - the location of the registry and the name of the object reference to be bound.
Throws:
MalformedURLException - if fullName is a badly formed URL.
RemoteException - in the case of all other errors (registry not running on the designated host, or on the designated port, etc.)

unbind

public static void unbind(String fullName)
                   throws MalformedURLException,
                          NotBoundException,
                          RemoteException
Accesses a Jeremie registry and unbinds a remote object reference.

Parameters:
fullName - the location of the registry and the name of the object reference to be unbound.
Throws:
MalformedURLException - if fullName is a badly formed URL.
NotBoundException - if no object reference of that name is bound in the designated registry
RemoteException - in the case of all other errors (registry not running on the designated host, or on the designated port, etc.)

list

public static String[] list(String fullName)
                     throws MalformedURLException,
                            RemoteException
Accesses a Jeremie registry and lists all the names bound in the registry.

Parameters:
fullName - the location of the registry
Returns:
an array of all the names (strings) bound in the registry
Throws:
MalformedURLException - if fullName is a badly formed URL.
RemoteException - in the case of all other errors (registry not running on the designated host, or on the designated port, etc.)