com.sentilla.host.client.application
Class ApplicationServiceImpl

java.lang.Object
  extended by com.sentilla.host.client.application.ApplicationServiceImpl
All Implemented Interfaces:
ApplicationService

public class ApplicationServiceImpl
extends Object
implements ApplicationService

ApplicationServiceImpl is the internal implementation of the client API for application management with host servers.

Author:
spence@sentilla.com

Field Summary
private  HostClientService client
           
 
Constructor Summary
ApplicationServiceImpl(HostClientService client)
           
 
Method Summary
 boolean deregister(int appId)
          Deregisters the application given by appId from the server.
 JarFile get(int appId)
          Returns the jar file corresponding to the given appId
 Application getApplication(int appId)
          Returns the Application object corresponding to the given appId
 boolean install(Application app)
          Installs the application given by the specified Application object to any mote networks accessible through the connected server.
 Collection<Integer> list()
          Returns the list of applications installed in the connected mote networks as a Collection of integer application IDs.
 Collection<Integer> listRegistered()
          Returns the list of applications registered with the connected server as a Collection of integer application IDs.
private  Object processMessage(HostMessage msg)
          Method which handles actual message communication with the hostserver.
 int register(Application jarFile)
          Registers an application jar file with the server.
 boolean run(int appId)
          Installs the application given by appId to any mote networks accessible through the connected server.
 boolean stop(int appId)
          Uninstall the application given by appId from any networks accessible from the connected hostserver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

private HostClientService client
Constructor Detail

ApplicationServiceImpl

public ApplicationServiceImpl(HostClientService client)
Method Detail

processMessage

private Object processMessage(HostMessage msg)
                       throws IOException
Method which handles actual message communication with the hostserver. The message object parameter is used for both sending the request, and receiving the server response.

Parameters:
msg - the message object to send to the server.
Returns:
returns the same message object, containing the server response.
Throws:
IOException - throws IOException on communication errors

register

public int register(Application jarFile)
             throws IOException
Registers an application jar file with the server.

Specified by:
register in interface ApplicationService
Returns:
appId returns the integer application ID of the newly registered application, or zero on failure.
Throws:
IOException

deregister

public boolean deregister(int appId)
                   throws IOException
Deregisters the application given by appId from the server. The application is completely removed from the server, and message objects received by the server that correspond to this application will not be deserialized.

Specified by:
deregister in interface ApplicationService
Parameters:
appId - the ID of the application to be dregistered.
Returns:
returns true on success, false otherwise.
Throws:
IOException

listRegistered

public Collection<Integer> listRegistered()
                                   throws IOException
Returns the list of applications registered with the connected server as a Collection of integer application IDs.

Specified by:
listRegistered in interface ApplicationService
Returns:
Collection the list of application IDs registered with the connected server
Throws:
IOException

run

public boolean run(int appId)
            throws IOException
Installs the application given by appId to any mote networks accessible through the connected server.

Specified by:
run in interface ApplicationService
Parameters:
appId - the ID of the application to install
Returns:
boolean returns true on successful installation, false otherwise
Throws:
IOException
ApplicationException

install

public boolean install(Application app)
                throws IOException
Installs the application given by the specified Application object to any mote networks accessible through the connected server.

Parameters:
app - the Application object to be installed
Returns:
boolean returns true on successful installation, false otherwise
Throws:
IOException

stop

public boolean stop(int appId)
             throws IOException
Uninstall the application given by appId from any networks accessible from the connected hostserver.

Specified by:
stop in interface ApplicationService
Parameters:
appId - the application ID of the app to be uninstalled.
Returns:
boolean returns true if the app is uninstalled, false otherwise
Throws:
IOException
ApplicationException

list

public Collection<Integer> list()
                         throws IOException
Returns the list of applications installed in the connected mote networks as a Collection of integer application IDs.

Specified by:
list in interface ApplicationService
Returns:
Collection the list of application IDs installed in the connected mote networks
Throws:
IOException

getApplication

public Application getApplication(int appId)
                           throws IOException
Returns the Application object corresponding to the given appId

Specified by:
getApplication in interface ApplicationService
Parameters:
appId - the application ID of the application to be fetched
Returns:
Application the application object corresponding to the given appId
Throws:
IOException

get

public JarFile get(int appId)
            throws IOException
Returns the jar file corresponding to the given appId

Specified by:
get in interface ApplicationService
Parameters:
appId - the application ID of the application jar to be fetched
Returns:
JarFile the application jar file corresponding to the given appId
Throws:
IOException


Copyright © 2007 Sentilla, Inc. All Rights Reserved.