Package org.jcsp.net
Class ServiceManager
- java.lang.Object
-
- org.jcsp.net.ServiceManager
-
public class ServiceManager extends Object
An instance of the
ServiceManageris created by the Node when it is initialized. This reference can be obtained from theNodeclass.The class allows the local Node's services to be installed and started. The class does not currently allow services to removed. Services can be stopped by obtaining their reference and stopping them directly.
- Author:
- Quickstone Technologies Limited
-
-
Constructor Summary
Constructors Constructor Description ServiceManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServicegetService(String name)Returns theServiceobject of the service with the specified name.String[]getServiceNames()Returns an array containing an array of String objects which represent the names of the currently installed services.booleaninstallService(Service service, String name)Installs aServiceobject as a service in thisServiceManager.booleaninstallService(ServiceSettings settings, Class serviceClass)Installs a service as specified by its class and a set of settings.booleanstartService(String name)Starts the service with the specified name.booleanuninstallService(String name)This method allows a service that is not running to be uninstalled.
-
-
-
Method Detail
-
installService
public boolean installService(ServiceSettings settings, Class serviceClass)
Installs a service as specified by its class and a set of settings.- Parameters:
settings- the settings for the service.serviceClass- theClassobject of the class of the service to install.- Returns:
trueiff the service has successfully been installed.
-
installService
public boolean installService(Service service, String name)
Installs aServiceobject as a service in thisServiceManager. The name of the service must be supplied.- Parameters:
service- theServiceobject to install.name- the name of the service.- Returns:
trueiff the service has been successfully installed.
-
startService
public boolean startService(String name)
Starts the service with the specified name.- Parameters:
name- the name of the service to start.- Returns:
trueiff the service has been successfully started.
-
uninstallService
public boolean uninstallService(String name)
This method allows a service that is not running to be uninstalled.
A running service can be uninstalled by obtaining the service reference, calling its
stop()method and then calling this method with the service's name.- Parameters:
name- the name of the service to uninstall.- Returns:
trueiff the service has been uninstalled.
-
getService
public Service getService(String name)
Returns the
Serviceobject of the service with the specified name.- Parameters:
name- the name of the service- Returns:
- the
Serviceobject of the service with the specified name.
-
getServiceNames
public String[] getServiceNames()
Returns an array containing an array of String objects which represent the names of the currently installed services.- Returns:
- an array of
Stringservice names.
-
-