Package org.jcsp.net
Class ServiceManager
java.lang.Object
org.jcsp.net.ServiceManager
An instance of the ServiceManager
is created by the Node when
it is initialized. This reference can be obtained from the Node
class.
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 -
Method Summary
Modifier and TypeMethodDescriptiongetService
(String name) Returns theService
object of the service with the specified name.String[]
Returns an array containing an array of String objects which represent the names of the currently installed services.boolean
installService
(Service service, String name) Installs aService
object as a service in thisServiceManager
.boolean
installService
(ServiceSettings settings, Class serviceClass) Installs a service as specified by its class and a set of settings.boolean
startService
(String name) Starts the service with the specified name.boolean
uninstallService
(String name) This method allows a service that is not running to be uninstalled.
-
Constructor Details
-
ServiceManager
public ServiceManager()
-
-
Method Details
-
installService
Installs a service as specified by its class and a set of settings.- Parameters:
settings
- the settings for the service.serviceClass
- theClass
object of the class of the service to install.- Returns:
true
iff the service has successfully been installed.
-
installService
Installs aService
object as a service in thisServiceManager
. The name of the service must be supplied.- Parameters:
service
- theService
object to install.name
- the name of the service.- Returns:
true
iff the service has been successfully installed.
-
startService
Starts the service with the specified name.- Parameters:
name
- the name of the service to start.- Returns:
true
iff the service has been successfully started.
-
uninstallService
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:
true
iff the service has been uninstalled.
-
getService
Returns the
Service
object of the service with the specified name.- Parameters:
name
- the name of the service- Returns:
- the
Service
object of the service with the specified name.
-
getServiceNames
Returns an array containing an array of String objects which represent the names of the currently installed services.- Returns:
- an array of
String
service names.
-