org.objectweb.jonas.service
Class ServiceManager

java.lang.Object
  |
  +--org.objectweb.jonas.service.ServiceManager

public class ServiceManager
extends java.lang.Object

This class implements a manager of org.objectweb.jonas.service.Service for JOnAS. The services are defined in the jonas.properties files - 'jonas.services' property defines the list of the services, - for each service - 'jonas.service..class' property defines the class of the implementation of the service, - 'jonas.service..XXXX' properties define the configuration of the service

Author:
Helene Joanin Contributor(s): 01/06/15: Regis Le Brettevillois - Libelis 02/06 : Florent Benoit & Ludovic Bert : Ear service/Web Container service Philippe Durieux 03/01/14 Adriana Danes : pass the entire propertu name (jonas.service..XXXX) in the configuration context at service creation time

Method Summary
protected  javax.naming.Context createServiceContextFor(java.lang.String serviceName)
          Creates and returns the context for the configuration of the service which have the given name.
protected  Service createServiceFrom(java.lang.String serviceName)
          Creates and returns the service which have the given name.
static Service getDataBaseService()
          Return the DataBase service (service's name: 'dbm')
static Service getEarService()
          Return the Ear service (service's name: 'ear')
static Service getEjbService()
          Return the EJB service (service's name: 'ejb')
static ServiceManager getInstance()
          Get the unique instance.
static Service getJmsService()
          Return the JMS service (service's name: 'jms')
static Service getJmxService()
          Return the JMX service (service's name: 'jmx')
static Service getMailService()
          Return the mail service (service's name: 'mail').
static Service getRegistryService()
          Return the Registry service (service's name: 'registry')
static Service getSecurityService()
          Return the Security service (service's name: 'security')
static Service getService(java.lang.String name)
          Returns the service which have the given name
 java.lang.String[] getServiceNames()
          return the list of services + registry if needed
 Service[] getServices()
          Returns the list of the managed services
static Service getTomcatService()
          Return the Tomcat service (service's name: 'tomcat')
static Service getTransactionService()
          Return the Transaction service (service's name: 'jtm')
static Service getWebContainerService()
          Return the web service (service's name: 'web').
protected  void readServices()
          For each service, create it and its associated configuration context. (creates services, contextsByService and servicesByName)
 void startRegistry()
          Start the mandatory "registry" service
 void startServices()
          Starts the managed services.
 void stopServices()
          Management Method: Stop all services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceManager getInstance()
Get the unique instance. Create it at first call.

getService

public static Service getService(java.lang.String name)
                          throws ServiceException
Returns the service which have the given name

getEjbService

public static Service getEjbService()
                             throws ServiceException
Return the EJB service (service's name: 'ejb')

getEarService

public static Service getEarService()
                             throws ServiceException
Return the Ear service (service's name: 'ear')
Returns:
the EAR service.
Throws:
ServiceException - if can not get the ear service.

getWebContainerService

public static Service getWebContainerService()
                                      throws ServiceException
Return the web service (service's name: 'web').
Returns:
the web service.
Throws:
ServiceException - if can not get the web service.

getMailService

public static Service getMailService()
                              throws ServiceException
Return the mail service (service's name: 'mail').
Returns:
the mail service.
Throws:
ServiceException - if can not get the mail service.

getDataBaseService

public static Service getDataBaseService()
                                  throws ServiceException
Return the DataBase service (service's name: 'dbm')

getTransactionService

public static Service getTransactionService()
                                     throws ServiceException
Return the Transaction service (service's name: 'jtm')

getJmsService

public static Service getJmsService()
                             throws ServiceException
Return the JMS service (service's name: 'jms')

getSecurityService

public static Service getSecurityService()
                                  throws ServiceException
Return the Security service (service's name: 'security')

getJmxService

public static Service getJmxService()
                             throws ServiceException
Return the JMX service (service's name: 'jmx')

getRegistryService

public static Service getRegistryService()
                                  throws ServiceException
Return the Registry service (service's name: 'registry')

getTomcatService

public static Service getTomcatService()
                                throws ServiceException
Return the Tomcat service (service's name: 'tomcat')

startRegistry

public void startRegistry()
                   throws ServiceException
Start the mandatory "registry" service

startServices

public void startServices()
                   throws ServiceException
Starts the managed services.

getServices

public Service[] getServices()
                      throws ServiceException
Returns the list of the managed services

getServiceNames

public java.lang.String[] getServiceNames()
return the list of services + registry if needed

readServices

protected void readServices()
                     throws ServiceException
For each service, create it and its associated configuration context. (creates services, contextsByService and servicesByName)

createServiceFrom

protected Service createServiceFrom(java.lang.String serviceName)
                             throws ServiceException
Creates and returns the service which have the given name. (Uses the 'jonas.service..class' property for that)

createServiceContextFor

protected javax.naming.Context createServiceContextFor(java.lang.String serviceName)
                                                throws javax.naming.NamingException
Creates and returns the context for the configuration of the service which have the given name. (Uses the 'jonas.service..XXXX' properties for that)

stopServices

public void stopServices()
                  throws ServiceException
Management Method: Stop all services. The services are stopped in the reverse order of their starting. (Continue the processing of stopping for the others services, even if there is a problem for one service.)