org.apache.turbine.services
Class BaseInitable

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
All Implemented Interfaces:
Initable
Direct Known Subclasses:
BaseService

public class BaseInitable
extends java.lang.Object
implements Initable

This class provides a generic implementation of Initable. This implementation, that other Initables are welcome to extend, contains facilities to maintain internal state.

Version:
$Id: BaseInitable.java 534527 2007-05-02 16:10:59Z tv $
Author:
Kevin Burton, Rafal Krzewski

Field Summary
protected  InitableBroker initableBroker
          InitableBroker that instantiatd this class.
protected  boolean isInitialized
          Initialization status of this class.
 
Constructor Summary
BaseInitable()
          Default constructor of BaseInitable.
 
Method Summary
 boolean getInit()
          Returns initialization status.
 InitableBroker getInitableBroker()
          Returns an InitableBroker reference.
 void init()
          Performs late initializtion.
 void init(java.lang.Object data)
          Performs early initialization.
protected  void setInit(boolean value)
          Sets initailization status.
 void setInitableBroker(InitableBroker broker)
          Saves InitableBroker reference for later use.
 void shutdown()
          Returns an Initable to uninitialized state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initableBroker

protected InitableBroker initableBroker
InitableBroker that instantiatd this class.


isInitialized

protected boolean isInitialized
Initialization status of this class.

Constructor Detail

BaseInitable

public BaseInitable()
Default constructor of BaseInitable. This constructor does nothing. Your own constructurs should be modest in allocating memory and other resources, leaving this to the init() method.

Method Detail

setInitableBroker

public void setInitableBroker(InitableBroker broker)
Saves InitableBroker reference for later use.

Specified by:
setInitableBroker in interface Initable
Parameters:
broker - The InitableBroker that instantiated this object.

getInitableBroker

public InitableBroker getInitableBroker()
Returns an InitableBroker reference.

Returns:
The InitableBroker that instantiated this object.

init

public void init(java.lang.Object data)
          throws InitializationException
Performs early initialization. Used in a manner similar to a ctor. BaseInitable doesn't need early initialization, therefore it ignores all objects passed to it and performs no initialization activities.

Specified by:
init in interface Initable
Parameters:
data - An Object to use for initialization activities.
Throws:
InitializationException - Initialization of this class was not successful.

init

public void init()
          throws InitializationException
Performs late initializtion. Called when the Service is requested for the first time (if not already completely initialized by the early initializer). Late intialization of a BaseInitable is alwas successful.

Specified by:
init in interface Initable
Throws:
InitializationException - Initialization of this class was not successful.

shutdown

public void shutdown()
Returns an Initable to uninitialized state. Calls setInit(false) to mark that we are no longer in initialized state.

Specified by:
shutdown in interface Initable

getInit

public boolean getInit()
Returns initialization status.

Specified by:
getInit in interface Initable
Returns:
True if the initable is initialized.

setInit

protected void setInit(boolean value)
Sets initailization status.

Parameters:
value - The new initialization status.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.