|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides core functionality of a service container.
In the context of this package, server means a service which can contain another
services. Thus, it has all functionality of the parent Service
interface as well
as an additional features for managing the list of contained services.
A Server
implementation must implement its state transition methods
(i.e. the init
, start
, stop
and shutdown
methods) to handle the transition
states of the nested services as well.
This interface allows to compose a complex trees of servers and services and to globally control their transition states.
Field Summary |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Method Summary | |
void |
addService(Service service)
Adds a service to the server. |
Service |
getService(java.lang.String name)
Returns a service by its name. |
java.util.List |
getServices()
Returns all services contained by the server. |
Service |
removeService(java.lang.String name)
Removes a service from the server. |
Methods inherited from interface SK.gnome.dwarf.Service |
getFullName, getName, getParameters, getState, init, log, log, login, logout, shutdown, start, stop |
Method Detail |
public void addService(Service service) throws ServiceException
The service is added to the end of the service list.
service
- the service being added to the server
java.lang.NullPointerException
- if the service argument is null
java.lang.IllegalArgumentException
- if a service with the same name exists
ServiceException
- if the process fails for any other reasonpublic Service getService(java.lang.String name)
It returns null if the name argument is null or there is no service contained by the server with the given name.
The method must accept also a full service name with each name component separated by the slash character. In this case, it should traverse the service object subtree and find the nested service at any level.
name
- the nested service name
public java.util.List getServices()
An empty list is returned if there are no services contained by the server, otherwise an unmodifiable list of contained services is returned.
The method is not traversing. If a service contained by the server is also a server, i.e. it contains another services, these nested services are not included in the resulting list.
public Service removeService(java.lang.String name)
It returns null if the name argument is null or there is no service in the server with the given name, otherwise it returns a reference to the removed service.
The method is not traversing. If a service contained by the server is also a server, i.e. it contains another services, these nested services are not searched for the given service to remove.
name
- the nested service name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |