Source Code Cross Referenced for AbstractBeanInvokingAction.java in  » Workflow-Engines » spring-webflow-1.0.4 » org » springframework » webflow » action » 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 » Workflow Engines » spring webflow 1.0.4 » org.springframework.webflow.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.springframework.webflow.action;
017:
018:        import org.springframework.binding.convert.ConversionService;
019:        import org.springframework.binding.convert.support.DefaultConversionService;
020:        import org.springframework.binding.method.MethodInvoker;
021:        import org.springframework.binding.method.MethodSignature;
022:        import org.springframework.util.Assert;
023:        import org.springframework.webflow.execution.Action;
024:        import org.springframework.webflow.execution.Event;
025:        import org.springframework.webflow.execution.RequestContext;
026:
027:        /**
028:         * Base class for actions that delegate to methods on beans (POJOs - Plain Old
029:         * Java Objects). Acts as an adapter that adapts an {@link Object} method to the
030:         * Spring Web Flow {@link Action} contract.
031:         * <p>
032:         * Subclasses are required to implement the {@link #getBean(RequestContext)}
033:         * method, returning the bean on which a method should be invoked.
034:         * 
035:         * @see BeanInvokingActionFactory
036:         * 
037:         * @author Keith Donald
038:         */
039:        public abstract class AbstractBeanInvokingAction extends AbstractAction {
040:
041:            /**
042:             * The signature of the method to invoke on the target bean, capable of
043:             * resolving the method when used with a {@link MethodInvoker}. Required.
044:             */
045:            private MethodSignature methodSignature;
046:
047:            /**
048:             * The method invoker that performs the action-&gt;bean method binding,
049:             * accepting a {@link MethodSignature} and
050:             * {@link #getBean(RequestContext) target bean} instance.
051:             */
052:            private MethodInvoker methodInvoker = new MethodInvoker();
053:
054:            /**
055:             * The specification (configuration) for how bean method return values
056:             * should be exposed to an executing flow that invokes this action.
057:             */
058:            private ActionResultExposer methodResultExposer;
059:
060:            /**
061:             * The strategy that adapts bean method return values to Event objects.
062:             */
063:            private ResultEventFactory resultEventFactory = new SuccessEventFactory();
064:
065:            /**
066:             * Creates a new bean invoking action.
067:             * @param methodSignature the signature of the method to invoke
068:             */
069:            protected AbstractBeanInvokingAction(MethodSignature methodSignature) {
070:                Assert
071:                        .notNull(methodSignature,
072:                                "The signature of the target method to invoke is required");
073:                this .methodSignature = methodSignature;
074:            }
075:
076:            /**
077:             * Returns the signature of the method to invoke on the target bean.
078:             */
079:            public MethodSignature getMethodSignature() {
080:                return methodSignature;
081:            }
082:
083:            /**
084:             * Returns the configuration for how bean method return values should be
085:             * exposed to an executing flow that invokes this action.
086:             */
087:            public ActionResultExposer getMethodResultExposer() {
088:                return methodResultExposer;
089:            }
090:
091:            /**
092:             * Configures how bean method return values should be exposed to an
093:             * executing flow that invokes this action. This is optional. By default the
094:             * bean method return values do not get exposed to the executing flow.
095:             */
096:            public void setMethodResultExposer(
097:                    ActionResultExposer methodResultExposer) {
098:                this .methodResultExposer = methodResultExposer;
099:            }
100:
101:            /**
102:             * Returns the event adaption strategy used by this action.
103:             */
104:            protected ResultEventFactory getResultEventFactory() {
105:                return resultEventFactory;
106:            }
107:
108:            /**
109:             * Set the bean return value-&gt;event adaption strategy. Defaults to
110:             * {@link SuccessEventFactory}, so all bean method return values will be
111:             * interpreted as "success".
112:             */
113:            public void setResultEventFactory(
114:                    ResultEventFactory resultEventFactory) {
115:                this .resultEventFactory = resultEventFactory;
116:            }
117:
118:            /**
119:             * Set the conversion service to perform type conversion of event parameters
120:             * to method arguments as neccessary.
121:             * Defaults to {@link DefaultConversionService}.
122:             */
123:            public void setConversionService(ConversionService conversionService) {
124:                methodInvoker.setConversionService(conversionService);
125:            }
126:
127:            /**
128:             * Returns the bean method invoker helper.
129:             */
130:            protected MethodInvoker getMethodInvoker() {
131:                return methodInvoker;
132:            }
133:
134:            protected Event doExecute(RequestContext context) throws Exception {
135:                Object bean = getBean(context);
136:                Object returnValue = getMethodInvoker().invoke(methodSignature,
137:                        bean, context);
138:                if (methodResultExposer != null) {
139:                    methodResultExposer.exposeResult(returnValue, context);
140:                }
141:                return resultEventFactory.createResultEvent(bean, returnValue,
142:                        context);
143:            }
144:
145:            // subclassing hooks
146:
147:            /**
148:             * Retrieves the bean to invoke a method on. Subclasses need to implement
149:             * this method.
150:             * @param context the flow execution request context
151:             * @return the bean on which to invoke methods
152:             * @throws Exception when the bean cannot be retreived
153:             */
154:            protected abstract Object getBean(RequestContext context)
155:                    throws Exception;
156:
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.