dermi.registry
Class Registry

java.lang.Object
  extended by dermi.registry.Registry

public class Registry
extends java.lang.Object

This class implements the decentralized object location registry

Author:
Carles Pairot , Ruben Mondejar

Nested Class Summary
protected  class Registry.NamingCommand
          Common superclass for data reception commands.
static class Registry.PastContentImpl
          Utility class for past content objects
protected static class Registry.PastContentImplHandle
          Utility class for past content object handles
 
Constructor Summary
Registry(rice.p2p.commonapi.IdFactory FACTORY, rice.pastry.PastryNode pn, int REPLICATION_FACTOR)
          Constructor for the decentralized registry: entry point and local start
 
Method Summary
 void bind(java.lang.String name, java.util.Properties ref)
          Binds the specified name to a remote object.
 void insert(rice.p2p.commonapi.Id id, java.util.Properties props)
          Insert object's metadata into the registry
 void insert(rice.p2p.commonapi.Id id, java.io.Serializable ser)
           
 java.util.Collection list(java.lang.String root)
          Returns the list of objects bound below the specified root
 java.io.Serializable lookup(rice.p2p.commonapi.Id id)
          Returns a serializable object from the decentralized registry
 ERemote lookup(java.lang.String name)
          Returns a reference, a stub, for the remote object associated with the specified name (or null if not bound)
 void rebind(java.lang.String name, java.util.Properties ref)
          Rebinds the specified name in the registry.
 void unbind(java.lang.String name)
          Unbinds the specified name from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry(rice.p2p.commonapi.IdFactory FACTORY,
                rice.pastry.PastryNode pn,
                int REPLICATION_FACTOR)
Constructor for the decentralized registry: entry point and local start

Parameters:
FACTORY - IdFactory IdFactory used by the StorageManager in PAST
pn - PastryNode PAST needs the Pastry node to build on top of
REPLICATION_FACTOR - int Replication factor used: object handles will be inserted in at most REPLICATION_FACTOR nodes
Method Detail

lookup

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

Parameters:
name - Name of the remote object in the Registry
Returns:
Eremote Reference to the remote object
Throws:
RemoteException - If the connection fails

lookup

public java.io.Serializable lookup(rice.p2p.commonapi.Id id)
                            throws RemoteException
Returns a serializable object from the decentralized registry

Parameters:
id - Id Object's Id
Returns:
Serializable Object from the registry returned
Throws:
RemoteException - If unable to connect to the registry

bind

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

Parameters:
name - Name of the remote object to be used (should be unique)
ref - Remote object reference to bind
Throws:
RemoteException - If the connection with the event service fails.

insert

public void insert(rice.p2p.commonapi.Id id,
                   java.util.Properties props)
Insert object's metadata into the registry

Parameters:
id - Id Object's Id
props - Properties Metadata to be inserted

unbind

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

Parameters:
name - Id of the remote object
Throws:
dermi.NotBoundException - - if the Registry does not contains this Id.
dermi.RemoteException - - if the connection with the event service fails.
RemoteException

rebind

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

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

list

public java.util.Collection list(java.lang.String root)
                          throws RemoteException
Returns the list of objects bound below the specified root

Parameters:
root - Hierarchical root (in the form "p2p://...")
Returns:
A collection containing the object's list
Throws:
RemoteException

insert

public void insert(rice.p2p.commonapi.Id id,
                   java.io.Serializable ser)