SunSPOT API V5.0


com.sun.spot.networktools
Class NetManagementServer

java.lang.Object
  extended by com.sun.spot.networktools.NetManagementServer
All Implemented Interfaces:
IService, Runnable

public class NetManagementServer
extends Object
implements Runnable, IService

A daemon that responds to network management requests


Field Summary
static int NET_MANAGEMENT_RECEIVE_PORT
           
static int NET_MANAGEMENT_SERVER_PORT
          default port number for this service
static String systemProperty
          the spot property that enables this server
 
Fields inherited from interface com.sun.spot.service.IService
PAUSED, PAUSING, READY, RESUMING, RUNNING, STARTING, STOPPED, STOPPING
 
Constructor Summary
protected NetManagementServer()
          A server for creating and answering network management related requests
 
Method Summary
 boolean getEnabled()
          Return whether service is started automatically on reboot.
 String getName()
          Return the name of this service.
static IService getNetManagementServer()
          create and return the NetManagementServer singleton
 String getServiceName()
          return the name of the NetManagementServer
 int getStatus()
          Return the current status of this service.
 boolean isRunning()
          Return whether the service is currently running.
static void main(String[] args)
           
 boolean pause()
          Pause the service, and return whether successful.
static String requestRoute(long src, long dst)
          retrieve route information to a destination from a remote node
static RouteTable requestRouteTable(long target)
          Retrieve Route Table from a remote node
static LowPanStats requestStats(long target)
          Retrieve LowPan statistics from a remote node
 boolean resume()
          Resume the service, and return whether successful.
 void run()
          main execution thread of this server
 void setEnabled(boolean enable)
          Enable/disable whether service is started automatically.
 void setServiceName(String who)
          Assign a name to this service.
 boolean start()
          Start the service, and return whether successful.
 boolean stop()
          Stop the service, and return whether successful.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemProperty

public static final String systemProperty
the spot property that enables this server

See Also:
Constant Field Values

NET_MANAGEMENT_SERVER_PORT

public static final int NET_MANAGEMENT_SERVER_PORT
default port number for this service

See Also:
Constant Field Values

NET_MANAGEMENT_RECEIVE_PORT

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

NetManagementServer

protected NetManagementServer()
A server for creating and answering network management related requests

Method Detail

main

public static void main(String[] args)

getNetManagementServer

public static IService getNetManagementServer()
create and return the NetManagementServer singleton

Returns:
a NetManagementServer singleton

requestRoute

public static String requestRoute(long src,
                                  long dst)
retrieve route information to a destination from a remote node

Parameters:
src - the node to be queried for information
dst - the address of the route destination of interest
Returns:
a string value that contains the routing information and number of hops

requestRouteTable

public static RouteTable requestRouteTable(long target)
Retrieve Route Table from a remote node

Parameters:
target - address of the target node
Returns:
A RouteTable object with a snapshot of the route info from the node

requestStats

public static LowPanStats requestStats(long target)
Retrieve LowPan statistics from a remote node

Parameters:
target - address of the target node
Returns:
A LowPanStats object with a snapshot of the statistics from the node

run

public void run()
main execution thread of this server

Specified by:
run in interface Runnable
See Also:
Thread.run()

setServiceName

public void setServiceName(String who)
Assign a name to this service. For some fixed services this may not apply and any new name will just be ignored.

Specified by:
setServiceName in interface IService
Parameters:
who - the name for this service

setEnabled

public void setEnabled(boolean enable)
Enable/disable whether service is started automatically. This may not apply to some services and calls to setEnabled() may be ignored.

Specified by:
setEnabled in interface IService
Parameters:
enable - true if the service should be started automatically on reboot

stop

public boolean stop()
Stop the service, and return whether successful. Stops all running threads. Closes any open IO connections.

Specified by:
stop in interface IService
Returns:
true if the service was successfully stopped

start

public boolean start()
Start the service, and return whether successful.

Specified by:
start in interface IService
Returns:
true if the service was successfully started

resume

public boolean resume()
Resume the service, and return whether successful. Picks up from state when service was paused. If there was no particular state associated with this service then resume() can be implemented by calling start().

Specified by:
resume in interface IService
Returns:
true if the service was successfully resumed

pause

public boolean pause()
Pause the service, and return whether successful. Preserve any current state, but do not handle new requests. Any running threads should block or sleep. Any open IO connections may be kept open. If there is no particular state associated with this service then pause() can be implemented by calling stop().

Specified by:
pause in interface IService
Returns:
true if the service was successfully paused

isRunning

public boolean isRunning()
Return whether the service is currently running.

Specified by:
isRunning in interface IService
Returns:
true if the service is currently running

getStatus

public int getStatus()
Return the current status of this service.

Specified by:
getStatus in interface IService
Returns:
the current status of this service, e.g. STOPPED, STARTING, RUNNING, PAUSED, STOPPING, etc.

getName

public String getName()
Return the name of this service.

Returns:
the name of this service

getServiceName

public String getServiceName()
return the name of the NetManagementServer

Specified by:
getServiceName in interface IService
Returns:
the name of this service

getEnabled

public boolean getEnabled()
Return whether service is started automatically on reboot. This may not apply to some services and for those services it will always return false.

Specified by:
getEnabled in interface IService
Returns:
true if the service is started automatically on reboot

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.