Source Code Cross Referenced for Module.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » j2ee » deployment » 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 » EJB Server geronimo » plugins » org.apache.geronimo.j2ee.deployment 
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:         */package org.apache.geronimo.j2ee.deployment;
017:
018:        import java.util.jar.JarFile;
019:        import java.util.Map;
020:        import java.util.HashMap;
021:        import java.net.URI;
022:
023:        import org.apache.xmlbeans.XmlObject;
024:        import org.apache.geronimo.kernel.config.ConfigurationModuleType;
025:        import org.apache.geronimo.kernel.repository.Environment;
026:        import org.apache.geronimo.kernel.repository.Artifact;
027:        import org.apache.geronimo.deployment.util.DeploymentUtil;
028:        import org.apache.geronimo.gbean.AbstractName;
029:        import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
030:        import org.apache.xbean.finder.ClassFinder;
031:
032:        /**
033:         * @version $Rev: 538730 $ $Date: 2007-05-16 14:07:51 -0700 (Wed, 16 May 2007) $
034:         */
035:        public abstract class Module {
036:            private final boolean standAlone;
037:
038:            private final AbstractName moduleName;
039:            private final String name;
040:            private final Environment environment;
041:            private final URI moduleURI;
042:            private final JarFile moduleFile;
043:            private final String targetPath;
044:            private final URI targetPathURI;
045:            private final XmlObject vendorDD;
046:            private final String namespace;
047:
048:            private EARContext earContext;
049:            private EARContext rootEarContext;
050:            private XmlObject specDD;
051:            private String originalSpecDD;
052:            private AnnotatedApp annotatedApp;
053:            private ClassFinder classFinder;
054:
055:            protected final Map sharedContext = new HashMap();
056:
057:            protected Module(boolean standAlone, AbstractName moduleName,
058:                    Environment environment, JarFile moduleFile,
059:                    String targetPath, XmlObject specDD, XmlObject vendorDD,
060:                    String originalSpecDD, String namespace,
061:                    AnnotatedApp annotatedApp) {
062:                assert targetPath != null : "targetPath is null";
063:                assert moduleName != null : "moduleName is null";
064:
065:                this .standAlone = standAlone;
066:                this .moduleName = moduleName;
067:                this .environment = environment;
068:                this .moduleFile = moduleFile;
069:                this .targetPath = targetPath;
070:                this .specDD = specDD;
071:                this .vendorDD = vendorDD;
072:                this .originalSpecDD = originalSpecDD;
073:                this .namespace = namespace;
074:
075:                if (standAlone) {
076:                    name = environment.getConfigId().toString();
077:                    moduleURI = URI.create("");
078:                } else {
079:                    name = targetPath;
080:                    moduleURI = URI.create(targetPath);
081:                }
082:
083:                targetPathURI = URI.create(targetPath + "/");
084:                this .annotatedApp = annotatedApp;
085:            }
086:
087:            public abstract ConfigurationModuleType getType();
088:
089:            public String getName() {
090:                return name;
091:            }
092:
093:            public boolean isStandAlone() {
094:                return standAlone;
095:            }
096:
097:            public AbstractName getModuleName() {
098:                return moduleName;
099:            }
100:
101:            public Environment getEnvironment() {
102:                return environment;
103:            }
104:
105:            public URI getModuleURI() {
106:                return moduleURI;
107:            }
108:
109:            public JarFile getModuleFile() {
110:                return moduleFile;
111:            }
112:
113:            public String getTargetPath() {
114:                return targetPath;
115:            }
116:
117:            public URI getTargetPathURI() {
118:                return targetPathURI;
119:            }
120:
121:            public XmlObject getSpecDD() {
122:                return specDD;
123:            }
124:
125:            public XmlObject getVendorDD() {
126:                return vendorDD;
127:            }
128:
129:            public String getOriginalSpecDD() {
130:                return originalSpecDD;
131:            }
132:
133:            public String getNamespace() {
134:                return namespace;
135:            }
136:
137:            public int hashCode() {
138:                return name.hashCode();
139:            }
140:
141:            public boolean equals(Object obj) {
142:                if (obj == this ) {
143:                    return true;
144:                }
145:                if (obj instanceof  Module) {
146:                    Module module = (Module) obj;
147:                    return name.equals(module.name);
148:                }
149:                return false;
150:            }
151:
152:            public void close() {
153:                DeploymentUtil.close(moduleFile);
154:            }
155:
156:            public EARContext getEarContext() {
157:                return earContext;
158:            }
159:
160:            public void setEarContext(EARContext earContext) {
161:                this .earContext = earContext;
162:            }
163:
164:            public EARContext getRootEarContext() {
165:                return rootEarContext;
166:            }
167:
168:            public void setRootEarContext(EARContext rootEarContext) {
169:                this .rootEarContext = rootEarContext;
170:            }
171:
172:            public Map getSharedContext() {
173:                return sharedContext;
174:            }
175:
176:            public void setSpecDD(XmlObject specDD) {
177:                this .specDD = specDD;
178:            }
179:
180:            public void setOriginalSpecDD(String originalSpecDD) {
181:                this .originalSpecDD = originalSpecDD;
182:            }
183:
184:            public AnnotatedApp getAnnotatedApp() {
185:                return annotatedApp;
186:            }
187:
188:            public void setAnnotatedApp(AnnotatedApp annotatedApp) {
189:                this .annotatedApp = annotatedApp;
190:            }
191:
192:            public ClassFinder getClassFinder() {
193:                return classFinder;
194:            }
195:
196:            public void setClassFinder(ClassFinder classFinder) {
197:                this .classFinder = classFinder;
198:            }
199:
200:            public Artifact[] getConfigId() {
201:                if (earContext == null) {
202:                    throw new NullPointerException("No ear context set");
203:                }
204:                if (rootEarContext == null
205:                        || rootEarContext == earContext
206:                        || rootEarContext.getConfigID().equals(
207:                                earContext.getConfigID())) {
208:                    return new Artifact[] { earContext.getConfigID() };
209:                }
210:                return new Artifact[] { rootEarContext.getConfigID(),
211:                        earContext.getConfigID() };
212:            }
213:
214:            /**
215:             * Given a path in the ear module, return something that will resolve to that location against the eventual configuration
216:             * base uri.  Currently for all modules except wars that is the original path.  If we create separate configurations for
217:             * ejb or rar modules, those Module subclasses will need to reimplement this method.
218:             *
219:             * Example:  if a war is myweb.war, and you pass in myweb.war/WEB-INF/lib/foo.jar, you get WEB-INF/lib/foo.jar
220:             * if you pass in myFoo.jar, you get ../myFoo.jar
221:             *
222:             * @param path a path in the ear config, relative to the ear root.
223:             * @return a path to the same location, but relative to the configuration this module represents' base uri.
224:             */
225:            public String getRelativePath(String path) {
226:                return path;
227:            }
228:
229:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.