toolbox.services
Class BaseService

Package class diagram package BaseService
java.lang.Object
  extended by toolbox.services.BaseService
All Implemented Interfaces:
Service
Direct Known Subclasses:
CurrencyCodeServiceISO4217Impl, DaoService, FreeMarkerTemplateServiceImpl, FTPService, JmsService, LDAPService, LoggingFormatterTemplateImpl, LoggingServiceAsyncImpl, LoggingServiceXMLHttpClientImpl, MailService, SocketClientService, UDDIService, WSClientService

public class BaseService
extends java.lang.Object
implements Service

Convenience base service implementation.

This implementation provides convienence methods for accessing service configuration settings as standard java properties.


Constructor Summary
protected BaseService()
          Protected constructor.
 
Method Summary
 void create(java.lang.String name, java.lang.String confHome, ServiceEnvironment env, XMLProperties xmlProps)
          Default implementation that will set member configuration properties.
 void destroy()
          Destroy this service by nulling the configuration properties.
protected  java.lang.String getConfigHome()
          Return the path to the configuration directory.
 java.lang.String getName()
          Return the name of this service.
protected  java.util.Properties getProperties()
          Return all the service configuration properties.
protected  java.lang.String getProperty(java.lang.String name)
          Return the value of the named service configuration property.
protected  XMLProperties getXMLProperties()
          Return the configuration properties of this service as XML properties.
protected  void logConfig(java.lang.String msg)
          Log a config message.
protected  void logFine(java.lang.String msg)
          Log a fine message.
protected  void logFiner(java.lang.String msg)
          Log a finer message.
protected  void logFinest(java.lang.String msg)
          Log a finest message.
protected  void logInfo(java.lang.String msg)
          Log an info message.
protected  void logSevere(java.lang.String msg, java.lang.Throwable ex)
          Log a severe message.
protected  void logWarning(java.lang.String msg, java.lang.Throwable ex)
          Log a warning message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseService

protected BaseService()
Protected constructor.

Method Detail

create

public void create(java.lang.String name,
                   java.lang.String confHome,
                   ServiceEnvironment env,
                   XMLProperties xmlProps)
            throws ServiceException
Default implementation that will set member configuration properties.

Specified by:
create in interface Service
Parameters:
name - The name of the service.
confHome - The path to the configuration home directory.
env - ServiceEnvironment of this service.
xmlProps - XML configuration properties.
Throws:
ServiceException - if the service cannot be created.

getProperty

protected java.lang.String getProperty(java.lang.String name)
Return the value of the named service configuration property.

Parameters:
name - String containing the name of the property to return.
Returns:
String containing the value of the property.

getProperties

protected java.util.Properties getProperties()
Return all the service configuration properties.

Returns:
Properties instance containing all service configuration properties.

getXMLProperties

protected XMLProperties getXMLProperties()
Return the configuration properties of this service as XML properties.

Returns:
XMLProperties instance containing service configuration.

getConfigHome

protected java.lang.String getConfigHome()
Return the path to the configuration directory.

Returns:
String containing the path to the configuration directory.

getName

public java.lang.String getName()
Return the name of this service.

Returns:
String containing the name of this service.

logFinest

protected void logFinest(java.lang.String msg)
Log a finest message.

Parameters:
msg - String containing message to log.

logFiner

protected void logFiner(java.lang.String msg)
Log a finer message.

Parameters:
msg - String containing message to log.

logFine

protected void logFine(java.lang.String msg)
Log a fine message.

Parameters:
msg - String containing message to log.

logConfig

protected void logConfig(java.lang.String msg)
Log a config message.

Parameters:
msg - String containing message to log.

logInfo

protected void logInfo(java.lang.String msg)
Log an info message.

Parameters:
msg - String containing message to log.

logWarning

protected void logWarning(java.lang.String msg,
                          java.lang.Throwable ex)
Log a warning message.

Parameters:
msg - String containing message to log.
ex - Optional throwable to include in the log.

logSevere

protected void logSevere(java.lang.String msg,
                         java.lang.Throwable ex)
Log a severe message.

Parameters:
msg - String containing message to log.
ex - Optional throwable to include in the log.

destroy

public void destroy()
Destroy this service by nulling the configuration properties.

Specified by:
destroy in interface Service