org.apache.avalon.excalibur.util
Class ComponentStateValidator

java.lang.Object
  |
  +--org.apache.avalon.excalibur.util.ComponentStateValidator

public final class ComponentStateValidator
extends java.lang.Object

This class provides basic facilities for enforcing Avalon's contracts within your own code.

Version:
CVS $Revision: 1.7 $ $Date: 2002/01/17 15:02:01 $
Author:
Berin Loritsch, Michael McKibben

Constructor Summary
ComponentStateValidator(java.lang.Object object)
          Create state validator from object (this can be used for more than just components).
 
Method Summary
 void checkActive()
          Checks to see if the state is active.
 void checkActive(java.lang.String message)
          Checks to see if the state is active.
 void checkComposed()
          Throw an exception if the initialization is out of order.
 void checkComposed(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkConfigured()
          Throw an exception if the initialization is out of order.
 void checkConfigured(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkContextualized()
          Throw an exception if the initialization is out of order.
 void checkContextualized(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkDisposed()
          Throw an exception if the initialization is out of order.
 void checkDisposed(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkInitialized()
          Throw an exception if the initialization is out of order.
 void checkInitialized(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkLogEnabled()
          Throw an exception if the initialization is out of order.
 void checkLogEnabled(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkNotAssigned(java.lang.Object object)
          Make sure object has not been assigned yet.
 void checkNotAssigned(java.lang.Object object, java.lang.String message)
          Make sure object has not been assigned yet.
 void checkParameterized()
          Throw an exception if the initialization is out of order.
 void checkParameterized(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkResumed()
          Throw an exception if the initialization is out of order.
 void checkResumed(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkStarted()
          Throw an exception if the initialization is out of order.
 void checkStarted(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkStopped()
          Throw an exception if the initialization is out of order.
 void checkStopped(java.lang.String message)
          Throw an exception if the initialization is out of order.
 void checkSuspended()
          Throw an exception if the initialization is out of order.
 void checkSuspended(java.lang.String message)
          Throw an exception if the initialization is out of order.
 boolean isActive()
          Checks to see if the state is active, and returns true or false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentStateValidator

public ComponentStateValidator(java.lang.Object object)
Create state validator from object (this can be used for more than just components).
Method Detail

checkLogEnabled

public void checkLogEnabled()
Throw an exception if the initialization is out of order. It tests to see if the LOG_ENABLED state has already been set, if the component implements LogEnabled or Logger, and if the state has progressed beyond the Logger stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkLogEnabled

public void checkLogEnabled(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the LOG_ENABLED state has already been set, if the component implements LogEnabled or Logger, and if the state has progressed beyond the Logger stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkContextualized

public void checkContextualized()
Throw an exception if the initialization is out of order. It tests to see if the CONTEXTUALIZED state has already been set, if the component implements Contextualizable, and if the state has progressed beyond the Context stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkContextualized

public void checkContextualized(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the CONTEXTUALIZED state has already been set, if the component implements Contextualizable, and if the state has progressed beyond the Context stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkParameterized

public void checkParameterized()
Throw an exception if the initialization is out of order. It tests to see if the PARAMETERIZED state has already been set, if the component implements Parameterizable, and if the state has progressed beyond the Parameters stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkParameterized

public void checkParameterized(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the PARAMETERIZED state has already been set, if the component implements Parameterizable, and if the state has progressed beyond the Parameters stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkConfigured

public void checkConfigured()
Throw an exception if the initialization is out of order. It tests to see if the CONFIGURED state has already been set, if the component implements Configurable, and if the state has progressed beyond the Configuration stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkConfigured

public void checkConfigured(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the CONFIGURED state has already been set, if the component implements Configurable, and if the state has progressed beyond the Configuration stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkComposed

public void checkComposed()
Throw an exception if the initialization is out of order. It tests to see if the COMPOSED state has already been set, if the component implements Composable, and if the state has progressed beyond the Configuration stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkComposed

public void checkComposed(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the COMPOSED state has already been set, if the component implements Composable, and if the state has progressed beyond the Configuration stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkInitialized

public void checkInitialized()
Throw an exception if the initialization is out of order. It tests to see if the INITIALIZED state has already been set, if the component implements Initializable, and if the state has progressed beyond the initialize stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkInitialized

public void checkInitialized(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the INITIALIZED state has already been set, if the component implements Initializable, and if the state has progressed beyond the initialize stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkStarted

public void checkStarted()
Throw an exception if the initialization is out of order. It tests to see if the STARTED state has already been set, if the component implements Startable, and if the state has progressed beyond the start stage.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkStarted

public void checkStarted(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the STARTED state has already been set, if the component implements Startable, and if the state has progressed beyond the start stage.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkSuspended

public void checkSuspended()
Throw an exception if the initialization is out of order. It tests to see if the SUSPENDED state has already been set, if the component implements Suspendable, and if the Component is active.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkSuspended

public void checkSuspended(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the SUSPENDED state has already been set, if the component implements Suspendable, and if the Component is active.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkResumed

public void checkResumed()
Throw an exception if the initialization is out of order. It tests to see if the SUSPENDED state has not been set, if the component implements Suspendable, and if the Component is active.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkResumed

public void checkResumed(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the SUSPENDED state has not been set, if the component implements Suspendable, and if the Component is active.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkStopped

public void checkStopped()
Throw an exception if the initialization is out of order. It tests to see if the STOPPED state has not been set, if the component implements Startable, and if the Component is active.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkStopped

public void checkStopped(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the STOPPED state has not been set, if the component implements Startable, and if the Component is active.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkDisposed

public void checkDisposed()
Throw an exception if the initialization is out of order. It tests to see if the DISPOSED state has not been set, if the component implements Disposable.
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkDisposed

public void checkDisposed(java.lang.String message)
Throw an exception if the initialization is out of order. It tests to see if the DISPOSED state has not been set, if the component implements Disposable.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkActive

public void checkActive()
Checks to see if the state is active.
Throws:
java.lang.IllegalStateException - if the component is not active

checkActive

public void checkActive(java.lang.String message)
Checks to see if the state is active.
Parameters:
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the component is not active

isActive

public boolean isActive()
Checks to see if the state is active, and returns true or false.

checkNotAssigned

public void checkNotAssigned(java.lang.Object object)
Make sure object has not been assigned yet.
Parameters:
object - to test
Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkNotAssigned

public void checkNotAssigned(java.lang.Object object,
                             java.lang.String message)
Make sure object has not been assigned yet.
Parameters:
object - to test
message - the message to include in the thrown exception
Throws:
java.lang.IllegalStateException - if the state is manage out of order


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.