|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.services.BaseInitableBroker | +--org.apache.turbine.services.BaseServiceBroker | +--org.apache.turbine.services.TurbineServices
This is a singleton utility class that acts as a Services broker.
Field Summary | |
static java.lang.String |
CLASSNAME_SUFFIX
A Service property determining its implementing
class name . |
static java.lang.String |
COMPONENT_CLASS_DEFAULT
Default component service implementation |
static java.lang.String |
COMPONENT_CLASS_KEY
Servlet initialization parameter name for defining the component loader service implementation to load Stratum based components. |
protected static ServiceBroker |
instance
The single instance of this class. |
static java.lang.String |
LOGGING_CLASS_DEFAULT
Default bootstrap logger implementation |
static java.lang.String |
LOGGING_CLASS_KEY
Servlet initialization parameter name for defining the logging service implementation to use. |
static java.lang.String |
PROPERTIES_PATH_DEFAULT
Default value of TurbineResources.properties file path ( /WEB-INF/conf/TurbineResources.properties ). |
static java.lang.String |
PROPERTIES_PATH_KEY
Servlet initialization parameter name for the path to TurbineResources.properties file used by TurbineResourceService
(properties ). |
static java.lang.String |
RESOURCES_CLASS_DEFAULT
Default resources service implementation to use when none explicitly specified (
org.apache.turbine.services.resources.TurbineResourceService ) |
static java.lang.String |
RESOURCES_CLASS_KEY
Servlet initialization parameter name for defining the resources service implementation to use ( resources ). |
static java.lang.String |
SERVICE_PREFIX
A prefix for Service properties in
TurbineResource.properties. |
Fields inherited from class org.apache.turbine.services.BaseServiceBroker |
mapping, services |
Fields inherited from class org.apache.turbine.services.BaseInitableBroker |
initables, stack |
Constructor Summary | |
protected |
TurbineServices()
This constructor is protected to force clients to use getInstance() to access this class. |
Method Summary | |
void |
error(java.lang.Throwable t)
Output an error message. |
org.apache.commons.configuration.Configuration |
getConfiguration(java.lang.String name)
Returns the Configuration for the specified service. |
static ServiceBroker |
getInstance()
The method through which this class is accessed. |
java.util.Properties |
getProperties(java.lang.String name)
Returns the properites of a specific service. |
ResourceService |
getResources(java.lang.String name)
Returns the configuration resources of a specific service. |
protected void |
initMapping()
Creates a mapping between Service names and class names. |
void |
initMapping(org.apache.commons.configuration.Configuration mapping)
Creates mapping of Service names to class names. |
void |
initPrimaryServices(javax.servlet.ServletConfig config)
Initialize the primary services (Logging and Resources). |
void |
notice(java.lang.String msg)
Output a diagnostic notice. |
Methods inherited from class org.apache.turbine.services.BaseServiceBroker |
getService, getServiceInstance, initService, initServices, initServices, isRegistered, shutdownService, shutdownServices |
Methods inherited from class org.apache.turbine.services.BaseInitableBroker |
getInitable, getInitableInstance, initClass, shutdownClass |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.InitableBroker |
getInitable, initClass, shutdownClass |
Field Detail |
public static final java.lang.String RESOURCES_CLASS_KEY
resources
).public static final java.lang.String RESOURCES_CLASS_DEFAULT
org.apache.turbine.services.resources.TurbineResourceService
)public static final java.lang.String LOGGING_CLASS_KEY
public static final java.lang.String LOGGING_CLASS_DEFAULT
public static final java.lang.String COMPONENT_CLASS_KEY
public static final java.lang.String COMPONENT_CLASS_DEFAULT
public static final java.lang.String PROPERTIES_PATH_KEY
TurbineResourceService
(properties
).public static final java.lang.String PROPERTIES_PATH_DEFAULT
/WEB-INF/conf/TurbineResources.properties
).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 static ServiceBroker instance
Constructor Detail |
protected TurbineServices()
Method Detail |
public static ServiceBroker getInstance()
public void initPrimaryServices(javax.servlet.ServletConfig config) throws InstantiationException, InitializationException
public void initMapping(org.apache.commons.configuration.Configuration mapping)
protected void initMapping()
services.MyService.classname=com.mycompany.MyServiceImpl services.MyOtherService.classname=com.mycompany.MyOtherServiceImpl
public java.util.Properties getProperties(java.lang.String name)
Note that this way you will receive a 'collapsed' version
of your resources - multiple entries with the same key will
have only one value stored. Use the getConfiguration(java.lang.String)
or getResources(java.lang.String)
method to take advantage of the capabilities
of the TurbineResources
class.
getProperties
in class BaseServiceBroker
name
- The name of the service.public org.apache.commons.configuration.Configuration getConfiguration(java.lang.String name)
getConfiguration
in class BaseServiceBroker
name
- The name of the service.public ResourceService getResources(java.lang.String name)
ResourceService
offers significant advantages over plain java.util.Properties -
you can request for exaple you can retrieve int
s
boolean
s, and vectors of String
s.
Note that the proces extracting the configuration might be time consuming, it might be a good idea to store the reference returned by this method in an instance variable of the service.
name
- The name of the Service.public void notice(java.lang.String msg)
Standard Turbine logging facilities are used.
notice
in class BaseInitableBroker
msg
- the message to print.public void error(java.lang.Throwable t)
Standard Turbine logging facilities are used.
error
in class BaseInitableBroker
msg
- the message to print.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |