org.apache.avalon.excalibur.testcase
Class ComponentStateValidator

java.lang.Object
  extended by org.apache.avalon.excalibur.testcase.ComponentStateValidator

Deprecated. ECM is no longer supported

public final class ComponentStateValidator
extends java.lang.Object

This class provides basic facilities for enforcing Avalon's contracts within your own code. Based on Avalon version from Sandbox.

Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:27 $
Author:
Avalon Development Team

Field Summary
private static long COMPOSABLE
          Deprecated.  
private static long COMPOSE
          Deprecated.  
private static long CONFIGURABLE
          Deprecated.  
private static long CONFIGURE
          Deprecated.  
private static long CONTEXTUALIZABLE
          Deprecated.  
private static long CONTEXTUALIZE
          Deprecated.  
private static long DISPOSABLE
          Deprecated.  
private static long DISPOSE
          Deprecated.  
private static long ENABLE_LOGGING
          Deprecated.  
private static long INIT_COMPLETE
          Deprecated.  
private static long INIT_MASK
          Deprecated.  
private static long INITIALIZABLE
          Deprecated.  
private static long INITIALIZE
          Deprecated.  
private static long LOG_ENABLED
          Deprecated.  
private static long LOGGABLE
          Deprecated.  
private  boolean m_active
          Deprecated.  
private  long m_interfaces
          Deprecated.  
private  long m_methods
          Deprecated.  
private  java.lang.Object m_object
          Deprecated.  
private  long m_state
          Deprecated.  
private static long PARAMETERIZABLE
          Deprecated.  
private static long PARAMETERIZE
          Deprecated.  
private static long RECOMPOSABLE
          Deprecated.  
private static long RECOMPOSE
          Deprecated.  
private static long RECONFIGURABLE
          Deprecated.  
private static long RECONFIGURE
          Deprecated.  
private static long RECONTEXTUALIZABLE
          Deprecated.  
private static long RECONTEXTUALIZE
          Deprecated.  
private static long RESUME
          Deprecated.  
private static long SERVICE
          Deprecated.  
private static long SERVICEABLE
          Deprecated.  
private static long SET_LOGGER
          Deprecated.  
private static long START
          Deprecated.  
private static long STARTABLE
          Deprecated.  
private static long STOP
          Deprecated.  
private static long SUSPEND
          Deprecated.  
private static long SUSPENDABLE
          Deprecated.  
private static java.lang.String WRITE_FAIL
          Deprecated.  
 
Constructor Summary
ComponentStateValidator(java.lang.Object object)
          Deprecated. Create state validator from object (this can be used for more than just components).
 
Method Summary
 void checkActive()
          Deprecated. Checks to see if the state is active.
 void checkActive(java.lang.String message)
          Deprecated. Checks to see if the state is active.
 void checkComposed()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkComposed(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkConfigured()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkConfigured(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkContextualized()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkContextualized(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkDisposed()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkDisposed(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkInitialized()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkInitialized(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkLogEnabled()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkLogEnabled(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkLoggable()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkLoggable(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkNotAssigned(java.lang.Object object)
          Deprecated. Make sure object has not been assigned yet.
 void checkNotAssigned(java.lang.Object object, java.lang.String message)
          Deprecated. Make sure object has not been assigned yet.
 void checkParameterized()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkParameterized(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkResumed()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkResumed(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkServiced()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkServiced(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkStarted()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkStarted(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkStopped()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkStopped(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
 void checkSuspended()
          Deprecated. Throw an exception if the initialization is out of order.
 void checkSuspended(java.lang.String message)
          Deprecated. Throw an exception if the initialization is out of order.
private  void generalCheckActive(java.lang.String message, long interfaceId, long methodId)
          Deprecated. Active Service methods may only be called after all of the Initialization methods have been called, any before any of the Descruction methods have been called.
private  void generalCheckDest(java.lang.String message, long interfaceId, long methodId)
          Deprecated. Descruction Methods must be called in order.
private  void generalCheckInit(java.lang.String message, long interfaceId, long methodId)
          Deprecated. Initialization methods must be called in order, must all be called, may not be called more than once, and may not be called once any of the Descruction methods have been called.
private  void generalCheckInitComplete()
          Deprecated. Test to see if this was the last initialization method.
private  java.lang.String getInterfaceName(long interfaceId)
          Deprecated.  
private  java.lang.String getLastMethod(long state)
          Deprecated.  
private  java.lang.String getMethodName(long methodId)
          Deprecated.  
 boolean isActive()
          Deprecated. 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
 

Field Detail

WRITE_FAIL

private static final java.lang.String WRITE_FAIL
Deprecated. 
See Also:
Constant Field Values

LOG_ENABLED

private static final long LOG_ENABLED
Deprecated. 
See Also:
Constant Field Values

LOGGABLE

private static final long LOGGABLE
Deprecated. 
See Also:
Constant Field Values

CONTEXTUALIZABLE

private static final long CONTEXTUALIZABLE
Deprecated. 
See Also:
Constant Field Values

COMPOSABLE

private static final long COMPOSABLE
Deprecated. 
See Also:
Constant Field Values

SERVICEABLE

private static final long SERVICEABLE
Deprecated. 
See Also:
Constant Field Values

CONFIGURABLE

private static final long CONFIGURABLE
Deprecated. 
See Also:
Constant Field Values

PARAMETERIZABLE

private static final long PARAMETERIZABLE
Deprecated. 
See Also:
Constant Field Values

INITIALIZABLE

private static final long INITIALIZABLE
Deprecated. 
See Also:
Constant Field Values

STARTABLE

private static final long STARTABLE
Deprecated. 
See Also:
Constant Field Values

SUSPENDABLE

private static final long SUSPENDABLE
Deprecated. 
See Also:
Constant Field Values

RECONTEXTUALIZABLE

private static final long RECONTEXTUALIZABLE
Deprecated. 
See Also:
Constant Field Values

RECOMPOSABLE

private static final long RECOMPOSABLE
Deprecated. 
See Also:
Constant Field Values

RECONFIGURABLE

private static final long RECONFIGURABLE
Deprecated. 
See Also:
Constant Field Values

DISPOSABLE

private static final long DISPOSABLE
Deprecated. 
See Also:
Constant Field Values

ENABLE_LOGGING

private static final long ENABLE_LOGGING
Deprecated. 
See Also:
Constant Field Values

SET_LOGGER

private static final long SET_LOGGER
Deprecated. 
See Also:
Constant Field Values

CONTEXTUALIZE

private static final long CONTEXTUALIZE
Deprecated. 
See Also:
Constant Field Values

SERVICE

private static final long SERVICE
Deprecated. 
See Also:
Constant Field Values

COMPOSE

private static final long COMPOSE
Deprecated. 
See Also:
Constant Field Values

CONFIGURE

private static final long CONFIGURE
Deprecated. 
See Also:
Constant Field Values

PARAMETERIZE

private static final long PARAMETERIZE
Deprecated. 
See Also:
Constant Field Values

INITIALIZE

private static final long INITIALIZE
Deprecated. 
See Also:
Constant Field Values

START

private static final long START
Deprecated. 
See Also:
Constant Field Values

INIT_COMPLETE

private static final long INIT_COMPLETE
Deprecated. 
See Also:
Constant Field Values

SUSPEND

private static final long SUSPEND
Deprecated. 
See Also:
Constant Field Values

RECONTEXTUALIZE

private static final long RECONTEXTUALIZE
Deprecated. 
See Also:
Constant Field Values

RECOMPOSE

private static final long RECOMPOSE
Deprecated. 
See Also:
Constant Field Values

RECONFIGURE

private static final long RECONFIGURE
Deprecated. 
See Also:
Constant Field Values

RESUME

private static final long RESUME
Deprecated. 
See Also:
Constant Field Values

STOP

private static final long STOP
Deprecated. 
See Also:
Constant Field Values

DISPOSE

private static final long DISPOSE
Deprecated. 
See Also:
Constant Field Values

INIT_MASK

private static final long INIT_MASK
Deprecated. 
See Also:
Constant Field Values

m_interfaces

private final long m_interfaces
Deprecated. 

m_methods

private final long m_methods
Deprecated. 

m_state

private long m_state
Deprecated. 

m_active

private boolean m_active
Deprecated. 

m_object

private final java.lang.Object m_object
Deprecated. 
Constructor Detail

ComponentStateValidator

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

Method Detail

getInterfaceName

private java.lang.String getInterfaceName(long interfaceId)
Deprecated. 

getMethodName

private java.lang.String getMethodName(long methodId)
Deprecated. 

getLastMethod

private java.lang.String getLastMethod(long state)
Deprecated. 

generalCheckInitComplete

private void generalCheckInitComplete()
Deprecated. 
Test to see if this was the last initialization method.


generalCheckInit

private void generalCheckInit(java.lang.String message,
                              long interfaceId,
                              long methodId)
Deprecated. 
Initialization methods must be called in order, must all be called, may not be called more than once, and may not be called once any of the Descruction methods have been called.


generalCheckActive

private void generalCheckActive(java.lang.String message,
                                long interfaceId,
                                long methodId)
Deprecated. 
Active Service methods may only be called after all of the Initialization methods have been called, any before any of the Descruction methods have been called. While in the active state, the contracts of the methods allow the active state methods to be called any number of times, in any order. The resume() method should do nothing if suspend() has not yet been called for example.


generalCheckDest

private void generalCheckDest(java.lang.String message,
                              long interfaceId,
                              long methodId)
Deprecated. 
Descruction Methods must be called in order. They may be called before all of the Initialization methods have been called if there was an error.


checkLogEnabled

public void checkLogEnabled()
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the ENABLE_LOGGING state has already been set, if the component implements LogEnabled, 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)
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the ENABLE_LOGGING state has already been set, if the component implements LogEnabled, 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

checkLoggable

public void checkLoggable()
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the SET_LOGGER state has already been set, if the component implements Loggable, and if the state has progressed beyond the Logger stage.

Throws:
java.lang.IllegalStateException - if the state is manage out of order

checkLoggable

public void checkLoggable(java.lang.String message)
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the SET_LOGGER state has already been set, if the component implements Loggable, 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()
Deprecated. 
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)
Deprecated. 
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

checkServiced

public void checkServiced()
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the SERVICE 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

checkServiced

public void checkServiced(java.lang.String message)
Deprecated. 
Throw an exception if the initialization is out of order. It tests to see if the SERVICE 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

checkComposed

public void checkComposed()
Deprecated. 
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)
Deprecated. 
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

checkConfigured

public void checkConfigured()
Deprecated. 
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)
Deprecated. 
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

checkParameterized

public void checkParameterized()
Deprecated. 
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)
Deprecated. 
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

checkInitialized

public void checkInitialized()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
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)
Deprecated. 
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()
Deprecated. 
Checks to see if the state is active, and returns true or false.

Returns:
true if active, false if not

checkNotAssigned

public void checkNotAssigned(java.lang.Object object)
Deprecated. 
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)
Deprecated. 
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