Project JXTA

net.jxta.impl.endpoint.router
Class RouteCM

java.lang.Object
  extended bynet.jxta.impl.endpoint.router.RouteCM

public class RouteCM
extends Object


Field Summary
static long DEFAULT_EXPIRATION
          Default expiration time for Route advertisements.
 
Constructor Summary
RouteCM()
          Constructor
 
Method Summary
protected  void createRoute(RouteAdvertisement route)
          Create a new persistent route to the cache only if we can find set of endpoint addresses
protected  void disableRouteCM()
          disable routeCM usage
protected  void enableRouteCM()
          disable routeCM usage
protected  void flushRoute(EndpointAddress addr)
          flush route adv from CM
protected  Iterator getRouteAdv(EndpointAddress pId)
          get route advertisements from the local discovery cache.
 void init(PeerGroup group, ID assignedID, Advertisement impl, EndpointRouter router)
          initialize CM route
protected  void publishRoute(RouteAdvertisement route)
          Publish a route advertisement to the CM
 int startApp(String[] arg)
          Make this protocol as up and running.
 void stopApp()
          Stop the service
protected  boolean updateRoute(RouteAdvertisement route)
          publish or update new route from the advertisement cache
protected  boolean useRouteCM()
          return routeCM usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXPIRATION

public static final long DEFAULT_EXPIRATION
Default expiration time for Route advertisements. This is the amount of time which advertisements will live in caches. After this time, the advertisement should be refreshed from the source.

See Also:
Constant Field Values
Constructor Detail

RouteCM

public RouteCM()
Constructor

Method Detail

useRouteCM

protected boolean useRouteCM()
return routeCM usage


disableRouteCM

protected void disableRouteCM()
disable routeCM usage


enableRouteCM

protected void enableRouteCM()
disable routeCM usage


init

public void init(PeerGroup group,
                 ID assignedID,
                 Advertisement impl,
                 EndpointRouter router)
          throws PeerGroupException
initialize CM route

Throws:
PeerGroupException

startApp

public int startApp(String[] arg)
Make this protocol as up and running. When this method is called, all the services are already registered with the peergroup. So we do not need to delay binding any further. All the public methods, which could be called between init and startApp are defensive regarding the services possibly not being there.


stopApp

public void stopApp()
Stop the service


getRouteAdv

protected Iterator getRouteAdv(EndpointAddress pId)
get route advertisements from the local discovery cache. We collect straight RouteAdvertisements as well as what can be found in PeerAdvertisements. We can find both, and there's no way to know which is most relevant, so we have to return all and let the invoker try its luck with each.

Parameters:
pId - the target peer's logical address
Returns:
Iterator of advertisements (route, peer)

createRoute

protected void createRoute(RouteAdvertisement route)
Create a new persistent route to the cache only if we can find set of endpoint addresses

Parameters:
route - to be published

publishRoute

protected void publishRoute(RouteAdvertisement route)
Publish a route advertisement to the CM

Parameters:
route - advertisement to be published

flushRoute

protected void flushRoute(EndpointAddress addr)
flush route adv from CM

Parameters:
addr - endpoint address

updateRoute

protected boolean updateRoute(RouteAdvertisement route)
publish or update new route from the advertisement cache

Parameters:
route - to be published or updated
Returns:
boolean true or false if adv cache was updated

JXTA J2SE