Java Doc for Command.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.Command

All known Subclasses:   org.apache.commons.chain.web.servlet.RequestParameterMapper,  org.apache.commons.chain.generic.CopyCommand,  org.apache.commons.chain.web.servlet.ServletPathMapper,  org.apache.commons.chain.config.TestCommand,  org.apache.commons.chain.web.servlet.PathInfoMapper,  org.apache.commons.chain.impl.NonDelegatingCommand,  org.apache.commons.chain.web.AbstractSetLocaleCommand,  org.apache.commons.chain.web.AbstractGetLocaleCommand,  org.apache.commons.chain.generic.DispatchCommand,  org.apache.commons.chain.generic.RemoveCommand,
Command
public interface Command (Code)

A Command encapsulates a unit of processing work to be performed, whose purpose is to examine and/or modify the state of a transaction that is represented by a Context . Individual Command s can be assembled into a Chain , which allows them to either complete the required processing or delegate further processing to the next Command in the Chain .

Command implementations should be designed in a thread-safe manner, suitable for inclusion in multiple Chain s that might be processed by different threads simultaneously. In general, this implies that Command classes should not maintain state information in instance variables. Instead, state information should be maintained via suitable modifications to the attributes of the Context that is passed to the execute() command.

Command implementations typically retrieve and store state information in the Context instance that is passed as a parameter to the execute() method, using particular keys into the Map that can be acquired via Context.getAttributes(). To improve interoperability of Command implementations, a useful design pattern is to expose the key values used as JavaBeans properties of the Command implementation class itself. For example, a Command that requires an input and an output key might implement the following properties:

 private String inputKey = "input";
 public String getInputKey() {
 return (this.inputKey);
 }
 public void setInputKey(String inputKey) {
 this.inputKey = inputKey;
 }
 private String outputKey = "output";
 public String getOutputKey() {
 return (this.outputKey);
 }
 public void setOutputKey(String outputKey) {
 this.outputKey = outputKey;
 }
 

And the operation of accessing the "input" information in the context would be executed by calling:

 String input = (String) context.get(getInputKey());
 

instead of hard coding the attribute name. The use of the "Key" suffix on such property names is a useful convention to identify properties being used in this fashion, as opposed to JavaBeans properties that simply configure the internal operation of this Command .


author:
   Craig R. McClanahan
version:
   $Revision: 411876 $ $Date: 2006-06-05 19:02:19 +0100 (Mon, 05 Jun 2006) $


Field Summary
final public static  booleanCONTINUE_PROCESSING
    
final public static  booleanPROCESSING_COMPLETE
    


Method Summary
 booleanexecute(Context context)
    

Execute a unit of processing work to be performed.


Field Detail
CONTINUE_PROCESSING
final public static boolean CONTINUE_PROCESSING(Code)

Commands should return CONTINUE_PROCESSING if the processing of the given Context should be delegated to a subsequent Command in an enclosing Chain .


since:
   Chain 1.1



PROCESSING_COMPLETE
final public static boolean PROCESSING_COMPLETE(Code)

Commands should return PROCESSING_COMPLETE if the processing of the given Context has been completed.


since:
   Chain 1.1





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

Execute a unit of processing work to be performed. This Command may either complete the required processing and return true, or delegate remaining processing to the next Command in a Chain containing this Command by returning false
Parameters:
  context - The Context to be processed by thisCommand
exception:
  Exception - general purpose exception returnto indicate abnormal termination
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.