| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta name="generator" content= |
| "HTML Tidy for Windows (vers 1st July 2003), see www.w3.org" /> |
| |
| <title>Whiteboard notes for Chain of Responsibility |
| Package</title> |
| </head> |
| |
| <body bgcolor="white"> |
| <div align="center"> |
| <h1>Whiteboard notes for <em>Chain of Responsibility</em> |
| Package</h1> |
| </div> |
| |
| <h3>Agility</h3> |
| |
| <p>Agility is a working project name for a business applications |
| framework based on the Commons Chain package.</p> |
| |
| <p>The core idea behind Agility that is as much work as possible |
| should be pushed up to the business layer. Input and output is |
| encapsulated with a Context object that is passed to and from |
| Agility using a ProtocolAdaptor. Depending on its implementation, |
| a ProtocolAdaptor may collect input and deliver output directly |
| from the native platform or from a presentation framework.</p> |
| |
| <p>Agility is a Request/Response framework: for each request |
| there is a response. The request is encapsulated in a Context |
| object, which includes a Command identifier. Each request must |
| correspond to a Command, which may also be a Chain of Commands. |
| Commands may nest or chain other Commands as needed. The request |
| Command is referred to as the "Action".</p> |
| |
| <p>When a request comes in from the presentation layer (or a |
| presentation framework), it is received by a ProtocolAdaptor. The |
| ProtocolAdaptor extracts the Action Command name from the native |
| request and consults with a ContextFactory to generate a Context |
| for the request. The request Context is then passed to the |
| RequestProcessor for the given protocol.</p> |
| |
| <p>The RequestProcessor is a Command Chain which includes (at a |
| minimum) an Action Command. Each protocol can have its own |
| RequestProcessor, which may be a combination of protocol-specific |
| and generic commands. The Action Command (or Chain) is the core |
| unit of work for the request.</p> |
| |
| <p>The Action Command may consult business rules and the |
| persistence layer to complete the unit of work. Any output or |
| messages generated by the Action may be added to the Context |
| under predetermined keys. If the Action completes normally, an |
| attribute is added to the Context to signify the outcome of the |
| Action. The value of the outcome attribute is arbitrary and |
| defined by application implementing the framework ("success", |
| "failure", "xylophone").</p> |
| |
| <p>When the RequestProcessor Chain completes, the Context is |
| returned to the ProtocolAdaptor. Agility defines the |
| ProtocolAdaptor interface but does not provide an implementation. |
| If the ProtocolAdaptor is a simple Servlet, it may forward to a |
| server page by munging the outcome value. If the ProtocolAdaptor |
| is a presentation layer framework, it may pass the value to an |
| internal mechanism that selects or assembles a server page, or |
| generates a dynamic response. A ProtocolAdaptor might even |
| utilitize its own "ResponseProcessor" to execute a series of |
| Commands to assemble an approriate response.</p> |
| </body> |
| </html> |