Source Code Cross Referenced for DelegatingActionMapping.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » pageflow » config » 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 beehive 1.0.2 src » org.apache.beehive.netui.pageflow.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.pageflow.config;
020:
021:        import org.apache.beehive.netui.pageflow.internal.InternalUtils;
022:        import org.apache.struts.config.ModuleConfig;
023:        import org.apache.struts.config.ExceptionConfig;
024:        import org.apache.struts.config.ForwardConfig;
025:        import org.apache.struts.action.ActionForward;
026:        import org.apache.struts.action.ActionMapping;
027:
028:        import javax.servlet.ServletContext;
029:        import java.util.Map;
030:
031:        /**
032:         * A Struts ActionMapping object that delegates to an ActionMapping in a different module.
033:         */
034:        public class DelegatingActionMapping extends PageFlowActionMapping {
035:            private ActionMapping _delegate;
036:            private String _delegateModulePath;
037:            private boolean _inheritLocalPaths;
038:
039:            // values from the module config to override the delegate properties.
040:            private boolean _loginRequiredSet = false;
041:            private boolean _readonlySet = false;
042:
043:            /**
044:             * Set the path prefix for the module where the delegate ActionMapping lives.
045:             */
046:            public void setDelegateModulePath(String delegateModulePath) {
047:                _delegateModulePath = delegateModulePath;
048:            }
049:
050:            public void init(ServletContext servletContext) {
051:                ModuleConfig moduleConfig = InternalUtils.ensureModuleConfig(
052:                        _delegateModulePath, servletContext);
053:                assert moduleConfig != null : "No ModuleConfig found for path "
054:                        + _delegateModulePath;
055:                _delegate = (ActionMapping) moduleConfig
056:                        .findActionConfig(getPath());
057:
058:                // It's possible that an overloaded action method in the derived class has the
059:                // same unqualified action path, causing the path to be reset to a disambiguated
060:                // path that includes the form bean class type. However, in the base class module
061:                // config, the action path does not include the form bean class type. If the
062:                // action path didn't match any in the delegate, try the unqualified path. 
063:                if (_delegate == null) {
064:                    _delegate = (ActionMapping) moduleConfig
065:                            .findActionConfig(super .getUnqualifiedActionPath());
066:                }
067:                assert _delegate != null : "No ActionMapping with path "
068:                        + getPath() + " in module " + _delegateModulePath;
069:            }
070:
071:            /**
072:             * Get the prefix directory path that local paths in Forwards should be relative to.  This is only enabled if we're
073:             * inheriting local paths from a base page flow.
074:             */
075:            public String getLocalPathsRelativeTo() {
076:                return _inheritLocalPaths ? _delegateModulePath : null;
077:            }
078:
079:            public String toString() {
080:                return "[delegate to " + _delegate + ']';
081:            }
082:
083:            public void freeze() {
084:                configured = true;
085:            }
086:
087:            /**
088:             * Tell whether local paths should be inherited from the base class.  This affects the value of
089:             * {@link #getLocalPathsRelativeTo()}.
090:             */
091:            public void setInheritLocalPaths(boolean inheritLocalPaths) {
092:                _inheritLocalPaths = inheritLocalPaths;
093:            }
094:
095:            //
096:            // Attributes that may have been set to override the delegate
097:            //
098:
099:            public String getRoles() {
100:                if (roles != null) {
101:                    return roles;
102:                }
103:                return _delegate.getRoles();
104:            }
105:
106:            //
107:            // Properties that may have been set to override the delegate
108:            //
109:
110:            public boolean isLoginRequired() {
111:                if (_loginRequiredSet) {
112:                    return super .isLoginRequired();
113:                }
114:                return _delegate instanceof  PageFlowActionMapping
115:                        && ((PageFlowActionMapping) _delegate)
116:                                .isLoginRequired();
117:            }
118:
119:            public void setLoginRequired(boolean loginRequired) {
120:                _loginRequiredSet = true;
121:                super .setLoginRequired(loginRequired);
122:            }
123:
124:            public boolean isReadonly() {
125:                if (_readonlySet) {
126:                    return super .isReadonly();
127:                }
128:                return _delegate instanceof  PageFlowActionMapping
129:                        && ((PageFlowActionMapping) _delegate).isReadonly();
130:            }
131:
132:            public void setReadonly(boolean readonly) {
133:                _readonlySet = true;
134:                super .setReadonly(readonly);
135:            }
136:
137:            // If an action level forward does not exist for the delegate then
138:            // look for a global forward of the module config for this action
139:            // mapping. Then, if still not found, look in the module config of
140:            // the delegate.
141:            public ActionForward findForward(String forwardName) {
142:                ForwardConfig config = _delegate.findForwardConfig(forwardName);
143:                if (config == null) {
144:                    config = getModuleConfig().findForwardConfig(forwardName);
145:                }
146:                if (config == null) {
147:                    config = _delegate.getModuleConfig().findForwardConfig(
148:                            forwardName);
149:                }
150:                return (ActionForward) config;
151:            }
152:
153:            //
154:            // Everything below this point is simple delegation.
155:            //
156:
157:            public String getUnqualifiedActionPath() {
158:                return _delegate instanceof  PageFlowActionMapping ? ((PageFlowActionMapping) _delegate)
159:                        .getUnqualifiedActionPath()
160:                        : null;
161:            }
162:
163:            public String getUnqualifiedActionName() {
164:                return _delegate instanceof  PageFlowActionMapping ? ((PageFlowActionMapping) _delegate)
165:                        .getUnqualifiedActionName()
166:                        : null;
167:            }
168:
169:            public boolean isPreventDoubleSubmit() {
170:                return _delegate instanceof  PageFlowActionMapping
171:                        && ((PageFlowActionMapping) _delegate)
172:                                .isPreventDoubleSubmit();
173:            }
174:
175:            public boolean isSimpleAction() {
176:                return _delegate instanceof  PageFlowActionMapping
177:                        && ((PageFlowActionMapping) _delegate).isSimpleAction();
178:            }
179:
180:            public boolean isOverloaded() {
181:                return _delegate instanceof  PageFlowActionMapping
182:                        && ((PageFlowActionMapping) _delegate).isOverloaded();
183:            }
184:
185:            public Map getConditionalForwardsMap() {
186:                return _delegate instanceof  PageFlowActionMapping ? ((PageFlowActionMapping) _delegate)
187:                        .getConditionalForwardsMap()
188:                        : null;
189:            }
190:
191:            public String getFormBeanMessageResourcesKey() {
192:                return _delegate instanceof  PageFlowActionMapping ? ((PageFlowActionMapping) _delegate)
193:                        .getFormBeanMessageResourcesKey()
194:                        : null;
195:            }
196:
197:            public String getDefaultForward() {
198:                return _delegate instanceof  PageFlowActionMapping ? ((PageFlowActionMapping) _delegate)
199:                        .getDefaultForward()
200:                        : null;
201:            }
202:
203:            public String[] findForwards() {
204:                return _delegate.findForwards();
205:            }
206:
207:            public ActionForward getInputForward() {
208:                return _delegate.getInputForward();
209:            }
210:
211:            public String getForward() {
212:                return _delegate.getForward();
213:            }
214:
215:            public String getInclude() {
216:                return _delegate.getInclude();
217:            }
218:
219:            public String getInput() {
220:                return _delegate.getInput();
221:            }
222:
223:            public String getMultipartClass() {
224:                return _delegate.getMultipartClass();
225:            }
226:
227:            public String getPrefix() {
228:                return _delegate.getPrefix();
229:            }
230:
231:            public String[] getRoleNames() {
232:                return _delegate.getRoleNames();
233:            }
234:
235:            public String getScope() {
236:                return _delegate.getScope();
237:            }
238:
239:            public String getSuffix() {
240:                return _delegate.getSuffix();
241:            }
242:
243:            public String getType() {
244:                return _delegate.getType();
245:            }
246:
247:            public boolean getUnknown() {
248:                return _delegate.getUnknown();
249:            }
250:
251:            public boolean getValidate() {
252:                return _delegate.getValidate();
253:            }
254:
255:            public ExceptionConfig findExceptionConfig(String type) {
256:                return _delegate.findExceptionConfig(type);
257:            }
258:
259:            public ExceptionConfig[] findExceptionConfigs() {
260:                return _delegate.findExceptionConfigs();
261:            }
262:
263:            public ExceptionConfig findException(Class type) {
264:                return _delegate.findException(type);
265:            }
266:
267:            public ForwardConfig findForwardConfig(String name) {
268:                return _delegate.findForwardConfig(name);
269:            }
270:
271:            public ForwardConfig[] findForwardConfigs() {
272:                return _delegate.findForwardConfigs();
273:            }
274:
275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.