geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r232768 - in /geronimo/trunk/modules: client-builder/src/java/org/apache/geronimo/client/builder/ j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ j2ee-builder/src/schema/
Date Mon, 15 Aug 2005 07:36:14 GMT
Author: djencks
Date: Mon Aug 15 00:36:08 2005
New Revision: 232768

URL: http://svn.apache.org/viewcvs?rev=232768&view=rev
Log:
GERONIMO-719. You can add any additional modules to an ear, whether they are in the original
ear or elsewhere.

Modified:
    geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/schema/geronimo-application.xsd

Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=232768&r1=232767&r2=232768&view=diff
==============================================================================
--- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Mon Aug 15 00:36:08 2005
@@ -396,7 +396,7 @@
                             String path;
                             JarFile connectorFile;
                             if (resource.isSetExternalRar()) {
-                                path = resource.getExternalRar();
+                                path = resource.getExternalRar().trim();
                                 URI pathURI = null;
                                 try {
                                     pathURI = new URI(path);

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=232768&r1=232767&r2=232768&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Mon Aug 15 00:36:08 2005
@@ -58,6 +58,7 @@
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerApplicationDocument;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerApplicationType;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerModuleType;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerExtModuleType;
 import org.apache.geronimo.xbeans.j2ee.ApplicationType;
 import org.apache.geronimo.xbeans.j2ee.ModuleType;
 import org.apache.xmlbeans.XmlCursor;
@@ -218,7 +219,7 @@
         try {
             addModules(earFile, application, gerApplication, moduleLocations, modules);
         } catch (Throwable e) {
-            // close al the modules
+            // close all the modules
             for (Iterator iterator = modules.iterator(); iterator.hasNext();) {
                 Module module = (Module) iterator.next();
                 module.close();
@@ -523,12 +524,136 @@
                     throw new DeploymentException("Module was not " + moduleTypeName + ":
" + modulePath);
                 }
 
-//                if (module instanceof WebModule) {
-//                    ((WebModule) module).setContextRoot(moduleXml.getWeb().getContextRoot().getStringValue());
+                modules.add(module);
+            }
+
+            //deploy the extension modules
+            GerExtModuleType gerExtModuleTypes[] = gerApplication.getExtModuleArray();
+            for (int i = 0; i < gerExtModuleTypes.length; i++) {
+                GerExtModuleType gerExtModule = gerExtModuleTypes[i];
+                String moduleName = null;
+                ModuleBuilder builder;
+                Object moduleContextInfo = null;
+                String moduleTypeName;
+
+                if (gerExtModule.isSetEjb()) {
+                    moduleName = gerExtModule.getEjb().getStringValue();
+                    if (ejbConfigBuilder == null) {
+                        throw new DeploymentException("Cannot deploy ejb application; No
ejb deployer defined: " + moduleName);
+                    }
+                    builder = ejbConfigBuilder;
+                    moduleTypeName = "an EJB";
+                } else if (gerExtModule.isSetWeb()) {
+                    moduleName = gerExtModule.getWeb().getStringValue();
+                    if (webConfigBuilder == null) {
+                        throw new DeploymentException("Cannot deploy web application; No
war deployer defined: " + moduleName);
+                    }
+                    builder = webConfigBuilder;
+                    moduleTypeName = "a war";
+                    //ext modules must use vendor plan to set context-root
+//                    moduleContextInfo = gerExtModule.getWeb().getContextRoot().getStringValue().trim();
+                } else if (gerExtModule.isSetConnector()) {
+                    moduleName = gerExtModule.getConnector().getStringValue();
+                    if (connectorConfigBuilder == null) {
+                        throw new DeploymentException("Cannot deploy resource adapter; No
rar deployer defined: " + moduleName);
+                    }
+                    builder = connectorConfigBuilder;
+                    moduleTypeName = "a connector";
+                } else if (gerExtModule.isSetJava()) {
+                    moduleName = gerExtModule.getJava().getStringValue();
+                    if (appClientConfigBuilder == null) {
+                        throw new DeploymentException("Cannot deploy app client; No app client
deployer defined: " + moduleName);
+                    }
+                    builder = appClientConfigBuilder;
+                    moduleTypeName = "an application client";
+                } else {
+                    throw new DeploymentException("Could not find a module builder for module:
" + gerExtModule);
+                }
+                Object altVendorDD;
+                if (gerExtModule.isSetAltDd()) {
+                    // the the url of the alt dd
+                    try {
+                        altVendorDD =  DeploymentUtil.toTempFile(earFile, gerExtModule.getAltDd().getStringValue());
+                        altVendorDDs.put(moduleName, altVendorDD);
+                    } catch (IOException e) {
+                        throw new DeploymentException("Invalid alt vendor dd url: " + gerExtModule.getAltDd().getStringValue(),
e);
+                    }
+                } else {
+                    //dd is included explicitly
+                    XmlCursor cursor = gerExtModule.newCursor();
+                    try {
+                        cursor.toFirstChild();
+                        cursor.toNextSibling();
+                        //should be at the "any" element
+                        XmlObject any = cursor.getObject();
+                        altVendorDD = any;
+                    } finally {
+                        cursor.dispose();
+                    }
+                }
+
+                JarFile moduleFile = null;
+                if (gerExtModule.isSetInternalPath()) {
+                    String modulePath = gerExtModule.getInternalPath().trim();
+                    moduleLocations.add(modulePath);
+                    try {
+                        moduleFile = new NestedJarFile(earFile, modulePath);
+                    } catch (IOException e) {
+                        throw new DeploymentException("Invalid moduleFile: " + modulePath,
e);
+                    }
+                } else {
+                    String path = gerExtModule.getExternalPath().trim();
+                    URI pathURI = null;
+                    try {
+                        pathURI = new URI(path);
+                    } catch (URISyntaxException e) {
+                        throw new DeploymentException("Bad path to external module, " + moduleTypeName,
e);
+                    }
+                    if (!repository.hasURI(pathURI)) {
+                        throw new DeploymentException(moduleTypeName + " is missing in repository:
" + path);
+                    }
+                    URL pathURL = null;
+                    try {
+                        pathURL = repository.getURL(pathURI);
+                    } catch (MalformedURLException e) {
+                        throw new DeploymentException("Could not locate " + moduleTypeName
+ " in repository", e);
+                    }
+                    try {
+                        moduleFile = new JarFile(pathURL.getFile());
+                    } catch (IOException e) {
+                        throw new DeploymentException("Could not access contents of " + moduleTypeName,
e);
+                    }
+
+                }
+
+
+
+                URL altSpecDD = null;
+                //todo implement an alt-spec-dd element.
+//                if (moduleXml.isSetAltDd()) {
+//                    try {
+//                        altSpecDD = DeploymentUtil.createJarURL(earFile, moduleXml.getAltDd().getStringValue());
+//                    } catch (MalformedURLException e) {
+//                        throw new DeploymentException("Invalid alt spec dd url: " + moduleXml.getAltDd().getStringValue(),
e);
+//                    }
 //                }
 
+
+                Module module = builder.createModule(altVendorDD,
+                        moduleFile,
+                        moduleName,
+                        altSpecDD,
+                        URI.create(gerApplication.getConfigId()),
+                        moduleContextInfo);
+
+                if (module == null) {
+                    throw new DeploymentException("Module was not " + moduleTypeName + ":
" + moduleName);
+                }
+
                 modules.add(module);
             }
+
+
         } finally {
             // delete all the temp files created for alt vendor dds
             for (Iterator iterator = altVendorDDs.values().iterator(); iterator.hasNext();)
{

Modified: geronimo/trunk/modules/j2ee-builder/src/schema/geronimo-application.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/schema/geronimo-application.xsd?rev=232768&r1=232767&r2=232768&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/schema/geronimo-application.xsd (original)
+++ geronimo/trunk/modules/j2ee-builder/src/schema/geronimo-application.xsd Mon Aug 15 00:36:08
2005
@@ -35,6 +35,7 @@
         <xs:sequence>
             <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="module" type="geronimo:moduleType" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="ext-module" type="geronimo:ext-moduleType" minOccurs="0"
maxOccurs="unbounded"/>
             <xs:element ref="security:security" minOccurs="0"/>
             <xs:element ref="sys:gbean" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
@@ -58,6 +59,44 @@
                 <xs:element name="java" type="geronimo:pathType"/>
                 <xs:element name="web" type="geronimo:pathType"/>
             </xs:choice>
+            <xs:choice>
+                <xs:element name="alt-dd" type="geronimo:pathType">
+                    <xs:annotation>
+                        <xs:documentation>
+  Specifies an optional URI to the post-assembly version of the Geronimo
+  specific deployment descriptor file for a particular J2EE module.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:any namespace="##other" processContents="lax"/>
+            </xs:choice>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="ext-moduleType">
+        <xs:annotation>
+            <xs:documentation>
+	Mirrors the moduleType defined by application_1_4.xsd and adds an
+	optional alt-dd element defining a Geronimo specific deployment descriptor.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:choice>
+                <xs:annotation>
+                    <xs:documentation>
+            This is the name for the module, not the path inside the ear.
+                    </xs:documentation>
+                </xs:annotation>
+                <xs:element name="connector" type="geronimo:pathType"/>
+                <xs:element name="ejb" type="geronimo:pathType"/>
+                <xs:element name="java" type="geronimo:pathType"/>
+                <xs:element name="web" type="geronimo:pathType"/>
+            </xs:choice>
+            <xs:choice>
+                <xs:element name="internal-path" type="xs:token"/>
+                <xs:element name="external-path" type="xs:token"/>
+            </xs:choice>
+            <!--TODO consider an alt-spec-dd element-->
             <xs:choice>
                 <xs:element name="alt-dd" type="geronimo:pathType">
                     <xs:annotation>



Mime
View raw message