|
Project 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
This type of advertisement is used to represent a route to a destination peer in the JXTA virtual network. 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 route The destination and hops are defined using an AccessPoint Advertisement as JXTA PeerIDs with a list of optional endpoint addresses. The endpoint addresses defined the physical endpoint addresses that can be used to reach the corresponding hop. The PeerID information is required. The endpoint address information is optional.
PeerAdvertisement
,
AccessPointAdvertisement
Constructor Summary | |
---|---|
RouteAdvertisement()
|
Method Summary | |
---|---|
void |
addDestEndpointAddresses(Vector addresses)
add a new list of EndpointAddresses to the Route Destination access point |
void |
addEndpointAddressToHop(PeerID pid,
EndpointAddress addr)
Add a new endpointaddress to a hop |
static void |
cleanupLoop(RouteAdvertisement route,
PeerID localPeer)
Remove loops from the route advertisement by shortcuting cycle from the route |
Object |
clone()
|
Object |
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()
Returns the destination access point |
Vector |
getDestEndpointAddresses()
Return the endpoint addresses of the destination |
PeerID |
getDestPeerID()
Returns the route destination Peer ID |
AccessPointAdvertisement |
getFirstHop()
Returns the access point for the first hop |
AccessPointAdvertisement |
getHop(int index)
Return hop of the route at location index in the hops list |
AccessPointAdvertisement |
getHop(PeerID pid)
return a hop from the list of hops |
Enumeration |
getHops()
returns the list of hops |
ID |
getID()
Returns a unique ID suitable for indexing of this Advertisement. |
AccessPointAdvertisement |
getLastHop()
Returns the access point for the last hop |
Vector |
getVectorHops()
returns the list of hops |
boolean |
hasALoop()
check if the route has a loop |
static RouteAdvertisement |
newRoute(PeerID destPid,
PeerID firsthop,
Vector hops)
construct a new route WARNING hops may be MODIFIED. |
static RouteAdvertisement |
newRoute(PeerID destPid,
Vector hops)
construct a new route, all hops are in the hops parameter. |
AccessPointAdvertisement |
nextHop(PeerID pid)
get the nexthop after the given hop |
void |
removeDestEndpointAddresses(Vector addresses)
remove a list of EndpointAddresses from the Route Destination access point |
void |
removeEndpointAddressToHop(PeerID pid,
EndpointAddress addr)
remove an endpointaddress to a hop |
boolean |
removeHop(PeerID pid)
remove a hop from the list of hops |
void |
replaceHop(AccessPointAdvertisement ap)
replace a hop from the list of hops |
void |
setDest(AccessPointAdvertisement ap)
Sets the access point of the destination |
void |
setDestEndpointAddresses(Vector ea)
Set the route destination endpoint addresses |
void |
setDestPeerID(PeerID pid)
Sets the route destination peer id |
void |
setFirstHop(AccessPointAdvertisement ap)
Sets the access point for the first hop |
void |
setHops(Vector hopsAccess)
sets the list of hops associated with this route |
void |
setLastHop(AccessPointAdvertisement ap)
Sets the access point for 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, handleElement |
Methods inherited from class net.jxta.document.Advertisement |
---|
getAdvType, getIndexFields, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RouteAdvertisement()
Method Detail |
---|
public Object clone()
clone
in class Advertisement
public Object cloneOnlyPIDs()
public static final String getAdvertisementType()
public final String getBaseAdvType()
final
.
getBaseAdvType
in class ExtendableAdvertisement
public ID getID()
java.lang.IllegalStateException
should be
thrown.
getID
in class Advertisement
public AccessPointAdvertisement getDest()
public void setDest(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the destination peerpublic Enumeration getHops()
public Vector getVectorHops()
public void setHops(Vector hopsAccess)
hopsAccess
- Enumeration of hops as AccessPointAdvertisement
The vector of hops is specified as a vector of AccessPoint
advertisement.public void addDestEndpointAddresses(Vector addresses)
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 removeDestEndpointAddresses(Vector addresses)
addresses
- vector of endpoint addresses to remove from the
destination access point. Warning: The vector of endpoint addresses is
specified as a vector of String. Each string representing one
endpoint address.public AccessPointAdvertisement getFirstHop()
public void setFirstHop(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the first hoppublic AccessPointAdvertisement getLastHop()
public void setLastHop(AccessPointAdvertisement ap)
ap
- AccessPointAdvertisement of the last hoppublic PeerID getDestPeerID()
public void setDestPeerID(PeerID pid)
pid
- route destination peerIDpublic void setDestEndpointAddresses(Vector ea)
ea
- vector of endpoint addresses. Warning: The vector of endpoint
addresses is specified as a vector of String. Each string
representing one endpoint address.public Vector getDestEndpointAddresses()
public boolean containsHop(PeerID pid)
pid
- peer id of the hop
public boolean hasALoop()
public int size()
public AccessPointAdvertisement nextHop(PeerID pid)
pid
- 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 void replaceHop(AccessPointAdvertisement ap)
ap
- accesspointadvertisement of the hop to replacepublic void addEndpointAddressToHop(PeerID pid, EndpointAddress addr)
pid
- id of the hopaddr
- new endpoint address to addpublic void removeEndpointAddressToHop(PeerID pid, EndpointAddress addr)
pid
- id of the hopaddr
- new endpoint address to removepublic boolean equals(Object target)
equals
in class Object
target
- the route to compare against
public AccessPointAdvertisement getHop(int index)
index
- in the list of hops
public static RouteAdvertisement newRoute(PeerID destPid, PeerID firsthop, Vector hops)
public static RouteAdvertisement newRoute(PeerID destPid, Vector hops)
public static boolean stichRoute(RouteAdvertisement newRoute, RouteAdvertisement firstLeg)
public static boolean stichRoute(RouteAdvertisement newRoute, RouteAdvertisement firstLeg, PeerID localPeer)
public static void cleanupLoop(RouteAdvertisement route, PeerID localPeer)
|
JXTA J2SE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |