Java Doc for Chain.java in  » Library » Apache-commons-chain-1.1-src » org » apache » commons » chain » 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 » Library » Apache commons chain 1.1 src » org.apache.commons.chain 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.chain.Chain

All known Subclasses:   org.apache.commons.chain.impl.ChainBase,
Chain
public interface Chain extends Command(Code)

A Chain represents a configured list of Command s that will be executed in order to perform processing on a specified Context . Each included Command will be executed in turn, until either one of them returns true, one of the executed Command s throws an exception, or the end of the chain has been reached. The Chain itself will return the return value of the last Command that was executed (if no exception was thrown), or rethrow the thrown exception.

Note that Chain extends Command , so that the two can be used interchangeably when a Command is expected. This makes it easy to assemble workflows in a hierarchical manner by combining subchains into an overall processing chain.

To protect applications from evolution of this interface, specialized implementations of Chain should generally be created by extending the provided base class org.apache.commons.chain.impl.ChainBase ) rather than directly implementing this interface.

Chain implementations should be designed in a thread-safe manner, suitable for execution on multiple threads simultaneously. In general, this implies that the state information identifying which Command is currently being executed should be maintained in a local variable inside the execute() method, rather than in an instance variable. The Command s in a Chain may be configured (via calls to addCommand()) at any time before the execute() method of the Chain is first called. After that, the configuration of the Chain is frozen.


author:
   Craig R. McClanahan
version:
   $Revision: 155403 $ $Date: 2005-02-26 12:52:46 +0000 (Sat, 26 Feb 2005) $




Method Summary
 voidaddCommand(Command command)
    

Add a Command to the list of Command s that will be called in turn when this Chain 's execute() method is called.

 booleanexecute(Context context)
    

Execute the processing represented by this Chain according to the following algorithm.

  • If there are no configured Command s in the Chain , return false.
  • Call the execute() method of each Command configured on this chain, in the order they were added via calls to the addCommand() method, until the end of the configured Command s is encountered, or until one of the executed Command s returns true or throws an exception.
  • Walk backwards through the Command s whose execute() methods, starting with the last one that was executed.



Method Detail
addCommand
void addCommand(Command command)(Code)

Add a Command to the list of Command s that will be called in turn when this Chain 's execute() method is called. Once execute() has been called at least once, it is no longer possible to add additional Command s; instead, an exception will be thrown.


Parameters:
  command - The Command to be added
exception:
  IllegalArgumentException - if commandis null
exception:
  IllegalStateException - if this Chain has alreadybeen executed at least once, so no further configuration is allowed



execute
boolean execute(Context context) throws Exception(Code)

Execute the processing represented by this Chain according to the following algorithm.

  • If there are no configured Command s in the Chain , return false.
  • Call the execute() method of each Command configured on this chain, in the order they were added via calls to the addCommand() method, until the end of the configured Command s is encountered, or until one of the executed Command s returns true or throws an exception.
  • Walk backwards through the Command s whose execute() methods, starting with the last one that was executed. If this Command instance is also a Filter , call its postprocess() method, discarding any exception that is thrown.
  • If the last Command whose execute() method was called threw an exception, rethrow that exception.
  • Otherwise, return the value returned by the execute() method of the last Command that was executed. This will be true if the last Command indicated that processing of this Context has been completed, or false if none of the called Command s returned true.

Parameters:
  context - The Context to be processed by thisChain
exception:
  Exception - if thrown by one of the Commandsin this Chain but not handled by a postprocess()method of a Filter
exception:
  IllegalArgumentException - if contextis null true if the processing of this Contexthas been completed, or false if the processingof this Context should be delegated to a subsequentCommand in an enclosing Chain



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