org.apache.turbine.services

## Class BaseInitable

- java.lang.Object
- - org.apache.turbine.services.BaseInitable

- All Implemented Interfaces:
    Initable
  Direct Known Subclasses:
    BaseService

      public class BaseInitable
      extends 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 1706239 2015-10-01 13:18:35Z tv $
  Author:
    Kevin Burton, Rafal Krzewski

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected InitableBroker` | `initableBroker` InitableBroker that instantiatd this class.
    `protected boolean` | `isInitialized` Initialization status of this class.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseInitable()` Default constructor of BaseInitable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getInit()` Returns initialization status.
    `InitableBroker` | `getInitableBroker()` Returns an InitableBroker reference.
    `void` | `init()` Performs late initialization.
    `void` | `init(Object data)` Performs early initialization.
    `protected void` | `setInit(boolean value)` Sets initialization 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(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 initialization. Called when the Service is requested for the first time (if not already completely initialized by the early initializer). Late initialization of a BaseInitable is always 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 initialization status.
      Parameters:
        `value` - The new initialization status.

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.