| java.lang.Object org.sape.carbon.core.component.proxy.AbstractInterceptor org.sape.carbon.core.component.lifecycle.DefaultLifecycleInterceptor
DefaultLifecycleInterceptor | public class DefaultLifecycleInterceptor extends AbstractInterceptor implements LifecycleInterceptor,Interceptor(Code) | | This is the default implementation of the lifecycle interceptor interface.
This class takes on the responsibility of delegating
Copyright 2002 Sapient
since: carbon 1.0 author: Chris Herron, January 2002 version: $Revision: 1.9 $($Author: ghinkl $ / $Date: 2003/10/15 21:40:19 $) |
EXPOSED_INTERFACES | final protected static Class[] EXPOSED_INTERFACES(Code) | | Array of interfaces this proxy adds to a component.
|
LIFECYCLE_CHANGE_EVENT_NAME | final public static String LIFECYCLE_CHANGE_EVENT_NAME(Code) | | Name of lifecycle change event.
|
DefaultLifecycleInterceptor | public DefaultLifecycleInterceptor(FunctionalInterface componentInstance, ComponentProxyInvocationHandler proxyInvocationHandler, DefaultLifecycleInterceptorConfiguration configuration)(Code) | | Creates a new DefaultLifecycleInterceptor.
Sets the initial state to CREATING.
It is intended that the constructor does not accept as a parameter
the Component to be managed, since this would circumvent the mutator
method on the LifecycleInterceptor Interface.
Parameters: componentInstance - instance of the component Parameters: proxyInvocationHandler - invocation handler for the component Parameters: configuration - configuration for the interceptor |
configureComponent | public void configureComponent(ComponentConfiguration configuration) throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code) | | Provides a Component with its Configuration. The Component should be
SUSPENDED or STOPPED, if not already.
The Component should also be returned to its entry state (RUNNING or
SUSPENDED) after the main Configure operation has completed.
Valid Entry States: RUNNING, SUSPENDED, STOPPED
Interim State: CONFIGURING
Exit States: RUNNING, SUSPENDED, STOPPED (to match entry state)
Parameters: configuration - Configuration object to be applied to component throws: InvalidStateException - When the entry state is not allowed throws: OperationNotSupportedException - When component does not supportthe requested operation throws: StateTransitionException - When an error occured while trying tocomplete the lifecycle operation |
destroyComponent | public void destroyComponent() throws OperationNotSupportedException, StateTransitionException(Code) | | Tells the Component prepare to die. This is an opportunity for the
developer to do some sensible housekeeping to aid Garbage Collection,
relinquish resources etc. Once in the DESTROYED state, a Component
cannot be revived. This implementation will wait for
DESTROY_TIMEOUT_MILLIS for the component to be destroyed. If, after
that time the component has not been destroyed, it will be logged as
a warning.
Valid Entry States: All states are valid for entry. If the
component is in the RUNNING state, it will be stopped first.
Interim State: DESTROYING
Exit State: DESTROYED
throws: InvalidStateException - When the entry state is not allowed throws: OperationNotSupportedException - When component does not supportthe requested operation throws: StateTransitionException - When an error occured while trying tocomplete the lifecycle operation |
getComponentName | final protected String getComponentName()(Code) | | Utility method used to get the component's name
String the name of the component |
getExposedInterfaces | public Class[] getExposedInterfaces()(Code) | | This should return the list of interfaces that a decorator wishes to
expose through the component proxy. This is used by the
component factory to determine what interfaces the component proxy will
implement.
Class[] an array of interfaces |
getLifecycleState | public synchronized LifecycleStateEnum getLifecycleState()(Code) | | Gets the current lifecycle state of the component.
Note the protected corresponding mutator method - this property is
read-only to external entities.
the lifecycle state of this component |
getLifecycleStateString | public String getLifecycleStateString()(Code) | | Returns a string representation of the Lifecycle State
a string representation of the Lifecycle State |
internalResumeComponent | protected void internalResumeComponent() throws OperationNotSupportedException, StateTransitionException(Code) | | Helper method to do the work of resuming a component. Called by
resumeComponent and configureComponent. A helper method is used
so that calling methods can handle threading issues as they require
while not duplicating code
throws: StateTransitionException - if an exception is caught in thefunctional implementations resume method throws: OperationNotSupportedException - not thrown by this imlementation,but provided for overriding methods |
internalStopComponent | protected void internalStopComponent() throws OperationNotSupportedException, StateTransitionException(Code) | | Helper method to do the work of suspending a component. Called by
suspendComponent and configureComponent. A helper method is used
so that calling methods can handle threading issues as they require
while not duplicating code
throws: StateTransitionException - if an exception is caught in thefunctional implementations suspend method throws: OperationNotSupportedException - not thrown by this imlementation,but provided for overriding methods |
internalSuspendComponent | protected void internalSuspendComponent() throws OperationNotSupportedException, StateTransitionException(Code) | | Helper method to do the work of suspending a component. Called by
suspendComponent and configureComponent. A helper method is used
so that calling methods can handle threading issues as they require
while not duplicating code
throws: StateTransitionException - if an exception is caught in thefunctional implementations suspend method throws: OperationNotSupportedException - not thrown by this imlementation,but provided for overriding methods |
invoke | public Object invoke(Invocation invocation) throws Throwable(Code) | | This method must implement the invocation of any necessary actions and
the chaining the next interceptor.
Parameters: invocation - the invocation to execute the results of the invocation's execution throws: Throwable - indicates an error in the invocation chain |
killInvalidComponent | protected void killInvalidComponent()(Code) | |
This method is called when an exception other than
NonFatalStateTransitionException is thrown from a component's lifecycle
method which signals that the component is corrupt and should be
destroyed.
Override this method to change what happens to a component if it
fails to transition state.
|
logNotSupported | final protected void logNotSupported(Class unImplementedInterface)(Code) | | Utility method to log trace details when a component does not
support an attempted lifecycle operation.
Parameters: unImplementedInterface - the interface which held the lifecyclemethod that was not implemented by the component |
setComponentReference | public void setComponentReference(Component componentProxy)(Code) | | This implementation does not make use of the componentProxy reference
Parameters: componentProxy - a reference to the component thatthis interceptor is assisting |
setLifecycleState | protected synchronized void setLifecycleState(LifecycleStateEnum state)(Code) | | Sets the current lifecycle state
Parameters: state - the new state |
startLifecycleMethod | protected void startLifecycleMethod()(Code) | | Acquires the component's monitor for writing. If this method is
called, it is imperitive that stopLifecycleMethod() is called.
Example invocation:
startLifecycleMethod();
try {
...
} finally {
stopLifecycleMethod();
}
See Also: ComponentProxyInvocationHandler.getMonitor throws: StateTransitionException - if the Thread is interrupted |
stopLifecycleMethod | protected void stopLifecycleMethod()(Code) | | Releases the component's monitor
|
validateEntryState | final protected void validateEntryState(LifecycleStateEnum entryState, Set validStates)(Code) | | Checks if a given state exists in a set of valid states.
Parameters: entryState - the entry state to be validated Parameters: validStates - a set of validStates throws: InvalidStateException - if the entry state is not withinthe Set of validStates |
|
|