toolbox.services
Class PropertiesFactory

Package class diagram package PropertiesFactory
java.lang.Object
  extended by toolbox.services.PropertiesFactory
All Implemented Interfaces:
ObjectFactory

public class PropertiesFactory
extends java.lang.Object
implements ObjectFactory

Simple ObjectFactory implementation to return a populated java.util.Properties instance.


Constructor Summary
PropertiesFactory()
          Default constructor.
 
Method Summary
 void destroy()
          Destroy this factory.
 java.lang.Object getInstance()
          Return the member properties instance.
 java.lang.Object getInstance(java.lang.ClassLoader loader)
          Return the member properties instance.
 java.lang.String getName()
          Return the name of this factory.
 void init(java.lang.String name, java.lang.String confHome, java.lang.String config)
          Initialise the factory with the given name identifier and location of the Java properties file that will be used to populate the Properties instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFactory

public PropertiesFactory()
Default constructor.

Method Detail

init

public void init(java.lang.String name,
                 java.lang.String confHome,
                 java.lang.String config)
          throws ServiceException
Initialise the factory with the given name identifier and location of the Java properties file that will be used to populate the Properties instance.

Specified by:
init in interface ObjectFactory
Parameters:
name - String containing a unique identifier for this factory.
confHome - String containing the path to the services configuration home directory for the service registry where this ObjectFactory lives.
config - String containing the location of the properties file. This implementation supports relative and absolute paths by prefixing the path with relative: or absolute:.
Throws:
ServiceException

getInstance

public java.lang.Object getInstance()
                             throws ServiceException
Return the member properties instance.

Specified by:
getInstance in interface ObjectFactory
Returns:
Properties instance.
Throws:
ServiceException - if the Properties cannot be created.

getInstance

public java.lang.Object getInstance(java.lang.ClassLoader loader)
                             throws ServiceException
Return the member properties instance.

Specified by:
getInstance in interface ObjectFactory
Parameters:
loader - ClassLoader instance.
Returns:
Properties instance.
Throws:
ServiceException - if the Properties cannot be created.

getName

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

Specified by:
getName in interface ObjectFactory
Returns:
String containing the name of this factory.

destroy

public void destroy()
Destroy this factory.

Specified by:
destroy in interface ObjectFactory