SK.gnome.dwarf
Interface Server

All Superinterfaces:
Service
All Known Implementing Classes:
GenericServer

public interface Server
extends Service

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

addService

public void addService(Service service)
                throws ServiceException
Adds a service to the server.

The service is added to the end of the service list.

Parameters:
service - the service being added to the server
Throws:
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 reason

getService

public Service getService(java.lang.String name)
Returns a service by its 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.

Parameters:
name - the nested service name
Returns:
the service or null if there is no service with the given name

getServices

public java.util.List getServices()
Returns all services contained by the server.

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.

Returns:
the unmodifiable list of services

removeService

public Service removeService(java.lang.String name)
Removes a service from the server.

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.

Parameters:
name - the nested service name
Returns:
the removed service or null if there is no service with the given name


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.