| java.lang.Object org.apache.turbine.services.BaseInitableBroker
BaseInitableBroker | abstract public class BaseInitableBroker implements InitableBroker(Code) | | A generic implementation of InitableBroker .
Functionality provided by the broker includes:
- Maintaining single instance of each
Initable in
the system.
- Early initialization of
Initables during system
startup.
- Late initialization of
Initables before they are
used.
- Providing instances of
Initables to requesting
parties.
- Maintaining dependencies between
Initables during
early initalization phases, including circular dependencies
detection.
author: Kevin Burton author: Rafal Krzewski author: Henning P. Schmiedehausen version: $Id: BaseInitableBroker.java 534527 2007-05-02 16:10:59Z tv $ |
Field Summary | |
protected Hashtable | initables A repository of Initable instances. | protected Stack | stack Names of classes being early-initialized are pushed onto this
stack. |
Constructor Summary | |
protected | BaseInitableBroker() Default constructor of InitableBroker.
This constructor does nothing. |
Method Summary | |
public Initable | getInitable(String className) Provides an instance of Initable class ready to work.
If the requested class couldn't be instatiated or initialized,
an InstantiationException will be thrown. | protected Initable | getInitableInstance(String className) Retrieves an instance of an Initable from the repository. | public void | initClass(String className, Object data) Performs early initialization of an Initable class. | public void | shutdownClass(String className) Shuts down an Initable . |
initables | protected Hashtable initables(Code) | | A repository of Initable instances.
|
stack | protected Stack stack(Code) | | Names of classes being early-initialized are pushed onto this
stack. A name appearing twice indicates a circular dependency
chain.
|
BaseInitableBroker | protected BaseInitableBroker()(Code) | | Default constructor of InitableBroker.
This constructor does nothing. Your brokers should be
singletons, therefore their constructors should be
private. They should also have public YourBroker getInstance()
methods.
|
getInitable | public Initable getInitable(String className) throws InstantiationException(Code) | | Provides an instance of Initable class ready to work.
If the requested class couldn't be instatiated or initialized,
an InstantiationException will be thrown. You needn't handle
this exception in your code, since it indicates fatal
misconfigurtion of the system.
Parameters: className - The name of the Initable requested. An instance of the requested Initable. exception: InstantiationException - if there was a problemduring instantiation or initialization of the Initable. |
getInitableInstance | protected Initable getInitableInstance(String className) throws InstantiationException(Code) | | Retrieves an instance of an Initable from the repository.
If the requested class is not present in the repository, it is
instantiated and passed a reference to the broker, saved and
then returned.
Parameters: className - The name of the class to be instantiated. exception: InstantiationException - if the requested class can'tbe instantiated. |
initClass | public void initClass(String className, Object data) throws InitializationException(Code) | | Performs early initialization of an Initable class.
Parameters: className - The name of the class to be initialized. Parameters: data - An Object to be used for initialization activities. exception: InitializationException - Initialization was not successful. |
shutdownClass | public void shutdownClass(String className)(Code) | | Shuts down an Initable .
This method is used to release resources allocated by an
Initable , and return it to its initial (uninitailized)
state.
Parameters: className - The name of the class to be uninitialized. |
|
|