i3.dragos.core
Class ServiceManager

java.lang.Object
  extended by i3.dragos.core.ServiceManager
All Implemented Interfaces:
KernelModule

public class ServiceManager
extends java.lang.Object
implements KernelModule

The ServiceManager manages all services used by the DRAGOS database.

Author:
Boris Boehlen <boehlen@cs.rwth-aachen.de>

Constructor Summary
ServiceManager()
          Constructs the service manager.
 
Method Summary
 boolean addService(Service service)
          Adds the services to the manager and initializes it.
 boolean addService(java.lang.String serviceClass)
          Adds the services to the manager and initializes it.
static ServiceManager getInstance()
          Returns the service manager registered to the module manager.
 java.lang.String getRole()
          Returns the kernel module's role.
 Service getService(java.lang.String name)
          Returns the service with the given name.
 void initialize()
          Initializes the kernel module.
 java.lang.String[] listServices()
          Reutrns a list of the names of all services managed by this service manager.
 boolean removeService(Service service)
          Removes the services from the manager.
 boolean startServices()
          Starts all services managed by this service manager in the order they were added to it.
 void stopServices()
          Stops all services managed by this service manager in the reverse order of their addition.
 void uninitialize()
          Uninitializes the kernel module and releases all resources used by it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceManager

public ServiceManager()
Constructs the service manager.

Method Detail

getInstance

public static ServiceManager getInstance()
Returns the service manager registered to the module manager.

Returns:
the service manager registered to the module manager.

getRole

public java.lang.String getRole()
Returns the kernel module's role.

Specified by:
getRole in interface KernelModule
Returns:
the kernel module's role.

initialize

public void initialize()
Initializes the kernel module.

Specified by:
initialize in interface KernelModule

uninitialize

public void uninitialize()
Uninitializes the kernel module and releases all resources used by it.

Specified by:
uninitialize in interface KernelModule

addService

public boolean addService(java.lang.String serviceClass)
Adds the services to the manager and initializes it. The services is not started!

Parameters:
serviceClass - The class that implements the service.
Returns:
true if the service could be added and false otherwise.

addService

public boolean addService(Service service)
Adds the services to the manager and initializes it. The services is not started!

Parameters:
service - The service that should be removed.
Returns:
true if the service could be added and false otherwise.

removeService

public boolean removeService(Service service)
Removes the services from the manager. If the service is still active it is stopped and uninitialized.

Parameters:
service - The service that should be removed.
Returns:
true if the service has been removed successfully and false otherwise.

startServices

public boolean startServices()
Starts all services managed by this service manager in the order they were added to it.

Returns:
true if all registered services were started successfully and false otherwise.

stopServices

public void stopServices()
Stops all services managed by this service manager in the reverse order of their addition.


listServices

public java.lang.String[] listServices()
Reutrns a list of the names of all services managed by this service manager.

Returns:
the names of all known services.

getService

public Service getService(java.lang.String name)
Returns the service with the given name. If the service is not known to this service manager null is returned.

Parameters:
name - The name of the service.
Returns:
the service or null.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.