JXTA

net.jxta.impl.endpoint.router
Class RouteControl

java.lang.Object
  extended by net.jxta.impl.endpoint.router.RouteControl

public class RouteControl
extends Object

Provides an "IOCTL" style interface to the JXTA router transport


Field Summary
static int ALREADY_EXIST
           
static int DIRECT_ROUTE
           
static int FAILED
           
static int INVALID_ROUTE
           
static int OK
          return value for operation
 
Constructor Summary
RouteControl(EndpointRouter router, ID pid)
          initialize RouteControl
 
Method Summary
 boolean addMessengerFor(Object source, EndpointAddress destination, Messenger messenger)
          Get the low level messenger for a destination.
 int addRoute(RouteAdvertisement newRoute)
          add a new route.
 int deleteRoute(PeerID pId)
          Delete route info
 void disableRouteCM()
          disable usage of Route CM cache
 void disableRouteResolver()
          disable usage of Route resolver
 void enableRouteCM()
          enable usage of Route CM cache
 void enableRouteResolver()
          enable usage of Route Resolver
 Vector<RouteAdvertisement> getAllRoutesInfo()
          get all the know routes by the router.
 Messenger getMessengerFor(EndpointAddress destination, Object hint)
          Get the low level messenger for a destination.
 RouteAdvertisement getMyLocalRoute()
          get my local route
 RouteAdvertisement getRouteInfo(PeerID pId)
          Get a current route info
 boolean isConnected(PeerID pid)
          Determines whether a connection to a specific node exists, or if one can be created.
 boolean useRouteCM()
          get RouteCM usage
 boolean useRouteResolver()
          get RouteResolver usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

public static final int OK
return value for operation

See Also:
Constant Field Values

ALREADY_EXIST

public static final int ALREADY_EXIST
See Also:
Constant Field Values

FAILED

public static final int FAILED
See Also:
Constant Field Values

DIRECT_ROUTE

public static final int DIRECT_ROUTE
See Also:
Constant Field Values

INVALID_ROUTE

public static final int INVALID_ROUTE
See Also:
Constant Field Values
Constructor Detail

RouteControl

public RouteControl(EndpointRouter router,
                    ID pid)
initialize RouteControl

Parameters:
router - the router
pid - the PeerID
Method Detail

getMyLocalRoute

public RouteAdvertisement getMyLocalRoute()
get my local route

Returns:
RoutAdvertisement of the local route

addRoute

public int addRoute(RouteAdvertisement newRoute)
add a new route. For the route to be useful, we actively verify the route by trying it

Parameters:
newRoute - route to add
Returns:
Integer status (OK, FAILED, INVALID_ROUTE or ALREADY_EXIST)

getRouteInfo

public RouteAdvertisement getRouteInfo(PeerID pId)
Get a current route info

Parameters:
pId - destination of the route
Returns:
RouteAdvertisement current route info

deleteRoute

public int deleteRoute(PeerID pId)
Delete route info

Parameters:
pId - destination route to be removed
Returns:
Integer status

getAllRoutesInfo

public Vector<RouteAdvertisement> getAllRoutesInfo()
get all the know routes by the router. Return a vector of all the routes known.

This method which is meant for informational purposes, does not lock the maps that it browses. As a result, it could in some cases generate a concurrent modification exception.

Returns:
vector of known routes

useRouteCM

public boolean useRouteCM()
get RouteCM usage

Returns:
true if use route CM is set

useRouteResolver

public boolean useRouteResolver()
get RouteResolver usage

Returns:
true of use route resolver

enableRouteCM

public void enableRouteCM()
enable usage of Route CM cache


disableRouteCM

public void disableRouteCM()
disable usage of Route CM cache


enableRouteResolver

public void enableRouteResolver()
enable usage of Route Resolver


disableRouteResolver

public void disableRouteResolver()
disable usage of Route resolver


addMessengerFor

public boolean addMessengerFor(Object source,
                               EndpointAddress destination,
                               Messenger messenger)
Get the low level messenger for a destination.

Parameters:
source - the source endpoint address
destination - the destination endpoint address
messenger - the messenger to add
Returns:
true if successful

getMessengerFor

public Messenger getMessengerFor(EndpointAddress destination,
                                 Object hint)
Get the low level messenger for a destination.

Parameters:
destination - the destination endpoint address
hint - route hint
Returns:
the messenger for the destination

isConnected

public boolean isConnected(PeerID pid)
Determines whether a connection to a specific node exists, or if one can be created. This method can block to ensure a usable connection exists, it does so by sending an empty message.

Parameters:
pid - Node ID
Returns:
true, if a connection already exists, or a new was sucessfully created

JXSE