cgl.narada.protocol
Class Connection

java.lang.Object
  extended by cgl.narada.protocol.Connection
All Implemented Interfaces:
ProtocolDebugFlags

public class Connection
extends Object
implements ProtocolDebugFlags

Provides a serialized list of the connections in the system. The class performs a variety of utility functions. These include representation of a connection within the connectivity graph of the hosting node as a connection that would be consistent with another nodes view of the system.


Field Summary
 
Fields inherited from interface cgl.narada.protocol.ProtocolDebugFlags
BrokerLocatorCommunicator_Debug, ClientConnectionHandler_Debug, Connection_Debug, ConnectionPropagation_Debug, Destinations_Debug, DuplicateDetection_Debug, EventBuffer_Debug, EventRoutingProtocol_Debug, Gateway_Debug, GatewayInfo_Debug, GatewayPropagation_Debug, JmsProfilePropagation_Debug, LinkCostMatrix_Debug, NodeAdditionProtocol_Debug, NodeAddress_Debug, Path_Debug, PersistentEventRouting_Debug, ProfilePropagationProtocol_Debug, ProtocolException_Debug, ProtocolHandler_Debug, ProtocolID_Debug, ProtocolIDFactory_Debug, RoutingCache_Debug, RtpEventRoutingProtocol_Debug, RtpProfilePropagation_Debug, SecureMessageRouting_Debug, TagValueEventRoutingProtocol_Debug, TagValueProfilePropagation_Debug, XmlEventRoutingProtocol_Debug, XPathProfilePropagation_Debug
 
Constructor Summary
Connection(NodeAddress nodeAddress, byte[] connectionBytes)
          This represents an unmarshalling of the connection information that is received over the link.
Connection(NodeAddress thisNodeAddress, NodeAddress nodeOne, int levelOne, NodeAddress nodeTwo, int levelTwo, int gatewayLevel, ProtocolID connectionId)
           
 
Method Summary
 boolean equals(Object obj)
          Compares two objects for equality.
 ProtocolID getConnectionId()
          Returns the connectionID associated with the connection.
 int getGatewayLevel()
          Returns the level of this gateway.
 int getLevelOne()
          Returns the level associated with first node in the connection
 int getLevelTwo()
          Returns the level associated with second node in the connection
 NodeAddress getNodeOne()
          Returns the first node in the connection
 NodeAddress getNodeTwo()
          Returns the second node in the connection
 int hashCode()
          Generates a hash code for the receiver.
static void main(String[] args)
           
 byte[] snapshotConnectionInfo(int level)
          This is a marshalling of the connection information to be sent over a link.
 String toString()
          A string representation of the connection
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Connection

public Connection(NodeAddress thisNodeAddress,
                  NodeAddress nodeOne,
                  int levelOne,
                  NodeAddress nodeTwo,
                  int levelTwo,
                  int gatewayLevel,
                  ProtocolID connectionId)
Parameters:
thisNodeAddress - - The Node address of the node hosting a specific connectivity graph.
nodeOne - - Node Address of the first entity of the gateway.
levelOne - - The level of nodeOne.
nodeTwo - - Node Address of the second entity of the gateway.
levelTwo - - The level of nodeTwo.
gatewayLevel - - The gateway level

Connection

public Connection(NodeAddress nodeAddress,
                  byte[] connectionBytes)
This represents an unmarshalling of the connection information that is received over the link.

Parameters:
nodeAddress - - The node address of the server node hosting the connectivity graph.
connectionBytes - - A marshalled stream of bytes representing a connection.
Method Detail

getConnectionId

public ProtocolID getConnectionId()
Returns the connectionID associated with the connection.

Returns:
The connctionID for this particular connection

getNodeOne

public NodeAddress getNodeOne()
Returns the first node in the connection

Returns:
The first node in the connection

getLevelOne

public int getLevelOne()
Returns the level associated with first node in the connection

Returns:
The level of the first node in the connection

getNodeTwo

public NodeAddress getNodeTwo()
Returns the second node in the connection

Returns:
- The second node in the connection

getLevelTwo

public int getLevelTwo()
Returns the level associated with second node in the connection

Returns:
The level of the second node in the connection

getGatewayLevel

public int getGatewayLevel()
Returns the level of this gateway. i.e weather this is a level-0 gateway or level-1 and so on.

Returns:
level - The level of this gateway

snapshotConnectionInfo

public byte[] snapshotConnectionInfo(int level)
This is a marshalling of the connection information to be sent over a link. However the marshalling varies depending on the kind of link that this information is going to be sent over. This is dictated by the rules for the representation of a connection within the connectivity graph of the hosting node as a connection that would be consistent with another nodes view of the system.

Parameters:
level - - The level of the gateway over which this connection information needs to be sent over.
Returns:
A marshalled stream of connection bytes representing the connection, created using the rules alluded earlier.

toString

public String toString()
A string representation of the connection

Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Compares two objects for equality. Returns a boolean that indicates whether this object is equivalent to the specified object. This method is used when an object is stored in a hashtable.

Overrides:
equals in class Object
Parameters:
obj - the Object to compare with
Returns:
true if these Objects are equal; false otherwise.
See Also:
Hashtable

hashCode

public int hashCode()
Generates a hash code for the receiver. This method is supported primarily for hash tables, such as those provided in java.util. If two objects are equal (equals(Object) returns true) they must have the same hash code

Overrides:
hashCode in class Object
Returns:
an integer hash code for the receiver

main

public static void main(String[] args)


For comments and suggestions please send e-mail to The NaradaBrokering Project