public class ServiceManager extends Object
ContainerService
and implement the
init()
and destroy()
methods as appropriate.
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.LogService = 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 LogServiceImpl.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 empty.
ContainerService
Constructor and Description |
---|
ServiceManager() |
Modifier and Type | Method and Description |
---|---|
static void |
destroy(javax.servlet.ServletConfig aConfig)
Destroys all services.
|
static org.apache.pluto.portalImpl.services.Service |
getService(Class aClass)
Returns the service implementation for the given service class, or
null if no such service is registered. |
static void |
init(javax.servlet.ServletConfig aConfig)
Initializes all services specified in
services.properties . |
static void |
init(javax.servlet.ServletConfig config,
String serviceConfigFile)
Initializes all services specified in
services.properties . |
static void |
postInit(javax.servlet.ServletConfig aConfig)
Calls post init for all services
|
public static void init(javax.servlet.ServletConfig aConfig) throws Exception
services.properties
.
By specifying a different implementation of the service the behaviour
of the portal can be modified.aConfig
- the servlet configurationException
- if loading services.properties
or initializing any of its contained services failspublic static void init(javax.servlet.ServletConfig config, String serviceConfigFile) throws ContainerInitLutecePlutoException
services.properties
.
By specifying a different implementation of the service the behaviour
of the portal can be modified.config
- the servlet configurationserviceConfigFile
- The location of services.properties
(relative to classpath)Exception
- if loading services.properties
or initializing any of its contained services failsContainerInitLutecePlutoException
public static void postInit(javax.servlet.ServletConfig aConfig) throws ContainerInitLutecePlutoException
aConfig
- the servlet configurationContainerInitLutecePlutoException
public static void destroy(javax.servlet.ServletConfig aConfig)
aConfig
- the servlet configurationpublic static org.apache.pluto.portalImpl.services.Service getService(Class aClass)
null
if no such service is registered.aClass
- the service classCopyright © 2018 City of Paris. All rights reserved.