Dashboard > Penrose > ... > Penrose 0.9.8 Embedding Penrose > Penrose 0.9.8 Service Manager
Penrose 0.9.8 Service Manager
Added by Endi S. Dewata, last edited by Endi S. Dewata on Dec 07, 2005  (view change)
Labels: 
(None)


Introduction

PenroseServer uses a ServiceManager to control the life cycle of the services.

To get the ServiceManager:

PenroseServer penroseServer = ...
ServiceManager serviceManager = penroseServer.getServiceManager();

Initializing Services

Before a service can be used, it has to be initialized first. During initialization generally each service would initialize itself using parameters defined in the ServiceConfig (e.g. port numbers).

When you instantiate a PenroseServer object, it will initialize all services registered in PenroseConfig automatically. However, if you need to do it manually, you can call:

serviceManager.init();

To initialize a specific service:

ServiceConfig serviceConfig = ...
serviceManager.init(serviceConfig);

Starting Services

When you start PenroseServer, it will also start all services managed by the ServiceManager. If you need to do it manually, you can call:

serviceManager.start();

To start a specific service:

String serviceName = "LDAP Service";
serviceManager.start(serviceName);

When you start PenroseServer, it will also start all services.

Stopping Services

When you stop PenroseServer, it will also stop all services managed by the ServiceManager. If you need to do it manually, you can call:

serviceManager.stop();

To stop a specific service:

String serviceName = "LDAP Service";
serviceManager.stop(serviceName);

When you stop PenroseServer, it will also stop all services.

Modifying Service Parameters

If you want to change a service parameter permanently, you should perform the modification against the ServiceConfig object and export it back to server.xml using the PartitionWriter. The changes will be read the next time you create a new PenroseServer object.

If you want to change a service parameter immediately or just temporary, you can get the Service object and modify its attribute directly. The changes will not be stored in server.xml.

If you want to change a service parameter both permanently and immediately, you should perform the modification both on the ServiceConfig and Service object.

To get a service object:

String serviceName = "LDAP Service";
Service service = serviceManager.getService(serviceName);

You should modify the service attribute only when it's not running. For instance, to change LDAP port:

PenroseLDAPService ldapService = (PenroseLDAPService)service;

ldapService.stop();
ldapService.setLdapPort(389);
ldapService.start();

Site running on a free Atlassian Confluence Open Source Project License granted to Safehaus. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators