|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.services.BaseServiceBroker
A generic implementation of a ServiceBroker
which
provides:
Services
with a configuration based on
system wide configuration mechanism.
Field Summary | |
protected java.lang.String |
applicationRoot
Application root path as set by the parent application. |
static java.lang.String |
CLASSNAME_SUFFIX
A Service property determining its implementing
class name . |
protected org.apache.commons.configuration.Configuration |
configuration
Configuration for the services broker. |
protected org.apache.commons.configuration.Configuration |
mapping
Mapping of Service names to class names. |
static java.lang.String |
SERVICE_PREFIX
A prefix for Service properties in
TurbineResource.properties. |
protected java.util.Hashtable |
serviceObjects
These are objects that the parent application can provide so that application specific services have a mechanism to retrieve specialized information. |
protected java.util.Hashtable |
services
A repository of Service instances. |
Constructor Summary | |
protected |
BaseServiceBroker()
Default constructor, protected as to only be useable by subclasses. |
Method Summary | |
java.lang.String |
getApplicationRoot()
Get the application root as set by the parent application. |
org.apache.commons.configuration.Configuration |
getConfiguration()
Get the configuration for this service manager. |
org.apache.commons.configuration.Configuration |
getConfiguration(java.lang.String name)
Returns the configuration for the specified service. |
Service |
getService(java.lang.String name)
Returns an instance of requested Service. |
protected Service |
getServiceInstance(java.lang.String name)
Retrieves an instance of a Service without triggering late initialization. |
java.util.Iterator |
getServiceNames()
Returns an Iterator over all known service names. |
java.util.Iterator |
getServiceNames(java.lang.String prefix)
Returns an Iterator over all known service names beginning with the provided prefix. |
java.lang.Object |
getServiceObject(java.lang.String name)
Get an application specific service object. |
void |
init()
Initialize this service manager. |
protected void |
initMapping()
Creates a mapping between Service names and class names. |
void |
initService(java.lang.String name)
Performs early initialization of specified service. |
void |
initServices()
Performs early initialization of all services. |
void |
initServices(boolean report)
Performs early initialization of all services. |
boolean |
isRegistered(java.lang.String serviceName)
Determines whether a service is registered in the configured TurbineResources.properties . |
void |
setApplicationRoot(java.lang.String applicationRoot)
Set the application root. |
void |
setConfiguration(org.apache.commons.configuration.Configuration configuration)
Set the configuration object for the services broker. |
void |
setServiceObject(java.lang.String name,
java.lang.Object value)
Set an application specific service object that can be used by application specific services. |
void |
shutdownService(java.lang.String name)
Shuts down a Service , releasing resources
allocated by an Service , and returns it to its
initial (uninitialized) state. |
void |
shutdownServices()
Shuts down all Turbine services, releasing allocated resources and returning them to their initial (uninitialized) state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.commons.configuration.Configuration mapping
protected java.util.Hashtable services
protected org.apache.commons.configuration.Configuration configuration
public static final java.lang.String SERVICE_PREFIX
Service
properties in
TurbineResource.properties.
public static final java.lang.String CLASSNAME_SUFFIX
Service
property determining its implementing
class name .
protected java.util.Hashtable serviceObjects
protected java.lang.String applicationRoot
Constructor Detail |
protected BaseServiceBroker()
Method Detail |
public void setConfiguration(org.apache.commons.configuration.Configuration configuration)
configuration
- Broker configuration.public org.apache.commons.configuration.Configuration getConfiguration()
public void init() throws InitializationException
InitializationException
public void setServiceObject(java.lang.String name, java.lang.Object value)
name
- name of service objectvalue
- value of service objectpublic java.lang.Object getServiceObject(java.lang.String name)
protected void initMapping()
services.MyService.classname=com.mycompany.MyServiceImpl services.MyOtherService.classname=com.mycompany.MyOtherServiceImpl
public boolean isRegistered(java.lang.String serviceName)
TurbineResources.properties
.
isRegistered
in interface ServiceBroker
serviceName
- The name of the service whose existance to check.
public java.util.Iterator getServiceNames()
public java.util.Iterator getServiceNames(java.lang.String prefix)
prefix
- The prefix against which to test.
public void initService(java.lang.String name) throws InitializationException
initService
in interface ServiceBroker
name
- The name of the service (generally the
SERVICE_NAME
constant of the service's interface
definition).
InitializationException
- Initialization of this
service was not successful.public void initServices()
public void initServices(boolean report) throws InstantiationException, InitializationException
report
- true
if you want exceptions thrown.
InstantiationException
InitializationException
public void shutdownService(java.lang.String name)
Service
, releasing resources
allocated by an Service
, and returns it to its
initial (uninitialized) state.
shutdownService
in interface ServiceBroker
name
- The name of the Service
to be
uninitialized.public void shutdownServices()
shutdownServices
in interface ServiceBroker
public Service getService(java.lang.String name) throws InstantiationException
getService
in interface ServiceBroker
name
- The name of the Service requested.
InstantiationException
- if the service is unknown or
can't be initialized.protected Service getServiceInstance(java.lang.String name) throws InstantiationException
name
- The name of the service requested.
InstantiationException
- The service is unknown or
can't be initialized.public org.apache.commons.configuration.Configuration getConfiguration(java.lang.String name)
getConfiguration
in interface ServiceBroker
name
- The name of the service.
public void setApplicationRoot(java.lang.String applicationRoot)
applicationRoot
- application rootpublic java.lang.String getApplicationRoot()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |