Source Code Cross Referenced for MergedControllerAnnotation.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » compiler » 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.compiler 
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.compiler;
020:
021:        import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance;
022:        import org.apache.beehive.netui.compiler.typesystem.declaration.ClassDeclaration;
023:        import org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration;
024:        import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
025:
026:        import java.util.Collection;
027:        import java.util.LinkedHashMap;
028:        import java.util.List;
029:        import java.util.Iterator;
030:
031:        /**
032:         * 
033:         */
034:        public class MergedControllerAnnotation implements  JpfLanguageConstants {
035:            private static final String NULL_KEY = "";
036:
037:            private String _strutsMerge;
038:            private String _validatorVersion;
039:            private String _validatorMerge;
040:            private List _tilesDefsConfigs;
041:            private boolean _nested = false;
042:            private boolean _longLived = false;
043:            private List _rolesAllowed;
044:            private List _customValidatorConfigs;
045:            private Boolean _loginRequired = null;
046:            private Boolean _readOnly = null;
047:            private boolean _inheritLocalPaths = false;
048:            private LinkedHashMap _forwards = new LinkedHashMap();
049:            private LinkedHashMap _sharedFlowRefs = new LinkedHashMap();
050:            private LinkedHashMap _catches = new LinkedHashMap();
051:            private LinkedHashMap _simpleActions = new LinkedHashMap();
052:            private LinkedHashMap _validatableBeans = new LinkedHashMap();
053:            private LinkedHashMap _messageResources = new LinkedHashMap();
054:            private LinkedHashMap _messageBundles = new LinkedHashMap();
055:            private String _multipartHandler;
056:
057:            public MergedControllerAnnotation(TypeDeclaration jclass) {
058:                mergeControllerAnnotations(jclass);
059:            }
060:
061:            public void mergeAnnotation(AnnotationInstance controllerAnnotation) {
062:                String strutsMerge = CompilerUtils.getString(
063:                        controllerAnnotation, STRUTSMERGE_ATTR, true);
064:                if (strutsMerge != null)
065:                    _strutsMerge = strutsMerge;
066:
067:                String validatorVersion = CompilerUtils.getEnumFieldName(
068:                        controllerAnnotation, VALIDATOR_VERSION_ATTR, true);
069:                if (validatorVersion != null)
070:                    _validatorVersion = validatorVersion;
071:
072:                String validatorMerge = CompilerUtils.getString(
073:                        controllerAnnotation, VALIDATOR_MERGE_ATTR, true);
074:                if (validatorMerge != null)
075:                    _validatorMerge = validatorMerge;
076:
077:                Boolean nested = CompilerUtils.getBoolean(controllerAnnotation,
078:                        NESTED_ATTR, true);
079:                if (nested != null)
080:                    _nested = nested.booleanValue();
081:
082:                Boolean longLived = CompilerUtils.getBoolean(
083:                        controllerAnnotation, LONGLIVED_ATTR, true);
084:                if (longLived != null)
085:                    _longLived = longLived.booleanValue();
086:
087:                Boolean loginRequired = CompilerUtils.getBoolean(
088:                        controllerAnnotation, LOGIN_REQUIRED_ATTR, true);
089:                if (loginRequired != null)
090:                    _loginRequired = loginRequired;
091:
092:                Boolean readOnly = CompilerUtils.getBoolean(
093:                        controllerAnnotation, READONLY_ATTR, true);
094:                if (readOnly != null)
095:                    _readOnly = readOnly;
096:
097:                Boolean inheritLocalPaths = CompilerUtils.getBoolean(
098:                        controllerAnnotation, INHERIT_LOCAL_PATHS_ATTR, true);
099:                if (inheritLocalPaths != null)
100:                    _inheritLocalPaths = inheritLocalPaths.booleanValue();
101:
102:                _rolesAllowed = mergeStringArray(_rolesAllowed,
103:                        controllerAnnotation, ROLES_ALLOWED_ATTR);
104:                _customValidatorConfigs = mergeStringArray(
105:                        _customValidatorConfigs, controllerAnnotation,
106:                        CUSTOM_VALIDATOR_CONFIGS_ATTR);
107:                _tilesDefsConfigs = mergeStringArray(_tilesDefsConfigs,
108:                        controllerAnnotation, TILES_DEFINITIONS_CONFIGS_ATTR);
109:                mergeAnnotationArray(_forwards, controllerAnnotation,
110:                        FORWARDS_ATTR, NAME_ATTR);
111:                mergeAnnotationArray(_sharedFlowRefs, controllerAnnotation,
112:                        SHARED_FLOW_REFS_ATTR, NAME_ATTR);
113:                mergeAnnotationArray(_catches, controllerAnnotation,
114:                        CATCHES_ATTR, TYPE_ATTR);
115:                mergeAnnotationArray(_simpleActions, controllerAnnotation,
116:                        SIMPLE_ACTIONS_ATTR, NAME_ATTR);
117:                mergeAnnotationArray(_validatableBeans, controllerAnnotation,
118:                        VALIDATABLE_BEANS_ATTR, TYPE_ATTR);
119:                mergeAnnotationArray(_messageBundles, controllerAnnotation,
120:                        MESSAGE_BUNDLES_ATTR, BUNDLE_NAME_ATTR);
121:
122:                String multipartHandler = CompilerUtils.getEnumFieldName(
123:                        controllerAnnotation, MULTIPART_HANDLER_ATTR, true);
124:                if (multipartHandler != null)
125:                    _multipartHandler = multipartHandler;
126:            }
127:
128:            private static List mergeStringArray(List memberList,
129:                    AnnotationInstance parentAnnotation, String attr) {
130:                List newList = CompilerUtils.getStringArray(parentAnnotation,
131:                        attr, true);
132:
133:                if (newList != null) {
134:                    if (memberList == null)
135:                        return newList;
136:                    memberList.addAll(newList);
137:                }
138:
139:                return memberList;
140:            }
141:
142:            private static void mergeAnnotationArray(LinkedHashMap keyedList,
143:                    AnnotationInstance parentAnnotation, String attr,
144:                    String keyAttr) {
145:                List annotations = CompilerUtils.getAnnotationArray(
146:                        parentAnnotation, attr, true);
147:
148:                if (annotations != null) {
149:                    for (Iterator ii = annotations.iterator(); ii.hasNext();) {
150:                        AnnotationInstance ann = (AnnotationInstance) ii.next();
151:                        Object key = CompilerUtils.getAnnotationValue(ann,
152:                                keyAttr, true);
153:                        if (key != null) {
154:                            keyedList.put(key.toString(), ann);
155:                        } else {
156:                            keyedList.put(NULL_KEY, ann);
157:                        }
158:                    }
159:                }
160:            }
161:
162:            public String getStrutsMerge() {
163:                return _strutsMerge;
164:            }
165:
166:            public String getValidatorVersion() {
167:                return _validatorVersion;
168:            }
169:
170:            public String getValidatorMerge() {
171:                return _validatorMerge;
172:            }
173:
174:            public List getTilesDefinitionsConfigs() {
175:                return _tilesDefsConfigs;
176:            }
177:
178:            public boolean isNested() {
179:                return _nested;
180:            }
181:
182:            public boolean isLongLived() {
183:                return _longLived;
184:            }
185:
186:            public List getRolesAllowed() {
187:                return _rolesAllowed;
188:            }
189:
190:            public List getCustomValidatorConfigs() {
191:                return _customValidatorConfigs;
192:            }
193:
194:            public Boolean isLoginRequired() {
195:                return _loginRequired;
196:            }
197:
198:            public Boolean isReadOnly() {
199:                return _readOnly;
200:            }
201:
202:            public boolean isInheritLocalPaths() {
203:                return _inheritLocalPaths;
204:            }
205:
206:            public Collection getForwards() {
207:                return _forwards.values();
208:            }
209:
210:            public Collection getSharedFlowRefs() {
211:                return _sharedFlowRefs.values();
212:            }
213:
214:            public Collection getCatches() {
215:                return _catches.values();
216:            }
217:
218:            public Collection getSimpleActions() {
219:                return _simpleActions.values();
220:            }
221:
222:            public Collection getValidatableBeans() {
223:                return _validatableBeans.values();
224:            }
225:
226:            public Collection getMessageResources() {
227:                return _messageResources.values();
228:            }
229:
230:            public Collection getMessageBundles() {
231:                return _messageBundles.values();
232:            }
233:
234:            public String getMultipartHandler() {
235:                return _multipartHandler;
236:            }
237:
238:            private void mergeControllerAnnotations(TypeDeclaration jclass) {
239:                //
240:                // Merge in all the controller annotations, starting with the most remote superclass first.
241:                //
242:                if (jclass != null && jclass instanceof  ClassDeclaration) {
243:                    ClassType super Class = ((ClassDeclaration) jclass)
244:                            .getSuperclass();
245:                    if (super Class != null)
246:                        mergeControllerAnnotations(super Class.getDeclaration());
247:                    AnnotationInstance controllerAnnotation = CompilerUtils
248:                            .getAnnotation(jclass, CONTROLLER_TAG_NAME);
249:                    if (controllerAnnotation != null)
250:                        mergeAnnotation(controllerAnnotation);
251:                }
252:            }
253:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.