Source Code Cross Referenced for JavaxEjbMessageDrivenVisitor.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » deployment » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.deployment.annotations.analyzer.classes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JavaxEjbMessageDrivenVisitor.java 2057 2007-11-21 15:35:32Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.deployment.annotations.analyzer.classes;
025:
026:        import static org.ow2.easybeans.deployment.annotations.ClassType.MDB;
027:
028:        import org.ow2.easybeans.asm.AnnotationVisitor;
029:        import org.ow2.easybeans.asm.Type;
030:        import org.ow2.easybeans.asm.commons.EmptyVisitor;
031:
032:        import org.ow2.easybeans.deployment.annotations.analyzer.AnnotationType;
033:        import org.ow2.easybeans.deployment.annotations.impl.JActivationConfigProperty;
034:        import org.ow2.easybeans.deployment.annotations.impl.JMessageDriven;
035:        import org.ow2.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata;
036:
037:        /**
038:         * This class manages the handling of @{@link javax.ejb.MessageDriven}
039:         * annotation.
040:         * @author Florent Benoit
041:         */
042:        public class JavaxEjbMessageDrivenVisitor extends
043:                AbsCommonEjbVisitor<JMessageDriven> implements  AnnotationType {
044:
045:            /**
046:             * Type of annotation.
047:             */
048:            public static final String TYPE = "Ljavax/ejb/MessageDriven;";
049:
050:            /**
051:             * messageListenerInterface attribute of the annotation.
052:             */
053:            private static final String MESSAGE_LISTENER_INTERFACE = "messageListenerInterface";
054:
055:            /**
056:             * activationConfig attribute of the annotation.
057:             */
058:            private static final String ACTIVATION_CONFIG = "activationConfig";
059:
060:            /**
061:             * Message listener Interface.
062:             */
063:            private String messageListenerInterface = null;
064:
065:            /**
066:             * Constructor.
067:             * @param classAnnotationMetadata linked to a class metadata
068:             */
069:            public JavaxEjbMessageDrivenVisitor(
070:                    final ClassAnnotationMetadata classAnnotationMetadata) {
071:                super (classAnnotationMetadata);
072:            }
073:
074:            /**
075:             * Visits a primitive value of the annotation.<br>
076:             * @param name the value name.
077:             * @param value the actual value, whose type must be {@link Byte},
078:             *        {@link Boolean}, {@link Character}, {@link Short},
079:             *        {@link Integer}, {@link Long}, {@link Float}, {@link Double},
080:             *        {@link String} or {@link Type}.
081:             */
082:            @Override
083:            public void visit(final String name, final Object value) {
084:                super .visit(name, value);
085:                if (name.equals(MESSAGE_LISTENER_INTERFACE)) {
086:                    this .messageListenerInterface = ((Type) value)
087:                            .getInternalName();
088:                }
089:            }
090:
091:            /**
092:             * Visits an enumeration value of the annotation.
093:             * @param name the value name.
094:             * @param desc the class descriptor of the enumeration class.
095:             * @param value the actual enumeration value.
096:             */
097:            @Override
098:            public void visitEnum(final String name, final String desc,
099:                    final String value) {
100:
101:            }
102:
103:            /**
104:             * Visits a nested annotation value of the annotation.
105:             * @param name the value name.
106:             * @param desc the class descriptor of the nested annotation class.
107:             * @return a non null visitor to visit the actual nested annotation value.
108:             *         <i>The nested annotation value must be fully visited before
109:             *         calling other methods on this annotation visitor</i>.
110:             */
111:            @Override
112:            public AnnotationVisitor visitAnnotation(final String name,
113:                    final String desc) {
114:                return this ;
115:            }
116:
117:            /**
118:             * Visits an array value of the annotation.
119:             * @param name the value name.
120:             * @return a non null visitor to visit the actual array value elements. The
121:             *         'name' parameters passed to the methods of this visitor are
122:             *         ignored. <i>All the array values must be visited before calling
123:             *         other methods on this annotation visitor</i>.
124:             */
125:            @Override
126:            public AnnotationVisitor visitArray(final String name) {
127:                if (name.equals(ACTIVATION_CONFIG)) {
128:                    return new ActivationConfigPropertyVisitor();
129:                }
130:                return this ;
131:            }
132:
133:            /**
134:             * Visits the end of the annotation. Creates the object and store it
135:             */
136:            @Override
137:            public void visitEnd() {
138:                super .visitEnd();
139:
140:                // message listener interface
141:                getJCommonBean().setMessageListenerInterface(
142:                        messageListenerInterface);
143:
144:                // Set type
145:                getAnnotationMetadata().setClassType(MDB);
146:
147:            }
148:
149:            /**
150:             * @return type of the annotation (its description)
151:             */
152:            public String getType() {
153:                return TYPE;
154:            }
155:
156:            /**
157:             * Classes manages the parsing of activationConfig[] array of &#64;{@link javax.ejb.MessageDriven}
158:             * annotation.
159:             * @author Florent Benoit
160:             */
161:            class ActivationConfigPropertyVisitor extends EmptyVisitor {
162:
163:                /**
164:                 * Attribute for property name.
165:                 */
166:                private static final String PROPERTY_NAME = "propertyName";
167:
168:                /**
169:                 * Attribute for property value.
170:                 */
171:                private static final String PROPERTY_VALUE = "propertyValue";
172:
173:                /**
174:                 * Property name.
175:                 */
176:                private String propertyName = null;
177:
178:                /**
179:                 * Property value.
180:                 */
181:                private String propertyValue = null;
182:
183:                /**
184:                 * Visits a primitive value of the annotation.
185:                 * @param name the value name.
186:                 * @param value the actual value, whose type must be {@link Byte},
187:                 *        {@link Boolean}, {@link Character}, {@link Short},
188:                 *        {@link Integer}, {@link Long}, {@link Float},
189:                 *        {@link Double}, {@link String} or {@link Type}.
190:                 */
191:                @Override
192:                public void visit(final String name, final Object value) {
193:                    if (name.equals(PROPERTY_NAME)) {
194:                        propertyName = (String) value;
195:                    } else if (name.equals(PROPERTY_VALUE)) {
196:                        propertyValue = (String) value;
197:                    }
198:                }
199:
200:                /**
201:                 * Visits the end of the annotation. Creates the object and store it
202:                 */
203:                @Override
204:                public void visitEnd() {
205:                    // Add an activation property
206:                    JActivationConfigProperty jActivationConfigProperty = new JActivationConfigProperty(
207:                            propertyName, propertyValue);
208:                    getJCommonBean().addActivationConfigProperty(
209:                            jActivationConfigProperty);
210:
211:                }
212:            }
213:
214:            /**
215:             * @return the object representing common bean.
216:             */
217:            @Override
218:            public JMessageDriven getJCommonBean() {
219:                JMessageDriven jMessageDriven = getAnnotationMetadata()
220:                        .getJMessageDriven();
221:                if (jMessageDriven == null) {
222:                    jMessageDriven = new JMessageDriven();
223:                    getAnnotationMetadata().setJMessageDriven(jMessageDriven);
224:                }
225:                return jMessageDriven;
226:            }
227:
228:        }
w_ww___._j___a_v_a___2__s.___c__o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.