dermi
Class Registry

java.lang.Object
  extended by dermi.Registry

public class Registry
extends java.lang.Object

This class provides Decentralized Registry's static and generic methods

Version:
1.2
Author:
Carles Pairot

Constructor Summary
Registry()
           
 
Method Summary
static void bind(java.lang.String name, ERemote ref)
          Binds the specified name to a remote object.
static void bind(java.lang.String name, java.util.Properties env)
          Binds the specified name to a remote object.
static void bindRoot()
          Special root ("p2p://") bind method
static boolean bindSecure(java.lang.String context, Id id, java.io.Serializable object, java.lang.String pass)
           
static boolean bindSecure(java.lang.String context, Id id, java.io.Serializable object, java.lang.String pass, boolean getcheck)
           
static boolean bindSer(Id id, java.io.Serializable object)
           
static boolean bindSer(java.lang.String context, Id id, java.io.Serializable object)
           
static boolean bindSer(java.lang.String name, java.io.Serializable object)
           
static boolean bindSer(java.lang.String context, java.lang.String name, java.io.Serializable object)
           
static DermiConnection getConnection()
          Method used to get the connection to the node (for reutilization purposes)
static java.util.Properties getConnectionProperties()
           
static java.util.Properties getEnvironment(java.lang.String filename)
          Returns the object's environment properties
static java.util.Collection getIncomingLinks(java.lang.String context, Id id)
           
static java.util.Collection getOutgoingLinks(java.lang.String context, Id id)
           
static java.util.Hashtable getReplicaInfo()
           
static java.util.Hashtable getStorageInfo()
           
static void insert(java.lang.String context, java.lang.String keywords, java.lang.String key, java.io.Serializable value)
           
static void insertURL(java.lang.String context, Id key, java.net.URL url, java.lang.String field)
           
static boolean isConnected()
          Method used to know if the registry is already connected to a node
static void leave()
          It closes the connection and kills the node
static java.util.Collection list(java.lang.String root)
          Returns a Vector of the names bound in the registry.
static void loadRegistry(java.lang.String ref)
          It connects to the Registry (by creating a node!)
static ERemote lookup(java.lang.String name)
          Returns a reference, a stub, for the remote object associated with the specified name.
static ERemote lookup(java.lang.String name, java.lang.String communityId, java.lang.String className)
          Returns a reference, a stub, for the remote object associated with the specified name.
static java.io.Serializable lookupSecure(java.lang.String context, Id id, java.lang.String pass)
           
static java.io.Serializable lookupSer(java.lang.String url)
          Returns a serialized object associated with the specified name.
static java.io.Serializable lookupSer(java.lang.String context, Id id)
          Returns a serialized object associated with the specified name.
static java.io.Serializable lookupSer(java.lang.String context, Id id, java.lang.String field)
           
static java.io.Serializable lookupSer(java.lang.String context, java.lang.String url)
           
static java.net.URL lookupURL(java.lang.String context, Id id, java.lang.String field)
           
static void modify(java.lang.String context, Id key, java.util.Collection values, java.lang.String field, boolean add)
           
static void modify(java.lang.String context, Id key, java.lang.Object value, java.lang.String field, boolean add)
           
static bunshin.util.ResultSortedQueue query(java.lang.String context, java.lang.String keywords)
           
static void rebind(java.lang.String name, ERemote ref)
          Rebinds the specified name in the registry.
static void remove(java.lang.String context, java.lang.String keywords, java.lang.String key)
           
static void removeRemoteListener(java.lang.String context, Id id, java.lang.String field)
           
static void removeSer(Id id)
           
static void removeSer(java.lang.String name)
           
static void removeSer(java.lang.String context, Id id, java.lang.String field)
           
static void setInfoContext(java.lang.String context, java.lang.String path, java.lang.String url, java.net.URL[] URLsList)
           
static void setInstance(Naming reg)
           
static void setRemoteListener(java.lang.String context, Id id, bunshin.RemoteListener listener, java.lang.String field)
           
static void unbind(java.lang.String name)
          Unbinds the specified name from a remote object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry()
Method Detail

getEnvironment

public static java.util.Properties getEnvironment(java.lang.String filename)
                                           throws RemoteException
Returns the object's environment properties

Parameters:
filename - String Object properties filename
Returns:
Properties Object properties
Throws:
RemoteException - If something goes wrong ;-)

getConnectionProperties

public static java.util.Properties getConnectionProperties()

loadRegistry

public static void loadRegistry(java.lang.String ref)
                         throws RemoteException
It connects to the Registry (by creating a node!)

Parameters:
ref - Name of properties file containing connection parameters.
Throws:
RemoteException - If the connection with the event service fails.

getStorageInfo

public static java.util.Hashtable getStorageInfo()
                                          throws RemoteException
Throws:
RemoteException

getReplicaInfo

public static java.util.Hashtable getReplicaInfo()
                                          throws RemoteException
Throws:
RemoteException

setInfoContext

public static void setInfoContext(java.lang.String context,
                                  java.lang.String path,
                                  java.lang.String url,
                                  java.net.URL[] URLsList)
                           throws RemoteException
Throws:
RemoteException

leave

public static void leave()
                  throws RemoteException
It closes the connection and kills the node

Throws:
RemoteException - If the disconnection with the event service fails.

lookup

public static ERemote lookup(java.lang.String name)
                      throws RemoteException
Returns a reference, a stub, for the remote object associated with the specified name.

Parameters:
name - Id of the remote object in the Registry
Returns:
Eremote Reference to the remote object
Throws:
RemoteException - If the connection with the event service fails.

lookup

public static ERemote lookup(java.lang.String name,
                             java.lang.String communityId,
                             java.lang.String className)
                      throws RemoteException
Returns a reference, a stub, for the remote object associated with the specified name. Should this reference be not bound, start it remotely in the community, register it and return the newly-created reference

Parameters:
name - Id of the remote object in the Registry
communityId - Id of the community where the object is to be activated (if necessary)
Returns:
Eremote Reference to the remote object
Throws:
RemoteException - If the connection with the event service fails.

lookupSer

public static java.io.Serializable lookupSer(java.lang.String context,
                                             Id id)
                                      throws RemoteException
Returns a serialized object associated with the specified name.

Parameters:
id - Id of the remote object in the Registry
Returns:
Eremote Reference to the remote object
Throws:
RemoteException - If the connection with the event service fails.

lookupSer

public static java.io.Serializable lookupSer(java.lang.String context,
                                             Id id,
                                             java.lang.String field)
                                      throws RemoteException
Throws:
RemoteException

lookupURL

public static java.net.URL lookupURL(java.lang.String context,
                                     Id id,
                                     java.lang.String field)
                              throws RemoteException
Throws:
RemoteException

lookupSer

public static java.io.Serializable lookupSer(java.lang.String url)
                                      throws RemoteException
Returns a serialized object associated with the specified name.

Parameters:
id - Id of the remote object in the Registry
Returns:
Eremote Reference to the remote object
Throws:
RemoteException - If the connection with the event service fails.

lookupSer

public static java.io.Serializable lookupSer(java.lang.String context,
                                             java.lang.String url)
                                      throws RemoteException
Throws:
RemoteException

isConnected

public static boolean isConnected()
Method used to know if the registry is already connected to a node

Returns:
boolean true if it is connected

getConnection

public static DermiConnection getConnection()
Method used to get the connection to the node (for reutilization purposes)

Returns:
DermiConnection The connection

bind

public static void bind(java.lang.String name,
                        ERemote ref)
                 throws RemoteException
Binds the specified name to a remote object.

Parameters:
name - Id of the remote object
ref - remote object reference to bind
Throws:
RemoteException - If the connection with the event service fails.

bind

public static void bind(java.lang.String name,
                        java.util.Properties env)
                 throws RemoteException
Binds the specified name to a remote object.

Parameters:
name - Id of the remote object
env - Object properties
Throws:
RemoteException - If the connection with the event service fails.

unbind

public static void unbind(java.lang.String name)
                   throws RemoteException
Unbinds the specified name from a remote object.

Parameters:
name - Id of the remote object
Throws:
RemoteException - If the connection with the event service fails.

bindRoot

public static void bindRoot()
                     throws RemoteException
Special root ("p2p://") bind method

Throws:
RemoteException - If the connection with the event service fails.

rebind

public static void rebind(java.lang.String name,
                          ERemote ref)
                   throws RemoteException
Rebinds the specified name in the registry.

Parameters:
name - Id of the remote object
ref - remote object reference to bind
Throws:
RemoteException - If the connection with the event service fails.

list

public static java.util.Collection list(java.lang.String root)
                                 throws RemoteException
Returns a Vector of the names bound in the registry. The Vector contains a snapshot of the names present in the registry at the time of the call.

Returns:
Vector A list of Ids from remote objects.
Throws:
dermi.RemoteException - If the connection with the event service fails.
RemoteException

setInstance

public static void setInstance(Naming reg)

bindSer

public static boolean bindSer(Id id,
                              java.io.Serializable object)
                       throws RemoteException
Throws:
RemoteException

bindSer

public static boolean bindSer(java.lang.String name,
                              java.io.Serializable object)
                       throws RemoteException
Throws:
RemoteException

bindSer

public static boolean bindSer(java.lang.String context,
                              Id id,
                              java.io.Serializable object)
                       throws RemoteException
Throws:
RemoteException

bindSer

public static boolean bindSer(java.lang.String context,
                              java.lang.String name,
                              java.io.Serializable object)
                       throws RemoteException
Throws:
RemoteException

removeSer

public static void removeSer(Id id)
                      throws RemoteException
Throws:
RemoteException

removeSer

public static void removeSer(java.lang.String name)
                      throws RemoteException
Throws:
RemoteException

removeSer

public static void removeSer(java.lang.String context,
                             Id id,
                             java.lang.String field)
                      throws RemoteException
Throws:
RemoteException

bindSecure

public static boolean bindSecure(java.lang.String context,
                                 Id id,
                                 java.io.Serializable object,
                                 java.lang.String pass)
                          throws RemoteException
Throws:
RemoteException

bindSecure

public static boolean bindSecure(java.lang.String context,
                                 Id id,
                                 java.io.Serializable object,
                                 java.lang.String pass,
                                 boolean getcheck)
                          throws RemoteException
Throws:
RemoteException

lookupSecure

public static java.io.Serializable lookupSecure(java.lang.String context,
                                                Id id,
                                                java.lang.String pass)
                                         throws RemoteException
Throws:
RemoteException

insertURL

public static void insertURL(java.lang.String context,
                             Id key,
                             java.net.URL url,
                             java.lang.String field)
                      throws RemoteException
Throws:
RemoteException

modify

public static void modify(java.lang.String context,
                          Id key,
                          java.lang.Object value,
                          java.lang.String field,
                          boolean add)
                   throws RemoteException
Throws:
RemoteException

modify

public static void modify(java.lang.String context,
                          Id key,
                          java.util.Collection values,
                          java.lang.String field,
                          boolean add)
                   throws RemoteException
Throws:
RemoteException

setRemoteListener

public static void setRemoteListener(java.lang.String context,
                                     Id id,
                                     bunshin.RemoteListener listener,
                                     java.lang.String field)
                              throws RemoteException
Throws:
RemoteException

removeRemoteListener

public static void removeRemoteListener(java.lang.String context,
                                        Id id,
                                        java.lang.String field)
                                 throws RemoteException
Throws:
RemoteException

getIncomingLinks

public static java.util.Collection getIncomingLinks(java.lang.String context,
                                                    Id id)
                                             throws RemoteException
Throws:
RemoteException

getOutgoingLinks

public static java.util.Collection getOutgoingLinks(java.lang.String context,
                                                    Id id)
                                             throws RemoteException
Throws:
RemoteException

insert

public static void insert(java.lang.String context,
                          java.lang.String keywords,
                          java.lang.String key,
                          java.io.Serializable value)
                   throws RemoteException
Throws:
RemoteException

query

public static bunshin.util.ResultSortedQueue query(java.lang.String context,
                                                   java.lang.String keywords)
                                            throws RemoteException
Throws:
RemoteException

remove

public static void remove(java.lang.String context,
                          java.lang.String keywords,
                          java.lang.String key)
                   throws RemoteException
Throws:
RemoteException