Source Code Cross Referenced for JavaxEjbMessageDrivenVisitor.java in  » Testing » Ejb3Unit » com » bm » ejb3metadata » annotations » analyzer » classes » 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 » Testing » Ejb3Unit » com.bm.ejb3metadata.annotations.analyzer.classes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bm.ejb3metadata.annotations.analyzer.classes;
002:
003:        import static com.bm.ejb3metadata.annotations.ClassType.MDB;
004:
005:        import org.ejb3unit.asm.AnnotationVisitor;
006:        import org.ejb3unit.asm.Type;
007:        import org.ejb3unit.asm.commons.EmptyVisitor;
008:
009:        import com.bm.ejb3metadata.annotations.analyzer.AnnotationType;
010:        import com.bm.ejb3metadata.annotations.impl.JActivationConfigProperty;
011:        import com.bm.ejb3metadata.annotations.impl.JMessageDriven;
012:        import com.bm.ejb3metadata.annotations.metadata.ClassAnnotationMetadata;
013:
014:        /**
015:         * This class manages the handling of @{@link javax.ejb.MessageDriven}
016:         * annotation.
017:         * @author Daniel Wiese
018:         */
019:        public class JavaxEjbMessageDrivenVisitor extends
020:                AbsCommonEjbVisitor<JMessageDriven> implements  AnnotationType {
021:
022:            /**
023:             * Type of annotation.
024:             */
025:            public static final String TYPE = "Ljavax/ejb/MessageDriven;";
026:
027:            /**
028:             * messageListenerInterface attribute of the annotation.
029:             */
030:            private static final String MESSAGE_LISTENER_INTERFACE = "messageListenerInterface";
031:
032:            /**
033:             * activationConfig attribute of the annotation.
034:             */
035:            private static final String ACTIVATION_CONFIG = "activationConfig";
036:
037:            /**
038:             * Message listener Interface.
039:             */
040:            private String messageListenerInterface = null;
041:
042:            /**
043:             * Constructor.
044:             * @param classAnnotationMetadata linked to a class metadata
045:             */
046:            public JavaxEjbMessageDrivenVisitor(
047:                    final ClassAnnotationMetadata classAnnotationMetadata) {
048:                super (classAnnotationMetadata);
049:            }
050:
051:            /**
052:             * Visits a primitive value of the annotation.<br>
053:             * @param name the value name.
054:             * @param value the actual value, whose type must be {@link Byte},
055:             *        {@link Boolean}, {@link Character}, {@link Short},
056:             *        {@link Integer}, {@link Long}, {@link Float}, {@link Double},
057:             *        {@link String} or {@link Type}.
058:             */
059:            @Override
060:            public void visit(final String name, final Object value) {
061:                super .visit(name, value);
062:                if (name.equals(MESSAGE_LISTENER_INTERFACE)) {
063:                    this .messageListenerInterface = ((Type) value)
064:                            .getInternalName();
065:                }
066:            }
067:
068:            /**
069:             * Visits an enumeration value of the annotation.
070:             * @param name the value name.
071:             * @param desc the class descriptor of the enumeration class.
072:             * @param value the actual enumeration value.
073:             */
074:            @Override
075:            public void visitEnum(final String name, final String desc,
076:                    final String value) {
077:
078:            }
079:
080:            /**
081:             * Visits a nested annotation value of the annotation.
082:             * @param name the value name.
083:             * @param desc the class descriptor of the nested annotation class.
084:             * @return a non null visitor to visit the actual nested annotation value.
085:             *         <i>The nested annotation value must be fully visited before
086:             *         calling other methods on this annotation visitor</i>.
087:             */
088:            @Override
089:            public AnnotationVisitor visitAnnotation(final String name,
090:                    final String desc) {
091:                return this ;
092:            }
093:
094:            /**
095:             * Visits an array value of the annotation.
096:             * @param name the value name.
097:             * @return a non null visitor to visit the actual array value elements. The
098:             *         'name' parameters passed to the methods of this visitor are
099:             *         ignored. <i>All the array values must be visited before calling
100:             *         other methods on this annotation visitor</i>.
101:             */
102:            @Override
103:            public AnnotationVisitor visitArray(final String name) {
104:                if (name.equals(ACTIVATION_CONFIG)) {
105:                    return new ActivationConfigPropertyVisitor();
106:                }
107:                return this ;
108:            }
109:
110:            /**
111:             * Visits the end of the annotation. Creates the object and store it
112:             */
113:            @Override
114:            public void visitEnd() {
115:                super .visitEnd();
116:
117:                // message listener interface
118:                getJCommonBean().setMessageListenerInterface(
119:                        messageListenerInterface);
120:
121:                // Set type
122:                getAnnotationMetadata().setClassType(MDB);
123:
124:            }
125:
126:            /**
127:             * @return type of the annotation (its description)
128:             */
129:            public String getType() {
130:                return TYPE;
131:            }
132:
133:            /**
134:             * Classes manages the parsing of activationConfig[] array of &#64;{@link javax.ejb.MessageDriven}
135:             * annotation.
136:             * @author Florent Benoit
137:             */
138:            class ActivationConfigPropertyVisitor extends EmptyVisitor {
139:
140:                /**
141:                 * Attribute for property name.
142:                 */
143:                private static final String PROPERTY_NAME = "propertyName";
144:
145:                /**
146:                 * Attribute for property value.
147:                 */
148:                private static final String PROPERTY_VALUE = "propertyValue";
149:
150:                /**
151:                 * Property name.
152:                 */
153:                private String propertyName = null;
154:
155:                /**
156:                 * Property value.
157:                 */
158:                private String propertyValue = null;
159:
160:                /**
161:                 * Visits a primitive value of the annotation.
162:                 * @param name the value name.
163:                 * @param value the actual value, whose type must be {@link Byte},
164:                 *        {@link Boolean}, {@link Character}, {@link Short},
165:                 *        {@link Integer}, {@link Long}, {@link Float},
166:                 *        {@link Double}, {@link String} or {@link Type}.
167:                 */
168:                @Override
169:                public void visit(final String name, final Object value) {
170:                    if (name.equals(PROPERTY_NAME)) {
171:                        propertyName = (String) value;
172:                    } else if (name.equals(PROPERTY_VALUE)) {
173:                        propertyValue = (String) value;
174:                    }
175:                }
176:
177:                /**
178:                 * Visits the end of the annotation. Creates the object and store it
179:                 */
180:                @Override
181:                public void visitEnd() {
182:                    // Add an activation property
183:                    JActivationConfigProperty jActivationConfigProperty = new JActivationConfigProperty(
184:                            propertyName, propertyValue);
185:                    getJCommonBean().addActivationConfigProperty(
186:                            jActivationConfigProperty);
187:
188:                }
189:            }
190:
191:            /**
192:             * @return the object representing common bean.
193:             */
194:            @Override
195:            public JMessageDriven getJCommonBean() {
196:                JMessageDriven jMessageDriven = getAnnotationMetadata()
197:                        .getJMessageDriven();
198:                if (jMessageDriven == null) {
199:                    jMessageDriven = new JMessageDriven();
200:                    getAnnotationMetadata().setJMessageDriven(jMessageDriven);
201:                }
202:                return jMessageDriven;
203:            }
204:
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.