jgroup.registry
Class RegistryFactory

java.lang.Object
  |
  +--jgroup.registry.RegistryFactory

public final class RegistryFactory
extends java.lang.Object

Class RegistryFactory is used to obtain a proxy to the dependable registry service, or to create a dependable registry replica on the local machine.

// Questo dipende da come lo implemento io; nel futuro, potrebbe essere diverso (basato su Jini). Every instance of the dependable registry service is associated with a standard RMI registry, which is used to retrieve a unicast proxy for the replica. to obtain used to obtain a bootstrap reference to the Jgroup dependable registry, or to create a Jgroup dependable registry instance on the local machine. Every instance of the Jgroup registry service is based on two remote registries: the standard local registry and the replicated one. The standard local registry is used to retrieve a reference for the replicated remote registry. When the argument port is used in a getRegistry or a createRegistry method, it specifies the port used by the local registry. The port used by the replicated registry is port+1 .

Since:
Jgroup 0.8
Author:
Alberto Montresor

Field Summary
private static RegistryLocator loc
          Group manager locator needed to obtain group managers
static java.lang.String RESOURCE
           
 
Constructor Summary
private RegistryFactory()
          Private constructor to disable public construction.
 
Method Summary
static DependableRegistry createRegistry(java.lang.Object[] conf)
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on an anonymous communication port.
static DependableRegistry createRegistry(java.lang.Object[] conf, int port)
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on the given port communication port.
static DependableRegistry createRegistry(java.lang.Object[] conf, int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf)
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on the given port communication port.
static DependableRegistry getRegistry(DistributedSystem ds)
          Returns a proxy for the dependable registry service on the specified distributed system.
static DependableRegistry getRegistry(DistributedSystem ds, int port)
          Returns a proxy for the dependable registry service on the specified distributed system and port.
static DependableRegistry getRegistry(DistributedSystem ds, int port, java.rmi.server.RMIClientSocketFactory csf)
          Returns a proxy for the dependable registry service on the specified distributed system and port.
private static void setLocator()
          Construct locator
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

RESOURCE

public static final java.lang.String RESOURCE

loc

private static RegistryLocator loc
Group manager locator needed to obtain group managers
Constructor Detail

RegistryFactory

private RegistryFactory()
Private constructor to disable public construction.
Method Detail

setLocator

private static void setLocator()
                        throws java.rmi.RemoteException
Construct locator

getRegistry

public static DependableRegistry getRegistry(DistributedSystem ds)
                                      throws java.rmi.RemoteException
Returns a proxy for the dependable registry service on the specified distributed system.
Parameters:
ds - the distributed system in which the dependable registry replicas are expected to run
Returns:
a proxy for the dependable registry service
Throws:
java.rmi.RemoteException - if the proxy could not be obtained

getRegistry

public static DependableRegistry getRegistry(DistributedSystem ds,
                                             int port)
                                      throws java.rmi.RemoteException
Returns a proxy for the dependable registry service on the specified distributed system and port.
Parameters:
ds - the distributed system in which the dependable registry replicas are expected to run
port - port on which distributed replicas are listening
Returns:
a proxy for the dependable registry service
Throws:
java.rmi.RemoteException - if the proxy could not be obtained

getRegistry

public static DependableRegistry getRegistry(DistributedSystem ds,
                                             int port,
                                             java.rmi.server.RMIClientSocketFactory csf)
                                      throws java.rmi.RemoteException
Returns a proxy for the dependable registry service on the specified distributed system and port.

Communication with this remote registry will use the supplied RMIClientSocketFactory csf to create socket connections to the dependable registry on the distributed system and port.

Parameters:
ds - the distributed system in which the dependable registry replicas are expected to run
port - port on which distributed replicas are listening
csf - client-side Socket factory used to make connections to the dependable registry. If csf is null, then the default client-side socket factory will be used
Returns:
a proxy for the dependable registry service
Throws:
java.rmi.RemoteException - if the proxy could not be obtained

createRegistry

public static DependableRegistry createRegistry(java.lang.Object[] conf)
                                         throws java.rmi.RemoteException,
                                                JgroupException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on an anonymous communication port. Objects contained conf are used by Jgroup to configure the group communication; the distributed system description must be inclued in this array.
Parameters:
conf - configuration information
Returns:
the new dependable registry replica.
Throws:
java.rmi.RemoteException - if the registry could not be exported
JgroupException - Generic exception raised by Jgroup.
DSException - raised when the distributed system configuration object contains an error

createRegistry

public static DependableRegistry createRegistry(java.lang.Object[] conf,
                                                int port)
                                         throws java.rmi.RemoteException,
                                                JgroupException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on the given port communication port. Objects contained conf are used by Jgroup to configure the group communication; the distributed system description must be inclued in this array.
Parameters:
conf - configuration information
port - port used for RMI communications
Returns:
the new dependable registry replica.
Throws:
java.rmi.RemoteException - if the registry could not be exported
JgroupException - Generic exception raised by Jgroup.
DSException - raised when the distributed system configuration object contains an error

createRegistry

public static DependableRegistry createRegistry(java.lang.Object[] conf,
                                                int port,
                                                java.rmi.server.RMIClientSocketFactory csf,
                                                java.rmi.server.RMIServerSocketFactory ssf)
                                         throws java.rmi.RemoteException,
                                                JgroupException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on the given port communication port. Objects contained conf are used by Jgroup to configure the group communication; the distributed system description must be inclued in this array. The new instance listens to incoming requests using a ServerSocket created from the supplied RMIServerSocketFactory. A client that receives a reference to this registry will use a Socket created from the supplied RMIClientSocketFactory.
Parameters:
conf - configuration information
port - port used for RMI communications
csf - client-side Socket factory used to make connections to the registry
ssf - server-side ServerSocket factory used to accept connections to the registry
Returns:
the new dependable registry replica.
Throws:
java.rmi.RemoteException - if the registry could not be exported
JgroupException - Generic exception raised by Jgroup.
DSException - raised when the distributed system configuration object contains an error