cgl.narada.protocol
Class GatewayInfo

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

public class GatewayInfo
extends Object
implements ProtocolDebugFlags

This class keeps track of the gatekeepers that a node should be aware of. This information is used by the the PPP, NOP and GPP suite of protocols. This information is used to determine

The Event routing protocol should also have access to this gateway informations to decide on the next unit/node that the event would be routed to.

Version:
: $Revision$ $Date$

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
GatewayInfo()
           
GatewayInfo(int systemLevel)
          The Gateway Info requires information regarding the system Levels that are available with the system.
 
Method Summary
 void addConnection(Connection connection)
          This method adds a connection to the GatewayInfo, the connection could comprise of nodes at different levels within the connectivity graph.
 int computeLowestNumberedUnitAtLevel(int level)
          A utility method that allows us to compute the lowested numbered unit at a given level
 boolean containsConnection(ProtocolID connectionId)
          This method indicates if a connection already exists within the connectionTable, if this is the case - the connection needs to be removed from the connection table
 void enumerateBestHopsToTake()
          A test function which enumerates the hops that need to be taken to reach any node in the connectivity graph.
 Gateway getBestHopToReachNode(Gateway nodeToReach)
          This method returns the best hop that needs to be taken to reach a given node.
 Connection getConnection(ProtocolID connectionId)
           
 Destinations getDestinationsReachedFromHop(Gateway gateway)
          Provides the destinations that can be reached from a hop.
 Destinations getFastestDestinationsFromHop(Gateway hop)
          Returns the destinations that can be reached fastest from the specified hop.
 Gateway[] getHops()
          This method provides a list of the direct hops that can be taken from the vertex node of the connectivity graph.
 Destinations getListOfDestinationsKnownToNode()
          This method lists the destinations at different levels that can be reached from this node.
 Gateway[] getListOfValidHopsToRoute(byte[] routingInformation)
          When presented within a list of destinations that have already been traversed, this method returns a list of hops that can be taken in a manner consistent with our policy of not routing an event to the same node twice.
 int getLowestNumberedUnitAtLevel(int level)
          This method provides us with the lowest numbered unit at a certain level within the connectivity graph.
 NodeAddress getNodeAddress()
          Accessor function for retrieving the node address of the server node hosting the connectivity graph.
 int getSystemLevel()
          This method returns the system level of the system.
 Gateway getVertexNode()
          Returns the vertex node in the connectivity graph.
 Gateway[] hopsToReachDestination(Destinations destinationToReach, Destinations traversedSoFar)
          This method provides a list of links over which a certain event must be sent to reach the destinations computed by the profile matching and contained within the event's routing information.
 Vector listTheGatewaysWithinUnitAtLevel(int level)
          This method provides us with a list of gateways at a certain level l that exist within the level l units.
static void main(String[] args)
           
 byte[] prepareConnectionsToSendOverLevel(int level)
          In response to a sub system (LEVEL level) being added to an existing system, the node belonging to the system needs to exachange data with regarding gateways at level onwards in the newly merged system.
 void processConnectionBuffer(byte[] connectionBuffer)
          Process the information received as a byte[] over the link.
 void removeConnection(Connection connection)
          This method removes a connection from the GatewayInfo, the connection could comprise of nodes at different levels within the connectivity graph.
 void removeGatewayInfo(Short level, Gateway gateway)
          React to failure suspicions, update the gateway info available and compute new routes to reach destinations
 void setNodeAddress(NodeAddress nodeAddress)
          After a node address has been assigned, this method is responsible for setting the node address for the connectivity graph.
 void setProtocolHandler(ProtocolHandler protocolHandler)
          This method sets the protocolHandler for the node in question.
 void setVertexNode(Gateway vertexNode)
          This sets the server node hosting the connectivity graph for that node, as the vertex node for computations involving calculation of shortest routes, detection of partitions etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GatewayInfo

public GatewayInfo(int systemLevel)
The Gateway Info requires information regarding the system Levels that are available with the system. For a system comprising only of clusters the system level is 1.

Parameters:
systemLevel - - The system level.

GatewayInfo

public GatewayInfo()
Method Detail

getSystemLevel

public int getSystemLevel()
This method returns the system level of the system.

Returns:
The system Level

setNodeAddress

public void setNodeAddress(NodeAddress nodeAddress)
After a node address has been assigned, this method is responsible for setting the node address for the connectivity graph.

Parameters:
nodeAddress - The node address of the server node hosting the connectivity graph

getNodeAddress

public NodeAddress getNodeAddress()
Accessor function for retrieving the node address of the server node hosting the connectivity graph.

Returns:
The node address of the server node.

setVertexNode

public void setVertexNode(Gateway vertexNode)
This sets the server node hosting the connectivity graph for that node, as the vertex node for computations involving calculation of shortest routes, detection of partitions etc.

Parameters:
vertexNode - The vertex node for the connectivity graph.

getVertexNode

public Gateway getVertexNode()
Returns the vertex node in the connectivity graph. Useful during the processing of connections for different protocol layers.

Returns:
The vertex node of the connectivity graph.

setProtocolHandler

public void setProtocolHandler(ProtocolHandler protocolHandler)
This method sets the protocolHandler for the node in question. This comes into the picture, to help us keep track of the kind of gateways this node turns out to be, depending on the connections that are added. We use this to keep track of our propagation schemes in the PPP protocol layer.

Parameters:
protocolHandler - The protocol Handler for the node in question

containsConnection

public boolean containsConnection(ProtocolID connectionId)
This method indicates if a connection already exists within the connectionTable, if this is the case - the connection needs to be removed from the connection table

Parameters:
connectionId - The connection ID of the connection currently being disseminated through relevant parts of the sub-system.
Returns:
true If the connection already exists. No further dissemination should be allowed for such connections.

getConnection

public Connection getConnection(ProtocolID connectionId)

addConnection

public void addConnection(Connection connection)
This method adds a connection to the GatewayInfo, the connection could comprise of nodes at different levels within the connectivity graph. Creation of the edge in the connectivity graph, and also the process of updating the routing cache in response to addition of a connection is within the purview of this method.

Parameters:
connection - - The connection that needs to be added to the connectivity graph.

removeConnection

public void removeConnection(Connection connection)
This method removes a connection from the GatewayInfo, the connection could comprise of nodes at different levels within the connectivity graph. Removal of the edge in the connectivity graph, and also the process of updating the routing cache in response to the removal of a connection is within the purview of this method.

Parameters:
connection - - The connection that needs to be removed the connectivity graph.

getListOfDestinationsKnownToNode

public Destinations getListOfDestinationsKnownToNode()
This method lists the destinations at different levels that can be reached from this node. This method is useful when we are trying to generate the preliminary list of destinations that are associated within an event.

Returns:
The destinations that are known to this node.

listTheGatewaysWithinUnitAtLevel

public Vector listTheGatewaysWithinUnitAtLevel(int level)
This method provides us with a list of gateways at a certain level l that exist within the level l units.

Parameters:
level - This indicates the level of the gateway within a unit at that level that we are seeking.

prepareConnectionsToSendOverLevel

public byte[] prepareConnectionsToSendOverLevel(int level)
In response to a sub system (LEVEL level) being added to an existing system, the node belonging to the system needs to exachange data with regarding gateways at level onwards in the newly merged system. This method provides a view of the connectivity graph that would be valid at the other node. This provides a serialized list of the connections that need to be sent over a certain level

Parameters:
level - - This is the level of the gateway over the information needs to be sent.
Returns:
- The serialized representation, as a sequence of bytes, of the connections that would be consistent with the other node's view of the system.

processConnectionBuffer

public void processConnectionBuffer(byte[] connectionBuffer)
Process the information received as a byte[] over the link. At the receiving node, the connectivity graph is constructed based on the information that is received at this node.

Parameters:
connectionBuffer - The sequence of byes received over the link.

getHops

public Gateway[] getHops()
This method provides a list of the direct hops that can be taken from the vertex node of the connectivity graph.

Returns:
- The list of hops that can be taken.

getBestHopToReachNode

public Gateway getBestHopToReachNode(Gateway nodeToReach)
This method returns the best hop that needs to be taken to reach a given node. This information is contained within the routing cache, and is accessed by the gateway info class.

Parameters:
nodeToReach - - Is the (node+level) gateway node that needs to be reached in the connectivity graph.
Returns:
  • The best hop that can be used to reach this node.
  • null - If no such path exists.

  • getFastestDestinationsFromHop

    public Destinations getFastestDestinationsFromHop(Gateway hop)
    Returns the destinations that can be reached fastest from the specified hop.

    Parameters:
    hop -
    Returns:

    getDestinationsReachedFromHop

    public Destinations getDestinationsReachedFromHop(Gateway gateway)
    Provides the destinations that can be reached from a hop. The destinations are returned as a node address.

    Parameters:
    gateway - - The hop from the server node hosting the connectivity graph.
    Returns:
    The destinations that can be reached from this hop, if it is a valid hop. Otherwise return null.

    getListOfValidHopsToRoute

    public Gateway[] getListOfValidHopsToRoute(byte[] routingInformation)
    When presented within a list of destinations that have already been traversed, this method returns a list of hops that can be taken in a manner consistent with our policy of not routing an event to the same node twice.

    Parameters:
    routingInformation - - The routing information contained within a message i.e. event, protocol packets etc.
    Returns:
    - The list of valid hops that can be taken

    enumerateBestHopsToTake

    public void enumerateBestHopsToTake()
    A test function which enumerates the hops that need to be taken to reach any node in the connectivity graph.


    removeGatewayInfo

    public void removeGatewayInfo(Short level,
                                  Gateway gateway)
    React to failure suspicions, update the gateway info available and compute new routes to reach destinations

    Parameters:
    level - The level of the node that failed
    gateway - The gateway node in the graph.

    hopsToReachDestination

    public Gateway[] hopsToReachDestination(Destinations destinationToReach,
                                            Destinations traversedSoFar)
    This method provides a list of links over which a certain event must be sent to reach the destinations computed by the profile matching and contained within the event's routing information.


    getLowestNumberedUnitAtLevel

    public int getLowestNumberedUnitAtLevel(int level)
    This method provides us with the lowest numbered unit at a certain level within the connectivity graph. This is used by the node addition protocol to compute the destination lists associated with a node addition address request

    Parameters:
    level - The level for which the lowest numbered unit is sought.

    computeLowestNumberedUnitAtLevel

    public int computeLowestNumberedUnitAtLevel(int level)
    A utility method that allows us to compute the lowested numbered unit at a given level


    main

    public static void main(String[] args)


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