Rice Pastry API

rice.pastry.socket
Class SourceRoute

java.lang.Object
  extended byrice.pastry.messaging.Message
      extended byrice.pastry.messaging.PRawMessage
          extended byrice.pastry.socket.SourceRoute
All Implemented Interfaces:
Message, RawMessage, java.io.Serializable

public class SourceRoute
extends PRawMessage
implements java.io.Serializable

Class which represets a source route to a remote IP address.

Version:
$Id: SourceRoute.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  EpochInetSocketAddress[] path
          DESCRIBE THE FIELD
static short TYPE
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.messaging.Message
DEFAULT_PRIORITY_LEVEL
 
Fields inherited from interface rice.p2p.commonapi.Message
HIGH_PRIORITY, LOW_PRIORITY, MAX_PRIORITY, MEDIUM_HIGH_PRIORITY, MEDIUM_LOW_PRIORITY, MEDIUM_PRIORITY
 
Method Summary
 SourceRoute append(EpochInetSocketAddress address)
          Method which creates a new source route by appending the given address to the end of this one
static SourceRoute build(EpochInetSocketAddress address)
          Constructor.
static SourceRoute build(EpochInetSocketAddress[] path)
          Constructor.
static SourceRoute build(InputBuffer buf)
          DESCRIBE THE METHOD
 boolean equals(java.lang.Object o)
          Checks equaltiy on source routes
 EpochInetSocketAddress getFirstHop()
          Method which returns the first "hop" of this source route
 EpochInetSocketAddress getHop(int i)
          Returns the hop at the given index
 EpochInetSocketAddress getLastHop()
          Method which returns the first "hop" of this source route
 int getNumHops()
          Returns the number of hops in this source route
 short getType()
          Raw Serialization **************************************
 boolean goesThrough(EpochInetSocketAddress address)
          Returns whether or not this route goes through the given address
 int hashCode()
          Returns the hashCode of this source route
 boolean isDirect()
          Returns whether or not this route is direct
 SourceRoute prepend(EpochInetSocketAddress address)
          Method which creates a new source route by appending the given address to the end of this one
 SourceRoute removeLastHop()
          Method which creates a new source route by removing the last hop of this one
protected static SourceRoute resolve(java.util.WeakHashMap map, SourceRoute route)
          Method which performs the coalescing and interaction with the weak hash map
 SourceRoute reverse()
          Method which revereses path
 SourceRoute reverse(EpochInetSocketAddress localAddress)
          Method which revereses path and cliams the corresponding address
 void serialize(OutputBuffer buf)
          DESCRIBE THE METHOD
 java.net.InetSocketAddress[] toArray()
          Internal method which returns an array representing the source route
 java.lang.String toString()
          Internal method for computing the toString of an array of InetSocketAddresses
 java.lang.String toStringFull()
          Internal method for computing the toString of an array of InetSocketAddresses
 
Methods inherited from class rice.pastry.messaging.Message
getDate, getDestination, getPriority, getSender, getSenderId, setPriority, setSender, stamp
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface rice.p2p.commonapi.Message
getPriority
 

Field Detail

path

protected EpochInetSocketAddress[] path
DESCRIBE THE FIELD


TYPE

public static final short TYPE
DESCRIBE THE FIELD

See Also:
Constant Field Values
Method Detail

getFirstHop

public EpochInetSocketAddress getFirstHop()
Method which returns the first "hop" of this source route

Returns:
The first hop of this source route

getLastHop

public EpochInetSocketAddress getLastHop()
Method which returns the first "hop" of this source route

Returns:
The first hop of this source route

getNumHops

public int getNumHops()
Returns the number of hops in this source route

Returns:
The number of hops

getHop

public EpochInetSocketAddress getHop(int i)
Returns the hop at the given index

Parameters:
i - The hop index
Returns:
The hop

isDirect

public boolean isDirect()
Returns whether or not this route is direct

Returns:
whether or not this route is direct

getType

public short getType()
Raw Serialization **************************************

Specified by:
getType in interface RawMessage
Returns:
The Type value

hashCode

public int hashCode()
Returns the hashCode of this source route

Returns:
The hashCode

equals

public boolean equals(java.lang.Object o)
Checks equaltiy on source routes

Parameters:
o - The source route to compare to
Returns:
The equality

toString

public java.lang.String toString()
Internal method for computing the toString of an array of InetSocketAddresses

Returns:
THe string

toStringFull

public java.lang.String toStringFull()
Internal method for computing the toString of an array of InetSocketAddresses

Returns:
THe string

reverse

public SourceRoute reverse(EpochInetSocketAddress localAddress)
Method which revereses path and cliams the corresponding address

Parameters:
localAddress - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

reverse

public SourceRoute reverse()
Method which revereses path

Returns:
DESCRIBE THE RETURN VALUE

goesThrough

public boolean goesThrough(EpochInetSocketAddress address)
Returns whether or not this route goes through the given address

Parameters:
address - DESCRIBE THE PARAMETER
Returns:
whether or not this route goes through the given address

toArray

public java.net.InetSocketAddress[] toArray()
Internal method which returns an array representing the source route

Returns:
An array represetning the route

removeLastHop

public SourceRoute removeLastHop()
Method which creates a new source route by removing the last hop of this one

Returns:
DESCRIBE THE RETURN VALUE

append

public SourceRoute append(EpochInetSocketAddress address)
Method which creates a new source route by appending the given address to the end of this one

Parameters:
address - The address to append
Returns:
DESCRIBE THE RETURN VALUE

prepend

public SourceRoute prepend(EpochInetSocketAddress address)
Method which creates a new source route by appending the given address to the end of this one

Parameters:
address - The address to append
Returns:
DESCRIBE THE RETURN VALUE

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
DESCRIBE THE METHOD

Specified by:
serialize in interface RawMessage
Parameters:
buf - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

resolve

protected static SourceRoute resolve(java.util.WeakHashMap map,
                                     SourceRoute route)
Method which performs the coalescing and interaction with the weak hash map

Parameters:
map - DESCRIBE THE PARAMETER
route - DESCRIBE THE PARAMETER
Returns:
The Id to use

build

public static SourceRoute build(EpochInetSocketAddress[] path)
Constructor.

Parameters:
path - The path of the route
Returns:
DESCRIBE THE RETURN VALUE

build

public static SourceRoute build(EpochInetSocketAddress address)
Constructor.

Parameters:
address - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

build

public static SourceRoute build(InputBuffer buf)
                         throws java.io.IOException
DESCRIBE THE METHOD

Parameters:
buf - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection