public class ServiceManager
extends java.lang.Object
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 and Description |
---|
ServiceManager() |
Modifier and Type | Method and Description |
---|---|
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
|
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 configurationjava.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 classpublic 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)
Copyright © 2003-2013 . All Rights Reserved.