Source Code Cross Referenced for EjbJarAnnotationMetadata.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » deployment » annotations » metadata » 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.metadata 
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: EjbJarAnnotationMetadata.java 2059 2007-11-22 17:22:33Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.deployment.annotations.metadata;
025:
026:        import java.util.Collection;
027:        import java.util.HashMap;
028:        import java.util.List;
029:        import java.util.Map;
030:
031:        import javax.ejb.ApplicationException;
032:
033:        import org.ow2.easybeans.deployment.annotations.InterceptorType;
034:        import org.ow2.easybeans.deployment.annotations.JClassInterceptor;
035:        import org.ow2.easybeans.deployment.annotations.impl.JApplicationException;
036:        import org.ow2.easybeans.deployment.annotations.impl.JCommonBean;
037:        import org.ow2.easybeans.deployment.annotations.impl.JInterceptors;
038:        import org.ow2.easybeans.deployment.xml.struct.EJB3;
039:        import org.ow2.util.log.Log;
040:        import org.ow2.util.log.LogFactory;
041:
042:        /**
043:         * This class represents the annotation metadata of all classes of an EjbJar
044:         * file. From this class, we can get metadata of all beans.
045:         * @author Florent Benoit
046:         */
047:        public class EjbJarAnnotationMetadata {
048:
049:            /**
050:             * Logger.
051:             */
052:            private static Log logger = LogFactory
053:                    .getLog(EjbJarAnnotationMetadata.class);
054:
055:            /**
056:             * List of class annotations metadata.
057:             */
058:            private Map<String, ClassAnnotationMetadata> classesAnnotationMetadata = null;
059:
060:            /**
061:             * Link to the Deployment Descriptor object.
062:             */
063:            private EJB3 ejb3 = null;
064:
065:            /**
066:             * List of application exceptions used on this ejb-jar.
067:             */
068:            private Map<String, ApplicationException> applicationExceptions = null;
069:
070:            /**
071:             * List of default interceptors by type (business or lifecycle).
072:             */
073:            private Map<InterceptorType, List<JClassInterceptor>> defaultInterceptors = null;
074:
075:            /**
076:             * List of default interceptors classes.
077:             */
078:            private JInterceptors defaultInterceptorsClasses = null;
079:
080:            /**
081:             * Constructor.
082:             */
083:            public EjbJarAnnotationMetadata() {
084:                classesAnnotationMetadata = new HashMap<String, ClassAnnotationMetadata>();
085:            }
086:
087:            /**
088:             * Add annotation metadata for a given class.
089:             * @param classAnnotationMetadata annotation metadata of a class.
090:             */
091:            public void addClassAnnotationMetadata(
092:                    final ClassAnnotationMetadata classAnnotationMetadata) {
093:                String key = classAnnotationMetadata.getClassName();
094:                // already exists ?
095:                if (classesAnnotationMetadata.containsKey(key)) {
096:                    String msg = logger
097:                            .getI18n()
098:                            .getMessage(
099:                                    "EjbJarAnnotationMetadata.addClassAnnotationMetadata.alreadyPresent",
100:                                    key);
101:                    logger.debug(msg);
102:                    throw new IllegalStateException(msg);
103:                }
104:                classesAnnotationMetadata.put(key, classAnnotationMetadata);
105:            }
106:
107:            /**
108:             * Gets the class metadata for the given ejb-name.
109:             * @return class metadata or null if not found
110:             * @param ejbName the name of the EJB.
111:             */
112:            public ClassAnnotationMetadata getClassAnnotationMetadataForEjbName(
113:                    final String ejbName) {
114:                for (ClassAnnotationMetadata metadata : classesAnnotationMetadata
115:                        .values()) {
116:                    JCommonBean bean = metadata.getJCommonBean();
117:                    if (bean != null && ejbName.equals(bean.getName())) {
118:                        return metadata;
119:                    }
120:                }
121:                return null;
122:            }
123:
124:            /**
125:             * Get class annotation metadata.
126:             * @param className key of the map of annotations bean.
127:             * @return Bean annotation metadata of a given name.
128:             */
129:            public ClassAnnotationMetadata getClassAnnotationMetadata(
130:                    final String className) {
131:                return classesAnnotationMetadata.get(className);
132:            }
133:
134:            /**
135:             * Get collections of bean annotation metadata.
136:             * @return collections of bean annotation metadata.
137:             */
138:            public Collection<ClassAnnotationMetadata> getClassAnnotationMetadataCollection() {
139:                return classesAnnotationMetadata.values();
140:            }
141:
142:            /**
143:             * @return the ejb3 deployment descriptor object.
144:             */
145:            public EJB3 getEjb3() {
146:                return ejb3;
147:            }
148:
149:            /**
150:             * Sets the ejb3 deployment descriptor object.
151:             * @param ejb3 the ejb3 deployment descriptor object.
152:             */
153:            public void setEjb3(final EJB3 ejb3) {
154:                this .ejb3 = ejb3;
155:            }
156:
157:            /**
158:             * Gets the list of application exceptions defined on this ejb jar metadata.
159:             * @return the list of application exceptions defined on this ejb jar
160:             *         metadata.
161:             */
162:            public Map<String, ApplicationException> getApplicationExceptions() {
163:                if (applicationExceptions != null) {
164:                    return applicationExceptions;
165:                }
166:
167:                // compute it
168:                applicationExceptions = new HashMap<String, ApplicationException>();
169:
170:                // For each class, look if it is an application exception
171:                for (ClassAnnotationMetadata classMetadata : getClassAnnotationMetadataCollection()) {
172:                    ApplicationException appException = classMetadata
173:                            .getApplicationException();
174:                    // found it then add it in the map.
175:                    if (appException != null) {
176:                        applicationExceptions.put(classMetadata.getClassName()
177:                                .replaceAll("/", "."), appException);
178:                    }
179:                }
180:
181:                // Add a default application exception (for checked exception)
182:                applicationExceptions.put("DEFAULT",
183:                        new JApplicationException());
184:
185:                return applicationExceptions;
186:            }
187:
188:            /**
189:             * @return Map&lt;interceptor type &lt;--&gt; List of methods/class corresponding to the interceptor&gt; (interceptor classes)
190:             * of default interceptors that enhancer will use.
191:             */
192:            public Map<InterceptorType, List<JClassInterceptor>> getDefaultInterceptors() {
193:                return defaultInterceptors;
194:            }
195:
196:            /**
197:             * Sets the list of default interceptors that enhancers will use.<br>
198:             * These interceptors are defined by XML DD.
199:             * @param defaultInterceptors list of interceptors that enhancer will use.
200:             */
201:            public void setDefaultInterceptors(
202:                    final Map<InterceptorType, List<JClassInterceptor>> defaultInterceptors) {
203:                this .defaultInterceptors = defaultInterceptors;
204:            }
205:
206:            /**
207:             * @return object representing list of default interceptor classes.
208:             */
209:            public JInterceptors getDefaultInterceptorsClasses() {
210:                return defaultInterceptorsClasses;
211:            }
212:
213:            /**
214:             * Sets the object representing the default interceptor classes.
215:             * @param defaultInterceptorsClasses list of classes
216:             */
217:            public void setDefaultInterceptorsClasses(
218:                    final JInterceptors defaultInterceptorsClasses) {
219:                this.defaultInterceptorsClasses = defaultInterceptorsClasses;
220:            }
221:
222:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.