|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.document.Advertisement
net.jxta.document.ExtendableAdvertisement
net.jxta.protocol.RouteAdvertisement
public abstract class RouteAdvertisement
Advertisement used to represent a route to a peer. Routes are represented in a generic manner as a sequence of hops to reach the destination. Each hop represent a potential relay peer in the route:
Dest hop 1 hop 2 hop 3 .... hop nA route can have as many hops as necessary. Hops are implicitly ordered starting from the hop with the shortest route to reach the destination. If a peer cannot reach directly the dest, it should try to reach in descending order one of the listed hops. Some hops may have the same physical distance to the destination. Some hops may define alternative routes. The destination and hops are defined using a AccessPointAdvertisements.
PeerAdvertisement
,
AccessPointAdvertisement
Field Summary | |
---|---|
static String |
DEST_PID_TAG
|
Constructor Summary | |
---|---|
RouteAdvertisement()
|
Method Summary | |
---|---|
void |
addDestEndpointAddress(EndpointAddress addr)
Add the specified endpoint address to destination peer. |
void |
addDestEndpointAddresses(List<EndpointAddress> addrs)
Add all of the specified endpoint addresses to destination peer. |
void |
addDestEndpointAddresses(Vector<String> addresses)
Deprecated. Use #addDestEndpointAddresses(List instead. |
static void |
cleanupLoop(RouteAdvertisement route,
PeerID localPeer)
Remove loops from the route advertisement by shortcutting cycle from the route |
void |
clearDestEndpointAddresses()
Clears all endpoint addresses associated with the destination peer. |
RouteAdvertisement |
clone()
|
RouteAdvertisement |
cloneOnlyPIDs()
makes a copy of a route advertisement that only contains PID not endpoint addresses |
boolean |
containsHop(PeerID pid)
Check if the route contains the following hop |
String |
display()
Generate a string that displays the route information for logging or debugging purpose |
boolean |
equals(Object target)
Compare if two routes are equals. |
static String |
getAdvertisementType()
Returns the identifying type of this Advertisement. |
String |
getBaseAdvType()
Returns the base type of this advertisement hierarchy. |
AccessPointAdvertisement |
getDest()
Deprecated. Because this method unsafely exposes destination AccessPointAdvertisement it will be removed. |
List<EndpointAddress> |
getDestEndpointAddresses()
Returns the endpoint addresses of the destination peer in their preferred order. |
PeerID |
getDestPeerID()
Returns the route destination Peer ID |
AccessPointAdvertisement |
getFirstHop()
Returns the AccessPointAdvertisement of first hop. |
AccessPointAdvertisement |
getHop(PeerID pid)
Return a hop from the list of hops. |
Enumeration<AccessPointAdvertisement> |
getHops()
returns the list of hops |
ID |
getID()
Returns an ID which identifies this Advertisement as uniquely as
possible. |
AccessPointAdvertisement |
getLastHop()
Returns the access point for the last hop. |
Vector<AccessPointAdvertisement> |
getVectorHops()
returns the list of hops |
boolean |
hasALoop()
check if the route has a loop |
int |
hashCode()
|
static RouteAdvertisement |
newRoute(PeerID destPid,
PeerID firsthop,
Vector<AccessPointAdvertisement> hops)
construct a new route WARNING hops may be MODIFIED. |
AccessPointAdvertisement |
nextHop(PeerID currentHop)
Return the hop that follows the specified currentHop. |
void |
removeDestEndpointAddress(EndpointAddress addr)
Remove the specified endpoint address to destination peer. |
void |
removeDestEndpointAddresses(Collection<EndpointAddress> addrs)
Remove the specified endpoint addresses from destination peer. |
void |
removeDestEndpointAddresses(Vector<String> addresses)
Deprecated. Use removeDestEndpointAddresses(Collection) . |
boolean |
removeHop(PeerID pid)
Remove a hop from the list of hops. |
void |
setDest(AccessPointAdvertisement ap)
Sets the access point of the destination. |
void |
setDestEndpointAddresses(Vector<String> ea)
Deprecated. Use addDestEndpointAddress(EndpointAddress) instead. |
void |
setDestPeerID(PeerID pid)
Sets the route destination peer id. |
void |
setFirstHop(AccessPointAdvertisement ap)
Sets the AccessPointAdvertisement for the first hop. |
void |
setHops(Vector<AccessPointAdvertisement> newHops)
Sets the list of hops associated with this route. |
void |
setLastHop(AccessPointAdvertisement ap)
Sets the AccessPointAdvertisement of the last hop. |
int |
size()
return the length of the route |
static boolean |
stichRoute(RouteAdvertisement newRoute,
RouteAdvertisement firstLeg)
Alter the given newRoute (which does not start from here) by using firstLeg, a known route to whence it starts from. |
static boolean |
stichRoute(RouteAdvertisement newRoute,
RouteAdvertisement firstLeg,
PeerID localPeer)
Alter the given newRoute (which does not start from here) by using firstLeg, a known route to whence it starts from. |
Methods inherited from class net.jxta.document.ExtendableAdvertisement |
---|
getDocument, handleAttribute, handleElement |
Methods inherited from class net.jxta.document.Advertisement |
---|
getAdvType, getIndexFields, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEST_PID_TAG
Constructor Detail |
---|
public RouteAdvertisement()
Method Detail |
---|
public static RouteAdvertisement newRoute(PeerID destPid, PeerID firsthop, Vector<AccessPointAdvertisement> hops)
destPid
- destinationfirsthop
- first hop node IDhops
- routes
public RouteAdvertisement clone()
clone
in class Advertisement
public RouteAdvertisement cloneOnlyPIDs()
public boolean equals(Object target)
equals
in class Object
target
- the route to compare against
public int hashCode()
hashCode
in class Object
public static String getAdvertisementType()
public final String getBaseAdvType()
final
.
getBaseAdvType
in class ExtendableAdvertisement
public ID getID()
Advertisement
as uniquely as
possible. This ID is typically used as the primary key for indexing of
the Advertisement within databases.
Each advertisement sub-class must choose an appropriate implementation
which returns canonical and relatively unique ID values for it's
instances. Since this ID is commonly used for indexing, the IDs returned
must be as unique as possible to avoid collisions. The value for the ID
returned can either be:
IllegalStateException
should be
thrown.
getID
in class Advertisement
ID.nullID
if this advertisement is of a type that is not
normally indexed.public PeerID getDestPeerID()
public void setDestPeerID(PeerID pid)
pid
- route destination peerID@Deprecated public AccessPointAdvertisement getDest()
public void setDest(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the destination peer@Deprecated public void addDestEndpointAddresses(Vector<String> addresses)
#addDestEndpointAddresses(List)
instead.
addresses
- vector of endpoint addresses to add to the
destination access point. Warning: The vector of endpoint addresses
is specified as a vector of String. Each string representing
one endpoint address.public void clearDestEndpointAddresses()
public void addDestEndpointAddress(EndpointAddress addr)
addr
- EndpointAddress to add.public void addDestEndpointAddresses(List<EndpointAddress> addrs)
addrs
- EndpointAddresses to add.public void removeDestEndpointAddress(EndpointAddress addr)
addr
- EndpointAddress to add.public void removeDestEndpointAddresses(Collection<EndpointAddress> addrs)
addrs
- EndpointAddress to add.@Deprecated public void removeDestEndpointAddresses(Vector<String> addresses)
removeDestEndpointAddresses(Collection)
.
addresses
- vector of endpoint addresses to remove from the
destination access point.public List<EndpointAddress> getDestEndpointAddresses()
EndpointAddress
es of the destination peer.@Deprecated public void setDestEndpointAddresses(Vector<String> ea)
addDestEndpointAddress(EndpointAddress)
instead.
ea
- vector of endpoint addresses. Warning: The vector is not copied
and is used directly.public Enumeration<AccessPointAdvertisement> getHops()
public Vector<AccessPointAdvertisement> getVectorHops()
public void setHops(Vector<AccessPointAdvertisement> newHops)
newHops
- AccessPointAdvertisements which form the hops. The
Vector is NOT copied.public boolean containsHop(PeerID pid)
pid
- peer id of the hop
public AccessPointAdvertisement getFirstHop()
public void setFirstHop(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the first hop.public AccessPointAdvertisement getLastHop()
public void setLastHop(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the last hop.public boolean hasALoop()
public int size()
public AccessPointAdvertisement nextHop(PeerID currentHop)
currentHop
- PeerID of the current hop
public String display()
public boolean removeHop(PeerID pid)
pid
- peer id of the hop
public AccessPointAdvertisement getHop(PeerID pid)
pid
- peer id of the hop
public static boolean stichRoute(RouteAdvertisement newRoute, RouteAdvertisement firstLeg)
newRoute
- the new routefirstLeg
- the first route
public static boolean stichRoute(RouteAdvertisement newRoute, RouteAdvertisement firstLeg, PeerID localPeer)
newRoute
- the new routefirstLeg
- first hoplocalPeer
- local PeerID
public static void cleanupLoop(RouteAdvertisement route, PeerID localPeer)
route
- the route advertisementlocalPeer
- local PeerID
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |