dermi.core
Class DermiConnection

java.lang.Object
  extended by dermi.core.DermiConnection

public class DermiConnection
extends java.lang.Object

This class wraps a connection to Pastry and is used by Dermi as its main routing substrate.

Author:
Carles Pairot

Field Summary
static java.lang.String BOOTSTRAP_HOST
           
static int BOOTSTRAP_PORT
           
protected  rice.pastry.PastryNodeFactory factory
           
static rice.p2p.commonapi.IdFactory FACTORY
           
static java.lang.String INSTANCE_NAME
           
protected  rice.p2p.commonapi.Node[] nodes
           
static int NUM_NODES
           
static int PORT
           
static int PROTOCOL
           
static int PROTOCOL_DIRECT
           
protected  rice.pastry.direct.NetworkSimulator simulator
           
static int SIMULATOR
           
static int SIMULATOR_EUCLIDEAN
           
static int SIMULATOR_SPHERE
           
 
Constructor Summary
DermiConnection(java.lang.String bootHost, int bootPort, rice.pastry.PastryNodeFactory fac, int protocol)
          This method creates a new node which will serve as the underlying p2p layer for Dermi
 
Method Summary
 void addInterceptor(NotificationParser npar, rice.p2p.commonapi.Id subsKey, java.lang.String interceptorId)
          Method for adding an interceptor to an object group
 void anycall(rice.p2p.scribe.Topic topic, java.io.Serializable data)
          Method for anycalling to a group of objects
 void close()
          Method for closing a connection, thus killing the node
 void continueInterception(java.util.Hashtable evt, java.util.ArrayList interceptors)
          Method for resume the interception process.
protected  rice.pastry.NodeHandle getBootstrap()
          Gets a handle to a bootstrap node.
 rice.p2p.commonapi.Node getLocalNode()
          Utility method for obtaining the local node
 rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
          Utility method for obtaining the local node handle
 void publish(rice.p2p.scribe.Topic topic, java.io.Serializable data)
          Method for publishing data
 void publishDirect(rice.p2p.scribe.Topic topic, java.io.Serializable data)
          Method for publishing data directly to a node
 void removeInterceptor(rice.p2p.commonapi.Id subsKey, java.lang.String interceptorId)
          Method for removing an interceptor from an object group
 void subscribe(rice.p2p.scribe.Topic topic, rice.p2p.scribe.ScribeClient subscriber)
          Method for subscribing an application to a multicast group
 void unsubscribe(rice.p2p.scribe.Topic topic, rice.p2p.scribe.ScribeClient subscriber)
          Method for unsubscribing an application from a multicast group
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

protected rice.p2p.commonapi.Node[] nodes

NUM_NODES

public static int NUM_NODES

factory

protected rice.pastry.PastryNodeFactory factory

simulator

protected rice.pastry.direct.NetworkSimulator simulator

PROTOCOL_DIRECT

public static final int PROTOCOL_DIRECT
See Also:
Constant Field Values

SIMULATOR_SPHERE

public static final int SIMULATOR_SPHERE
See Also:
Constant Field Values

SIMULATOR_EUCLIDEAN

public static final int SIMULATOR_EUCLIDEAN
See Also:
Constant Field Values

FACTORY

public static rice.p2p.commonapi.IdFactory FACTORY

PORT

public static int PORT

BOOTSTRAP_HOST

public static java.lang.String BOOTSTRAP_HOST

BOOTSTRAP_PORT

public static int BOOTSTRAP_PORT

PROTOCOL

public static int PROTOCOL

SIMULATOR

public static int SIMULATOR

INSTANCE_NAME

public static java.lang.String INSTANCE_NAME
Constructor Detail

DermiConnection

public DermiConnection(java.lang.String bootHost,
                       int bootPort,
                       rice.pastry.PastryNodeFactory fac,
                       int protocol)
                throws ConnectionException
This method creates a new node which will serve as the underlying p2p layer for Dermi

Parameters:
bootHost - String Bootstrap host
bootPort - int Bootstrap port
fac - PastryNodeFactory The node factory to use
protocol - int The protocol to be used
Throws:
ConnectionException - If connection cannot be established against the bootstrap
Method Detail

getBootstrap

protected rice.pastry.NodeHandle getBootstrap()
Gets a handle to a bootstrap node.

Returns:
handle to bootstrap node, or null.

subscribe

public void subscribe(rice.p2p.scribe.Topic topic,
                      rice.p2p.scribe.ScribeClient subscriber)
Method for subscribing an application to a multicast group

Parameters:
topic - Topic The group's identifier
subscriber - ScribeClient The application to subscribe

unsubscribe

public void unsubscribe(rice.p2p.scribe.Topic topic,
                        rice.p2p.scribe.ScribeClient subscriber)
Method for unsubscribing an application from a multicast group

Parameters:
topic - Topic The group's identifier
subscriber - ScribeClient The application to unsubscribe

publish

public void publish(rice.p2p.scribe.Topic topic,
                    java.io.Serializable data)
Method for publishing data

Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

publishDirect

public void publishDirect(rice.p2p.scribe.Topic topic,
                          java.io.Serializable data)
Method for publishing data directly to a node

Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

anycall

public void anycall(rice.p2p.scribe.Topic topic,
                    java.io.Serializable data)
Method for anycalling to a group of objects

Parameters:
topic - Topic The group's identifier
data - Serializable Data to publish

getLocalNodeHandle

public rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
Utility method for obtaining the local node handle

Returns:
NodeHandle Local node handle

getLocalNode

public rice.p2p.commonapi.Node getLocalNode()
Utility method for obtaining the local node

Returns:
Node Local node

addInterceptor

public void addInterceptor(NotificationParser npar,
                           rice.p2p.commonapi.Id subsKey,
                           java.lang.String interceptorId)
Method for adding an interceptor to an object group

Parameters:
npar - NotificationParser Interceptor application
subsKey - Id Subscription key
interceptorId - String Interceptor id

removeInterceptor

public void removeInterceptor(rice.p2p.commonapi.Id subsKey,
                              java.lang.String interceptorId)
Method for removing an interceptor from an object group

Parameters:
subsKey - Id Subscription key
interceptorId - String Interceptor id

continueInterception

public void continueInterception(java.util.Hashtable evt,
                                 java.util.ArrayList interceptors)
Method for resume the interception process. Automatically called by interceptor skeletons

Parameters:
evt - Hashtable
interceptors - ArrayList

close

public void close()
Method for closing a connection, thus killing the node