Package net.shibboleth.shared.component

# Class AbstractInitializableComponent

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`

Direct Known Subclasses:
  `AbstractIdentifiedInitializableComponent`, `BasicHttpServletRequestContentTypeValidator`, `BasicHttpServletRequestMethodValidator`, `BasicHttpServletRequestParametersValidator`, `BasicKeystoreKeyStrategy`, `BasicParserPool`, `ChainingHttpServletRequestValidator`, `CookieManager`, `DataSealer`, `EncryptedCookieManager`, `EvaluableScript`, `IdentifiedComponentManager`, `ReloadableServiceGaugeSet`, `ScriptedKeyStrategy`

@ThreadSafe public abstract class AbstractInitializableComponent extends Object implements DestructableComponent, InitializableComponent
Base class for things that implement `DestructableComponent` and `InitializableComponent`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`isDestroyed`
Whether this component has been destroyed.
`private boolean`
`isInitialized`
Whether this component has been initialized.

## Constructor Summary

Constructors
Constructor
Description
`AbstractInitializableComponent()`

## Method Summary

Modifier and Type
Method
Description
`protected final void`
`checkComponentActive()`
Helper for any method to throw appropriate exceptions if we are either not initialized, or have been destroyed.
`protected final void`
`checkSetterPreconditions()`
Helper for a setter method to check the standard preconditions.
`final void`
`destroy()`
Destroys the component.
`protected void`
`doDestroy()`
Performs component specific destruction logic.
`protected void`
`doInitialize()`
Performs the initialization of the component.
`protected void`
`ifDestroyedThrowDestroyedComponentException()`
Checks if the component is destroyed and, if so, throws a `DestroyedComponentException`.
`protected void`
`ifInitializedThrowUnmodifiabledComponentException()`
Checks if a component has been initialized and, if so, throws a `UnmodifiableComponentException`.
`protected void`
`ifNotInitializedThrowUninitializedComponentException()`
Checks if a component has not been initialized and, if so, throws a `UninitializedComponentException`.
`final void`
`initialize()`
Initializes the component.
`final boolean`
`isDestroyed()`
Gets whether this component has been destroyed.
`boolean`
`isInitialized()`
Gets whether this component is initialized.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### isDestroyed

private boolean isDestroyed
Whether this component has been destroyed.

### isInitialized

private boolean isInitialized
Whether this component has been initialized.

## Constructor Details

### AbstractInitializableComponent

public AbstractInitializableComponent()

## Method Details

### isDestroyed

public final boolean isDestroyed()
Gets whether this component has been destroyed. Normally, once a component has been destroyed it cannot be used.

Specified by:
  `isDestroyed` in interface `DestructableComponent`
Returns:
  true iff the component has been destroyed

### isInitialized

public boolean isInitialized()
Gets whether this component is initialized.

Specified by:
  `isInitialized` in interface `InitializableComponent`
Returns:
  true iff this component is initialized

### destroy

public final void destroy()
Destroys the component.

Specified by:
  `destroy` in interface `DestructableComponent`

### initialize

public final void initialize() throws ComponentInitializationException
Initializes the component.

Specified by:
  `initialize` in interface `InitializableComponent`
Throws:
  `ComponentInitializationException` - thrown if there is a problem initializing the component

### ifDestroyedThrowDestroyedComponentException

protected void ifDestroyedThrowDestroyedComponentException()
Checks if the component is destroyed and, if so, throws a `DestroyedComponentException`.

### ifNotInitializedThrowUninitializedComponentException

protected void ifNotInitializedThrowUninitializedComponentException()
Checks if a component has not been initialized and, if so, throws a `UninitializedComponentException`.

### ifInitializedThrowUnmodifiabledComponentException

protected void ifInitializedThrowUnmodifiabledComponentException()
Checks if a component has been initialized and, if so, throws a `UnmodifiableComponentException`.

### checkSetterPreconditions

protected final void checkSetterPreconditions()
Helper for a setter method to check the standard preconditions.

### checkComponentActive

protected final void checkComponentActive()
Helper for any method to throw appropriate exceptions if we are either not initialized, or have been destroyed.

### doDestroy

protected void doDestroy()
Performs component specific destruction logic. This method is executed within the lock on the object being destroyed. The default implementation of this method is a no-op.

### doInitialize

protected void doInitialize() throws ComponentInitializationException
Performs the initialization of the component. This method is executed within the lock on the object being initialized. The default implementation of this method is a no-op.

Throws:
  `ComponentInitializationException` - thrown if there is a problem initializing the component