com.ibm.dtfj.analyzer.util
Class InitializationHelper

java.lang.Object
  extended by com.ibm.dtfj.analyzer.util.InitializationHelper

public abstract class InitializationHelper
extends java.lang.Object

Helper class to manage lazy initialization in the DEAL library


Constructor Summary
InitializationHelper(SimpleAnalyzerBean analyzer)
          Constructor
 
Method Summary
 void checkInitialization()
          Force initialization of this initializer.
abstract  void initialize()
          A method that performs all the actual initializations functions that are encapsulated by this initializer.
 boolean isInitialized()
          Check if the initializer has already completed its initialization.
 void setInitializationException(com.ibm.dtfj.image.DTFJException e)
          Explicitly mark this initializer has having been initialized in error.
 void setInitialized()
          Explicitly mark this initializer has having been successfully initialized.
 void setUnInitialized()
          Explicitly mark this initializer as not being initialized, forcing a new initialization the next time someone calls checkInitialization().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitializationHelper

public InitializationHelper(SimpleAnalyzerBean analyzer)
Constructor

Parameters:
analyzer - reference to the analyzer that is using this initializer (used to report errors in the proper context)
Method Detail

initialize

public abstract void initialize()
                         throws com.ibm.dtfj.image.DTFJException
A method that performs all the actual initializations functions that are encapsulated by this initializer. This method is abstract in the base class for all InitializationHelpers, and must be provided in specific initializer sub-classes.

Throws:
com.ibm.dtfj.image.DTFJException

isInitialized

public boolean isInitialized()
Check if the initializer has already completed its initialization. This method does not automatically trigger initialization if the initializer is not already initialized.

Returns:
true if this initializer has already completed its initialization, false otherwise.

checkInitialization

public void checkInitialization()
                         throws com.ibm.dtfj.image.DTFJException
Force initialization of this initializer. If the initializer is already initialized, this method returns immediately; otherwise, the initialize() method is called.

Throws:
com.ibm.dtfj.image.DTFJException - any exception encountered during initialization, now or previously.

setInitialized

public void setInitialized()
Explicitly mark this initializer has having been successfully initialized. It is not necessary to invoke this method if we let the initializer self-initialize through a call to checkInitialization().


setUnInitialized

public void setUnInitialized()
Explicitly mark this initializer as not being initialized, forcing a new initialization the next time someone calls checkInitialization().


setInitializationException

public void setInitializationException(com.ibm.dtfj.image.DTFJException e)
Explicitly mark this initializer has having been initialized in error. It is not necessary to invoke this method explicitly if we let the initializer self-initialize through a call to checkInitialization().

Parameters:
e - the exception encountered during initialization, to be re-thrown anytime someone tries to check the state of this initializer.


© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.