cgl.narada.protocol
Class Destinations

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

public class Destinations
extends Object
implements ProtocolDebugFlags

This class maintains the destinations that are associated with any given node in the connectivity graph. The class contains utilities methods for updating destination lists and also for the invalidation of specific entries in the destination Lists.


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
Destinations(byte[] routingInformation)
          Constructs a destinations object, with the routing information received as a sequence of bytes.
Destinations(int systemLevel)
          Constructs a destination list with the specified systemLevel indicator
 
Method Summary
 Destinations computeDestinationsThatCannotBeReached(Destinations destinationsToReach)
          Given a set of destinations that needs to be reached.
 boolean equals(Object obj)
          Compares two objects for equality.
 int getDestinationsAtLevel(int level)
          This method gets the destinations that need to be reached at a given level.
 byte[] getDestinationsInBytes()
          Returns the destinations as a sequence of bytes
 int[] getDestinationsInInts()
          Returns the destinations as a sequence of integers
 int getSystemLevel()
          Returns the systemLevel associated with the destination
 int hashCode()
          Generates a hash code for the receiver.
 void invalidateDestinationsAtLevel(int gatewayLevel)
          For a destination list associated with a hop, in response to the addition or failure of a gatewayLevel connection, the shortest path to nodes => gatewayLevel is updated.
static void main(String[] args)
           
 void markAsTraversedAt(Destinations destinationToBeAdded)
          Every node has a destination identifier.
 byte[] prepareDestinationsToSendOverLevel(int level)
          When a destination is being sent over a Level level gateway, the system is not interested in the destinations that exist at lower levels.
 void removeFromDestinationList(Gateway gateway)
          This method eliminates the provided gateway's entry from the set of destinations encapsulated within this structure.
 void setDestinationsAtLevel(int level, int value)
          This method sets the destinations at a given level
 String toString()
           
 void updateDestinationList(Destinations _destination)
          This is added to account for the MatchingProblem scenario
 void updateDestinationList(Gateway gateway)
          This updates the destinations associated with a certain hop.
 void updateWithDestination(Destinations _update)
          Java objects are passed by reference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Destinations

public Destinations(int systemLevel)
Constructs a destination list with the specified systemLevel indicator

Parameters:
systemLevel - - The level of the system.

Destinations

public Destinations(byte[] routingInformation)
Constructs a destinations object, with the routing information received as a sequence of bytes.

Parameters:
routingInformation - - The sequence of bytes that constitutes the routing information
Method Detail

updateWithDestination

public void updateWithDestination(Destinations _update)
Java objects are passed by reference. This allows us to update a destinations instance with some other. This is specifically used in tandem with the hopsToReachDestination method in the routing cache


updateDestinationList

public void updateDestinationList(Gateway gateway)
This updates the destinations associated with a certain hop. The gateway indicates the gateway that can be reached the fastest from the hop in question

Parameters:
gateway - The gateway in the connectivity graph which can be reached the fastest from the hop in question

removeFromDestinationList

public void removeFromDestinationList(Gateway gateway)
This method eliminates the provided gateway's entry from the set of destinations encapsulated within this structure.

Parameters:
gateway - The gateway in the connectivity graph that will be removed.

updateDestinationList

public void updateDestinationList(Destinations _destination)
This is added to account for the MatchingProblem scenario


invalidateDestinationsAtLevel

public void invalidateDestinationsAtLevel(int gatewayLevel)
For a destination list associated with a hop, in response to the addition or failure of a gatewayLevel connection, the shortest path to nodes => gatewayLevel is updated. The first step in the updating procedure is to invalidate the destinations associated with a hop for destinations > gatewayLevel. This method performs this function

Parameters:
gatewayLevel - - The levels that need to be invalidated

getDestinationsInBytes

public byte[] getDestinationsInBytes()
Returns the destinations as a sequence of bytes


getDestinationsInInts

public int[] getDestinationsInInts()
Returns the destinations as a sequence of integers

Returns:
The destination as a sequence of integers

getSystemLevel

public int getSystemLevel()
Returns the systemLevel associated with the destination

Returns:
The systemLevel

toString

public String toString()
Overrides:
toString in class Object

getDestinationsAtLevel

public int getDestinationsAtLevel(int level)
This method gets the destinations that need to be reached at a given level.

Parameters:
level - The destinations that need to be retrieved for a given level.

setDestinationsAtLevel

public void setDestinationsAtLevel(int level,
                                   int value)
This method sets the destinations at a given level

Parameters:
level - - The level for which the destination needs to be updated
value - - The destinations for level encoded within the integer value

computeDestinationsThatCannotBeReached

public Destinations computeDestinationsThatCannotBeReached(Destinations destinationsToReach)
Given a set of destinations that needs to be reached. This method computes the destinations that cannot be reached using the hop that the destination is associated with. For a set of hops emanating from the vertex node in the connectivity graph, we pass through the hops sequentially with the result of the invocation of this method on one hop being used as an argument to this method in the other hop. The return value indicates several things to us. There are 3 cases which are of importance.
  • returnValue = destinationsToReach - This case implies that none of the destinations could be reached.
  • returnValue == 0 - This case implies that all the destinations can be reached from the hop that this destinations is associated with.
  • returnValue !=0 && returnValue != destinationsToReach - This case means that some destinations could be reached from the hop. However, not all destinations could be reached

    Returns:
    The destinations that could not reached using a given hop.

  • 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

    prepareDestinationsToSendOverLevel

    public byte[] prepareDestinationsToSendOverLevel(int level)
    When a destination is being sent over a Level level gateway, the system is not interested in the destinations that exist at lower levels. These destinations would be recomputed at the receiving node.

    Parameters:
    level - The gateway level over which the destinations are gonna be sent over.
    Returns:
    The byte stream of the destinations

    markAsTraversedAt

    public void markAsTraversedAt(Destinations destinationToBeAdded)
    Every node has a destination identifier. When a message is received over a link, the destinations at which the message was received needs to be updated to reflect the fact that this destination was received at this server node. This method updates a destination list to indicate that it was delivered at the server node.

    Parameters:
    destinationToBeAdded - The destination associated with the server node.

    main

    public static void main(String[] args)


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