net.shibboleth.metadata.pipeline
Class AbstractComponent

java.lang.Object
  extended by net.shibboleth.metadata.pipeline.AbstractComponent
All Implemented Interfaces:
Component
Direct Known Subclasses:
BaseStage, CompositeStage, SimplePipeline

@ThreadSafe
public abstract class AbstractComponent
extends Object
implements Component

Base implementation for pipeline components. All classes which extend this base class must ensure that the state of the object does not change after initialize() is called. In particular, any setter method should check to see if the component has been initialized and, if so, immediately return without altering the component state.


Field Summary
private  String id
          Unique ID for the component.
private  DateTime initInstant
          Instant when the component was initialized.
private  Logger log
          Class logger.
 
Constructor Summary
AbstractComponent()
           
 
Method Summary
protected  void doInitialize()
          Do the initialization of the component.
 boolean equals(Object obj)
          
 String getId()
          Gets a unique identifier for the component.
 DateTime getInitializationInstant()
          Gets the instant the component was initialized.
 int hashCode()
          
 void initialize()
          Initializes the component.
 boolean isInitialized()
          Checks whether the component has been initialized.
 void setId(String componentId)
          Sets the ID of this component.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final Logger log
Class logger.


id

private String id
Unique ID for the component.


initInstant

private DateTime initInstant
Instant when the component was initialized.

Constructor Detail

AbstractComponent

public AbstractComponent()
Method Detail

getId

public String getId()
Gets a unique identifier for the component.

Specified by:
getId in interface Component
Returns:
unique identifier for the component

setId

public void setId(String componentId)
Sets the ID of this component.

Parameters:
componentId - ID of the component, may not be null or empty

getInitializationInstant

public final DateTime getInitializationInstant()
Gets the instant the component was initialized. All instants are given in UTC time.

Specified by:
getInitializationInstant in interface Component
Returns:
instant the component was initialized

initialize

public final void initialize()
                      throws ComponentInitializationException
Initializes the component. Once a component has been initialized this method will throw an IllegalStateException.

Specified by:
initialize in interface Component
Throws:
ComponentInitializationException - thrown if there is a problem initializing the component for use

isInitialized

public final boolean isInitialized()
Checks whether the component has been initialized.

Specified by:
isInitialized in interface Component
Returns:
whether the component has been initialized

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

doInitialize

protected void doInitialize()
                     throws ComponentInitializationException
Do the initialization of the component. Default implementation of this method is a no-op. Extending classes should override this method to perform any initialization logic necessary.

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


Copyright © 2009-2011. All Rights Reserved.