toolbox.services
Interface ObjectFactory

Package class diagram package ObjectFactory
All Known Implementing Classes:
PropertiesFactory

public interface ObjectFactory

Interface that defines a generic mechanism for developing custom Object Factories.


Method Summary
 void destroy()
          Destroy this factory.
 java.lang.Object getInstance()
          Create a new instance of the target Object for this factory.
 java.lang.Object getInstance(java.lang.ClassLoader loader)
          Create a new instance of the target Object for this factory using the given ClassLoader.
 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 configuration location.
 

Method Detail

init

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 configuration location.

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 configuration location for this this factory.
Throws:
ServiceException

getInstance

java.lang.Object getInstance()
                             throws ServiceException
Create a new instance of the target Object for this factory.

Returns:
Object containing an instance of the target Object for this factory.
Throws:
ServiceException - if the Object cannot be created.

getInstance

java.lang.Object getInstance(java.lang.ClassLoader loader)
                             throws ServiceException
Create a new instance of the target Object for this factory using the given ClassLoader.

Parameters:
loader - ClassLoader to use when creating the Object instance.
Returns:
Object containing an instance of the target Object for this factory.
Throws:
ServiceException - if the Object cannot be created.

getName

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

Returns:
String containing the name of this factory.

destroy

void destroy()
Destroy this factory.