com.sentilla.host.client.admin
Interface ServerAdminService

All Known Implementing Classes:
ServerAdminClientImpl

public interface ServerAdminService

HostAdmin service allows to administer host server related properties and behavior as well as the behavior of its associated gateway.

A host may have one gateway associated with it. This gateway may be running on a local serial communication port or a remote TCP IP port (the default 9002). The communication port syntax is that of SF (serial forwarder), for example:

Note on server operation:

If the service is 'started' for the first time, it will start in a 'disconnected' state (no gateway is connected). Only after a first connect is issued, a subsequent stop/start will resust in a connected started server. ServiceException is used in all service invocations to handle error conditions.


Method Summary
 void connectGateway(String communicationPort)
          Connects to the gateway previously set via setGateway call.
 void disconnectGateway()
          Disconnects from gateway.
 byte[] getClassBytes(String name)
          Get a class definition from the server.
 GatewayNode getConnectedGateway()
          Returns the gateway communication port currently used by the host server.
 int getDebug()
          Queries the host server about the current debug level.
 String getDefaultBasestationComPort()
          Returns the default COM port of the gateway associated with this host.
 Collection<NetworkNode> getNetwork()
          Returns of NetworkNode objects reflecting the current motes present in the network connected via the current basestation.
 Object getProperty(String name)
          Get a property from the host server.
 Application getSystemBinary()
          Get the yaml data for the system binary.
 boolean isGatewayConnected()
          Returns the connected state of gateway
 Collection<GatewayNode> listComBaseStations()
          Lists the serial COM ports with BaseStations connected.
 Collection<String> listComPorts()
          Lists the serial COM ports available to be used/set.
 void restartServer()
          Re-starts the server.
 void setDebug(int level)
          Directs the host server to use the given level of debugging.
 boolean setProperty(String name, Object value)
          Set a property with the host server.
 void startServer()
          Starts the server.
 void stopServer()
          Stop the server, except for the listener service so that the client can follow up by "startServer" invocation.
 

Method Detail

setDebug

void setDebug(int level)
              throws ServiceException
Directs the host server to use the given level of debugging. Levels roughly correspond to log4j logging levels.

Parameters:
level - to set debug to
Throws:
ServiceException - if a transport or service related error occured

getDebug

int getDebug()
             throws ServiceException
Queries the host server about the current debug level.

Returns:
true if debug is on, false otherwise.
Throws:
ServiceException

listComPorts

Collection<String> listComPorts()
                                throws ServiceException
Lists the serial COM ports available to be used/set. Note: This call doesn't list TCP/IP-based communication ports.

Returns:
COM ports found on the gateway associated with hist host server.
Throws:
ServiceException - if a transport or service related error occured

listComBaseStations

Collection<GatewayNode> listComBaseStations()
                                            throws ServiceException
Lists the serial COM ports with BaseStations connected. Note: This call doesn't list TCP/IP-based communication ports.

Returns:
COM ports found on the gateway associated with hist host server.
Throws:
ServiceException - if a transport or service related error occured

getDefaultBasestationComPort

String getDefaultBasestationComPort()
                                    throws ServiceException,
                                           IOException
Returns the default COM port of the gateway associated with this host. This is typically the COM port the gateway thinks the basestation is associated with. It is useful in situations where several tmote devices are connected to a computer's COM ports.

Returns:
the default basestation COM port.
Throws:
ServiceException
IOException

getConnectedGateway

GatewayNode getConnectedGateway()
                                throws ServiceException
Returns the gateway communication port currently used by the host server. This can be either a serial port such as serial@COM8:tmote or a remote TCP/IP port such as sf@tmote-connect:9002 or sf@localhost:9002

Returns:
current gateway communication port host server is connected to
Throws:
ServiceException - if a transport or service related error occured or if gateway is not connected

disconnectGateway

void disconnectGateway()
                       throws ServiceException
Disconnects from gateway. If gateway is already disconnected, no action is take and no exception is thrown.

Throws:
ServiceException - if a transport or service related error occured

connectGateway

void connectGateway(String communicationPort)
                    throws ServiceException
Connects to the gateway previously set via setGateway call.

Parameters:
communicationPort - communication port using SF (serial forwarder) syntax such as:
  • serial@COM8:tmote
  • sf@localhost:9002
  • sf@tmote-connect:9002
Throws:
ServiceException - if a transport or service related error occured or if gateway is already connected.

isGatewayConnected

boolean isGatewayConnected()
                           throws ServiceException
Returns the connected state of gateway

Returns:
true if connected, false otherwise.
Throws:
ServiceException - if a transport or service related error occured

startServer

void startServer()
                 throws ServiceException
Starts the server. All threads on the server will start their operation. The server will attempt to connect the gateway if it was previously defined via a 'connectGateway(communicationPort)' call. Otherwise it will started in disconnected state. If the server can't connect, it will still continue other operation in disconnecte state.

Throws:
ServiceException - if a transport or service related error occured

stopServer

void stopServer()
                throws ServiceException
Stop the server, except for the listener service so that the client can follow up by "startServer" invocation.

Throws:
ServiceException - if a transport or service related error occured or if service is already stopped.

restartServer

void restartServer()
                   throws ServiceException
Re-starts the server. Semantics of restart are identical to the sequence of start/stop server.

Throws:
ServiceException

getNetwork

Collection<NetworkNode> getNetwork()
                                   throws IOException
Returns of NetworkNode objects reflecting the current motes present in the network connected via the current basestation.

Returns:
Collection the set of nodes currently present in the network
Throws:
IOException

setProperty

boolean setProperty(String name,
                    Object value)
Set a property with the host server.

Parameters:
name - a String property key
value - an Object to associate with the given key
Returns:
boolean returns true if the property is successfully set, false otherwise

getProperty

Object getProperty(String name)
Get a property from the host server.

Parameters:
name - the key of the property value to return.
Returns:
Object the Object associated with the given key

getSystemBinary

Application getSystemBinary()
Get the yaml data for the system binary.

Returns:
Application metadata data for the system binary.

getClassBytes

byte[] getClassBytes(String name)
Get a class definition from the server.

Returns:
byte[] the bytes of a class definition.


Copyright © 2007 Sentilla, Inc. All Rights Reserved.