Java Doc for DefaultLifecycleInterceptor.java in  » Inversion-of-Control » carbon » org » sape » carbon » core » component » lifecycle » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Inversion of Control » carbon » org.sape.carbon.core.component.lifecycle 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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 $)


Field Summary
final protected static  Class[]EXPOSED_INTERFACES
     Array of interfaces this proxy adds to a component.
final public static  StringLIFECYCLE_CHANGE_EVENT_NAME
     Name of lifecycle change event.

Constructor Summary
public  DefaultLifecycleInterceptor(FunctionalInterface componentInstance, ComponentProxyInvocationHandler proxyInvocationHandler, DefaultLifecycleInterceptorConfiguration configuration)
     Creates a new DefaultLifecycleInterceptor.

Method Summary
public  voidconfigureComponent(ComponentConfiguration configuration)
     Provides a Component with its Configuration.
public  voiddestroyComponent()
     Tells the Component prepare to die.
final protected  StringgetComponentName()
    
public  Class[]getExposedInterfaces()
     This should return the list of interfaces that a decorator wishes to expose through the component proxy.
public synchronized  LifecycleStateEnumgetLifecycleState()
     Gets the current lifecycle state of the component.
public  StringgetLifecycleStateString()
    
public  voidinitializeComponent(Component thisComponent)
     Run ONLY ONCE during the life of a Component, immediately after the Component is created.
protected  voidinternalResumeComponent()
     Helper method to do the work of resuming a component.
protected  voidinternalStopComponent()
     Helper method to do the work of suspending a component.
protected  voidinternalSuspendComponent()
     Helper method to do the work of suspending a component.
public  Objectinvoke(Invocation invocation)
     This method must implement the invocation of any necessary actions and the chaining the next interceptor.
protected  voidkillInvalidComponent()
    

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.

final protected  voidlogNotSupported(Class unImplementedInterface)
     Utility method to log trace details when a component does not support an attempted lifecycle operation.
public  voidresumeComponent()
     Tells the Component to resume its service.
public  voidsetComponentReference(Component componentProxy)
    
protected synchronized  voidsetLifecycleState(LifecycleStateEnum state)
    
public  voidstartComponent()
     Tells the Component to begin providing its service.
protected  voidstartLifecycleMethod()
     Acquires the component's monitor for writing.
public  voidstopComponent()
     Tells the Component to cease providing its service.
protected  voidstopLifecycleMethod()
    
public  voidsuspendComponent()
     Tells the Component to suspend its service.
final protected  voidvalidateEntryState(LifecycleStateEnum entryState, Set validStates)
     Checks if a given state exists in a set of valid states.
protected  voidwaitForResume()
     Waits for the component to return from the LifecycleStateEnum.SUSPENDED state to the LifecycleStateEnum.RUNNING state.

Field Detail
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.




Constructor Detail
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




Method Detail
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



initializeComponent
public void initializeComponent(Component thisComponent) throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code)
Run ONLY ONCE during the life of a Component, immediately after the Component is created. Enforced by having CREATING as the only allowed entry state.

Valid Entry States: CREATING

Interim State: INITIALIZING

Exit State: STOPPED


Parameters:
  thisComponent - component to be initialized
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



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



resumeComponent
public void resumeComponent() throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code)
Tells the Component to resume its service. The Component can now continue its outstanding work.

Valid Entry States: SUSPENDED

Interim State: RESUMING

Exit State: RUNNING


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



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



startComponent
public void startComponent() throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code)
Tells the Component to begin providing its service.

Valid Entry States: STOPPED

Interim State: STARTING

Exit State: RUNNING


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



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



stopComponent
public void stopComponent() throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code)
Tells the Component to cease providing its service. This is an opportunity for the Component to complete outstanding work.

Valid Entry States: RUNNING, SUSPENDED

Interim State: STOPPING

Exit State: STOPPED


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



stopLifecycleMethod
protected void stopLifecycleMethod()(Code)
Releases the component's monitor



suspendComponent
public void suspendComponent() throws InvalidStateException, OperationNotSupportedException, StateTransitionException(Code)
Tells the Component to suspend its service. This is an opportunity for the Component to sensibly pause its outstanding work.

Valid Entry States: RUNNING

Interim State: SUSPENDING

Exit State: SUSPENDED


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



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



waitForResume
protected void waitForResume() throws InvalidStateException, ComponentUnavailableException(Code)
Waits for the component to return from the LifecycleStateEnum.SUSPENDED state to the LifecycleStateEnum.RUNNING state.

Override this method to disable or change this functionality.
throws:
  ComponentUnavailableException - if it does not change states in atimely manner or if
throws:
  InvalidStateException - if the entry state is not withinthe Set of validStates




Fields inherited from org.sape.carbon.core.component.proxy.AbstractInterceptor
protected Interceptor nextInterceptor(Code)(Java Doc)
protected boolean nextInterceptorIsProxy(Code)(Java Doc)
protected InvocationHandler nextInvocationHandler(Code)(Java Doc)

Methods inherited from org.sape.carbon.core.component.proxy.AbstractInterceptor
protected Object callNextInterceptor(Invocation invocation) throws Throwable(Code)(Java Doc)
public void setNextInterceptor(Interceptor interceptor)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.