|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pluto.portalImpl.services.ServiceManager
public class ServiceManager
Manages the life-time of services registered during servlet startup.
There are two types of services: Services required by the container,
and Services used for the portal driver configuration and execution.
All services required by the container have to derive from
ContainerService
and implement the
init()
and destroy()
methods as appropriate.
All services must derive from the
Service
interface if they
are to be used with the portal driver.
By registering the service and its implementation in the file
/config/services.properties
, the service will become
available to the portal engine. The format of the file is simple:
org.apache.pluto.portalImpl.services.log.Logger = org.apache.pluto.portalImpl.services.log.LogServicesImplEach entry represents one service. The left-hand side is the abstract service class, the right-hand side is the implementation of this service. The services are initialized in the order of appearance.
Each service can have its own configuration file, located in
/config/services
. It has to have the name of either
implementation or abstract class of the service, without the
leading package name. For example, the service manager looks
for LoggerImpl
.properties
. This allows a special
implementation to provide different configuration than the
general (abstract) service requires.
If present, one of the services configuration files is loaded
and passed to the service as Properties
object. Not providing a service configuration file is okay too,
in that case the properties are emptyemptySessionPath .
ContainerService
Constructor Summary | |
---|---|
ServiceManager()
|
Method Summary | |
---|---|
static void |
destroy(javax.servlet.ServletConfig aConfig)
Destroys all services. |
static Service |
getService(java.lang.Class aClass)
Returns the service implementation for the given service class, or null if no such service is registered. |
static void |
hotInit(javax.servlet.ServletConfig aConfig,
java.lang.String theService)
|
static void |
hotInit(javax.servlet.ServletConfig aConfig,
java.lang.String aServiceConfigFile,
java.lang.String aServiceConfigDir,
java.lang.String theService)
|
static void |
init(javax.servlet.ServletConfig aConfig)
Initializes all services specified in services.properties . |
static void |
init(javax.servlet.ServletConfig aConfig,
java.lang.String aServiceConfigFile,
java.lang.String aServiceConfigDir)
Initializes all services specified in services.properties . |
static void |
postHotInit(javax.servlet.ServletConfig aConfig,
java.lang.String theService)
|
static void |
postInit(javax.servlet.ServletConfig aConfig)
Calls post init for all services |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceManager()
Method Detail |
---|
public static void init(javax.servlet.ServletConfig aConfig) throws java.lang.Exception
services.properties
.
By specifying a different implementation of the service the behaviour
of the portal can be modified.
aConfig
- the servlet configuration
java.lang.Exception
- if loading services.properties
or initializing any of its contained services failspublic static void init(javax.servlet.ServletConfig aConfig, java.lang.String aServiceConfigFile, java.lang.String aServiceConfigDir) throws java.lang.Exception
services.properties
.
By specifying a different implementation of the service the behaviour
of the portal can be modified.
aConfig
- the servlet configurationaServiceConfigFile
- The location of services.properties
(relative to classpath)aServiceConfigDir
- The direcory with the services' properties files (relative to classpath)
java.lang.Exception
- if loading services.properties
or initializing any of its contained services failspublic static void postInit(javax.servlet.ServletConfig aConfig)
aConfig
- the servlet configurationpublic static void destroy(javax.servlet.ServletConfig aConfig)
aConfig
- the servlet configurationpublic static Service getService(java.lang.Class aClass)
null
if no such service is registered.
aClass
- the service class
public static void hotInit(javax.servlet.ServletConfig aConfig, java.lang.String theService) throws java.lang.Exception
java.lang.Exception
public static void hotInit(javax.servlet.ServletConfig aConfig, java.lang.String aServiceConfigFile, java.lang.String aServiceConfigDir, java.lang.String theService) throws java.lang.Exception
java.lang.Exception
public static void postHotInit(javax.servlet.ServletConfig aConfig, java.lang.String theService)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |