Rice Pastry API

rice.pastry.socket
Class SocketPastryNodeFactory

java.lang.Object
  extended by rice.pastry.PastryNodeFactory
      extended by rice.pastry.transport.TransportPastryNodeFactory
          extended by rice.pastry.socket.SocketPastryNodeFactory

public class SocketPastryNodeFactory
extends TransportPastryNodeFactory

Pastry node factory for Socket-linked nodes.

Version:
$Id: SocketPastryNodeFactory.java,v 1.6 2004/03/08 19:53:57 amislove Exp $
Author:
Alan Mislove

Field Summary
protected  int findFireWallPolicy
           
protected  NodeIdFactory nidFactory
           
static byte[] PASTRY_MAGIC_NUMBER
           
protected  RandomSource random
           
protected  int testFireWallPolicy
           
 
Fields inherited from class rice.pastry.transport.TransportPastryNodeFactory
leafSetMaintFreq, routeSetMaintFreq
 
Fields inherited from class rice.pastry.PastryNodeFactory
environment, logger, lSetSize, pingCache, rtBase, rtMax
 
Constructor Summary
SocketPastryNodeFactory(NodeIdFactory nf, java.net.InetAddress bindAddress, int startPort, Environment env, NATHandler handler)
           
SocketPastryNodeFactory(NodeIdFactory nf, int startPort, Environment env)
           
 
Method Summary
protected  LivenessTransportLayer<SourceRoute<MultiInetSocketAddress>,java.nio.ByteBuffer> getLivenessTransportLayer(TransportLayer<SourceRoute<MultiInetSocketAddress>,java.nio.ByteBuffer> tl, Environment environment)
           
 NodeHandle getLocalHandle(TLPastryNode pn, NodeHandleFactory nhf, java.lang.Object localNodeInfo)
           
 NodeHandle getNodeHandle(java.net.InetSocketAddress bootstrap)
           
 void getNodeHandle(java.net.InetSocketAddress[] bootstraps, Continuation c)
           
 NodeHandle getNodeHandle(java.net.InetSocketAddress[] bootstraps, int int1)
           
 NodeHandle getNodeHandle(java.net.InetSocketAddress bootstrap, int i)
           
 NodeHandleFactory getNodeHandleFactory(TLPastryNode pn)
           
 NodeHandleAdapter getNodeHanldeAdapter(TLPastryNode pn, NodeHandleFactory handleFactory2, TLDeserializer deserializer)
           
 PastryNode newNode(Id nodeId, java.net.InetSocketAddress pAddress)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
protected  PastryNode newNode(Id nodeId, java.net.InetSocketAddress pAddress, boolean throwException)
           
 PastryNode newNode(NodeHandle bootstrap)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 PastryNode newNode(NodeHandle bootstrap, Id nodeId)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
 PastryNode newNode(NodeHandle nodeHandle, Id id, java.net.InetSocketAddress proxyAddress)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
 PastryNode newNode(NodeHandle bootstrap, java.net.InetSocketAddress proxy)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
static java.net.InetSocketAddress verifyConnection(int i, java.net.InetSocketAddress addr, java.net.InetSocketAddress[] addr2, Environment env, Logger l)
           
 
Methods inherited from class rice.pastry.transport.TransportPastryNodeFactory
getLeafSet, getLeafSet, getProximity, getRouteRow, getRouteRow, nodeHandleHelper
 
Methods inherited from class rice.pastry.PastryNodeFactory
getEnvironment, getNearest, proximity, sortedProximityCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASTRY_MAGIC_NUMBER

public static final byte[] PASTRY_MAGIC_NUMBER

nidFactory

protected NodeIdFactory nidFactory

random

protected RandomSource random

testFireWallPolicy

protected int testFireWallPolicy

findFireWallPolicy

protected int findFireWallPolicy
Constructor Detail

SocketPastryNodeFactory

public SocketPastryNodeFactory(NodeIdFactory nf,
                               int startPort,
                               Environment env)
                        throws java.io.IOException
Throws:
java.io.IOException

SocketPastryNodeFactory

public SocketPastryNodeFactory(NodeIdFactory nf,
                               java.net.InetAddress bindAddress,
                               int startPort,
                               Environment env,
                               NATHandler handler)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getLocalHandle

public NodeHandle getLocalHandle(TLPastryNode pn,
                                 NodeHandleFactory nhf,
                                 java.lang.Object localNodeInfo)
Specified by:
getLocalHandle in class TransportPastryNodeFactory

getNodeHandleFactory

public NodeHandleFactory getNodeHandleFactory(TLPastryNode pn)
Specified by:
getNodeHandleFactory in class TransportPastryNodeFactory

getNodeHanldeAdapter

public NodeHandleAdapter getNodeHanldeAdapter(TLPastryNode pn,
                                              NodeHandleFactory handleFactory2,
                                              TLDeserializer deserializer)
                                       throws java.io.IOException
Specified by:
getNodeHanldeAdapter in class TransportPastryNodeFactory
Throws:
java.io.IOException

getLivenessTransportLayer

protected LivenessTransportLayer<SourceRoute<MultiInetSocketAddress>,java.nio.ByteBuffer> getLivenessTransportLayer(TransportLayer<SourceRoute<MultiInetSocketAddress>,java.nio.ByteBuffer> tl,
                                                                                                                    Environment environment)

getNodeHandle

public NodeHandle getNodeHandle(java.net.InetSocketAddress bootstrap,
                                int i)

getNodeHandle

public NodeHandle getNodeHandle(java.net.InetSocketAddress bootstrap)

getNodeHandle

public void getNodeHandle(java.net.InetSocketAddress[] bootstraps,
                          Continuation c)

getNodeHandle

public NodeHandle getNodeHandle(java.net.InetSocketAddress[] bootstraps,
                                int int1)

newNode

public PastryNode newNode(NodeHandle bootstrap)
Method which creates a Pastry node from the next port with a randomly generated NodeId.

Specified by:
newNode in class PastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle bootstrap,
                          java.net.InetSocketAddress proxy)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle bootstrap,
                          Id nodeId)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Specified by:
newNode in class PastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.
nodeId - if non-null, will use this nodeId for the node, rather than using the NodeIdFactory
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle nodeHandle,
                          Id id,
                          java.net.InetSocketAddress proxyAddress)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
nodeId - if non-null, will use this nodeId for the node, rather than using the NodeIdFactory
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(Id nodeId,
                          java.net.InetSocketAddress pAddress)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
nodeId - if non-null, will use this nodeId for the node, rather than using the NodeIdFactory
pAddress - The address to claim that this node is at - used for proxies behind NATs
Returns:
A node with a random ID and next port number.

newNode

protected PastryNode newNode(Id nodeId,
                             java.net.InetSocketAddress pAddress,
                             boolean throwException)
                      throws java.io.IOException
Throws:
java.io.IOException

verifyConnection

public static java.net.InetSocketAddress verifyConnection(int i,
                                                          java.net.InetSocketAddress addr,
                                                          java.net.InetSocketAddress[] addr2,
                                                          Environment env,
                                                          Logger l)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.