geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <djen...@gluecode.com>
Subject Re: svn commit: rev 47239 - in geronimo/trunk/modules: client-builder/src/java/org/apache/geronimo/client/builder connector/src/java/org/apache/geronimo/connector/deployment connector/src/test/org/apache/geronimo/connector/deployment deployment/src/java/org/apache/geronimo/deployment deployment/src/java/org/apache/geronimo/deployment/plugin deployment/src/java/org/apache/geronimo/deployment/service deployment/src/java/org/apache/geronimo/deployment/util j2ee/src/java/org/apache/geronimo/j2ee j2ee/src/java/org/apache/geronimo/j2ee/deployment j2ee/src/test/org/apache/geronimo/j2ee/deployment jetty/src/java/org/apache/geronimo/jetty/deployment
Date Sun, 26 Sep 2004 10:55:14 GMT
This might be moving in a good direction overall, but one aspect  
totally sucks, namely that in the ModuleBuilder interface in the
     Module createModule(String name, Object planFile, JarFile  
moduleFile, URL specDDUrl, String targetPath) throws  
DeploymentException;
method the planFile can be either a File or an XmlObject from an  
embedded plan.

Personally I think at this point passing XmlObjects around rather than  
file-like objects is a better idea.

david jencks

On Sep 26, 2004, at 3:05 AM, dain@apache.org wrote:

> Author: dain
> Date: Sun Sep 26 03:05:01 2004
> New Revision: 47239
>
> Added:
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> ApplicationInfo.java
> Modified:
>     
> geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/ 
> client/builder/AppClientModuleBuilder.java
>     
> geronimo/trunk/modules/connector/src/java/org/apache/geronimo/ 
> connector/deployment/ConnectorModuleBuilder.java
>     
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_0ConfigBuilderTest.java
>     
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_5ConfigBuilderTest.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Bootstrap.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/ConfigurationBuilder.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Deployer.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/plugin/DeploymentManagerImpl.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/service/ServiceConfigBuilder.java
>     
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/util/JarUtil.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/AppClientModule.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ConnectorModule.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilder.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EJBModule.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/Module.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ModuleBuilder.java
>     
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/WebModule.java
>     
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilderTest.java
>     
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockConnectorConfigBuilder.java
>     
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockEJBConfigBuilder.java
>     
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockWARConfigBuilder.java
>     
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> deployment/JettyModuleBuilder.java
> Log:
> Refactored deployment to the complexity of the conversational  
> interface between the ear builder and the module builders
> Decoupled the main deployer from XmlBeans
> Ear module builders are almost decoupled from XmlBeans, although all  
> module builders use xml beans internally in the future they will not  
> be forced to
>
>
> Modified:  
> geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/ 
> client/builder/AppClientModuleBuilder.java
> ======================================================================= 
> =======
> ---  
> 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	Sun Sep 26 03:05:01 2004
> @@ -20,8 +20,6 @@
>  import java.io.File;
>  import java.io.FileOutputStream;
>  import java.io.IOException;
> -import java.io.InputStream;
> -import java.net.MalformedURLException;
>  import java.net.URI;
>  import java.net.URISyntaxException;
>  import java.net.URL;
> @@ -30,7 +28,6 @@
>  import java.util.Map;
>  import java.util.Properties;
>  import java.util.jar.Attributes;
> -import java.util.jar.JarEntry;
>  import java.util.jar.JarFile;
>  import java.util.jar.JarOutputStream;
>  import java.util.jar.Manifest;
> @@ -58,6 +55,7 @@
>  import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
>  import org.apache.geronimo.naming.java.ReadOnlyContext;
>  import org.apache.geronimo.schema.SchemaConversionUtils;
> +import  
> org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientDocument 
> ;
>  import  
> org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientType;
>  import org.apache.geronimo.xbeans.geronimo.client.GerDependencyType;
>  import org.apache.geronimo.xbeans.geronimo.client.GerGbeanType;
> @@ -65,8 +63,6 @@
>  import org.apache.geronimo.xbeans.j2ee.ApplicationClientDocument;
>  import org.apache.geronimo.xbeans.j2ee.ApplicationClientType;
>  import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
>  import org.apache.xmlbeans.XmlException;
>  import org.apache.xmlbeans.XmlObject;
>
> @@ -75,14 +71,10 @@
>   * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14  
> Sep 2004) $
>   */
>  public class AppClientModuleBuilder implements ModuleBuilder {
> -    static final SchemaTypeLoader SCHEMA_TYPE_LOADER =  
> XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
> -//         
> XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.Strin 
> g.class.getClassLoader()),
> -//         
> XmlBeans.typeLoaderForClassLoader(GerApplicationClientType.class.getCla 
> ssLoader())
> -    });
> -
>      private final Kernel kernel;
>      private final Repository repository;
>      private final ConfigurationStore store;
> +
>      private static final URI PARENT_ID =  
> URI.create("org/apache/geronimo/Client");
>
>      public AppClientModuleBuilder(Kernel kernel, Repository  
> repository, ConfigurationStore store) {
> @@ -91,89 +83,101 @@
>          this.store = store;
>      }
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> +    public Module createModule(String name, Object plan, JarFile  
> moduleFile, URL appClientXmlUrl, String targetPath) throws  
> DeploymentException {
> +        String specDD;
> +        ApplicationClientType appClient;
>          try {
> -            // check if we have an alt spec dd
> -            ApplicationClientDocument applicationClientDoc =  
> ApplicationClientDocument.Factory.parse(path);
> -            return applicationClientDoc.getApplicationClient();
> -        } catch (Exception e) {
> -            throw new DeploymentException("Unable to parse " + path,  
> e);
> -        }
> -    }
> +            if (appClientXmlUrl == null) {
> +                appClientXmlUrl = JarUtil.createJarURL(moduleFile,  
> "META-INF/application-client.xml");
> +            }
> +
> +            specDD = IOUtil.readAll(appClientXmlUrl);
>
> -    public XmlObject parseSpecDD(String specDD) throws  
> DeploymentException {
> -        try {
>              // check if we have an alt spec dd
> -            ApplicationClientDocument applicationClientDoc =  
> ApplicationClientDocument.Factory.parse(specDD);
> -            return applicationClientDoc.getApplicationClient();
> +            ApplicationClientDocument appClientDoc =  
> SchemaConversionUtils.convertToApplicationClientSchema(SchemaConversion 
> Utils.parse(specDD));
> +            appClient = appClientDoc.getApplicationClient();
>          } catch (Exception e) {
> -            throw new DeploymentException("Unable to parse specDD",  
> e);
> +            return null;
>          }
> -    }
>
> -    public XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException {
> +        GerApplicationClientType gerAppClient = null;
>          try {
> -            URL path = JarUtil.createJarURL(module,  
> "META-INF/geronimo-application-client.xml");
> -            XmlObject vendorDD = SchemaConversionUtils.parse(path);
> -            GerApplicationClientType plan =  
> (GerApplicationClientType) validateVendorDD(vendorDD);
> -            if (plan == null) {
> -                return createDefaultPlan(module);
> +            // load the geronimo-application-client.xml from either  
> the supplied plan or from the earFile
> +            try {
> +                if (plan instanceof XmlObject) {
> +                    gerAppClient = (GerApplicationClientType)  
> SchemaConversionUtils.getNestedObjectAsType(
> +                            (XmlObject) plan,
> +                            "application-client",
> +                            GerApplicationClientType.type);
> +                } else {
> +                    GerApplicationClientDocument gerAppClientDoc =  
> null;
> +                    if (plan != null) {
> +                        gerAppClientDoc =  
> GerApplicationClientDocument.Factory.parse((File)plan);
> +                    } else {
> +                        URL path = JarUtil.createJarURL(moduleFile,  
> "META-INF/geronimo-application-client.xml");
> +                        gerAppClientDoc =  
> GerApplicationClientDocument.Factory.parse(path);
> +                    }
> +                    if (gerAppClientDoc != null) {
> +                        gerAppClient =  
> gerAppClientDoc.getApplicationClient();
> +                    }
> +                }
> +            } catch (IOException e) {
> +            }
> +
> +            // if we got one extract the validate it otherwise create  
> a default one
> +            if (gerAppClient != null) {
> +                gerAppClient = (GerApplicationClientType)  
> SchemaConversionUtils.convertToGeronimoNamingSchema(gerAppClient);
> +                SchemaConversionUtils.validateDD(gerAppClient);
> +            } else {
> +                gerAppClient = createDefaultPlan(name, appClient);
>              }
> -            return plan;
> -        } catch (MalformedURLException e) {
> -            return null;
> -        } catch (IOException e) {
> -            return null;
>          } catch (XmlException e) {
>              throw new DeploymentException(e);
>          }
> -    }
>
> -    public XmlObject validateVendorDD(XmlObject dd) throws  
> DeploymentException {
> +        // get the ids from either the application plan or for a  
> stand alone module from the specific deployer
> +        URI configId = null;
>          try {
> -            dd = SchemaConversionUtils.getNestedObjectAsType(dd,  
> "application-client", GerApplicationClientType.type);
> -            dd =  
> SchemaConversionUtils.convertToGeronimoNamingSchema(dd);
> -            SchemaConversionUtils.validateDD(dd);
> -            return dd;
> -        } catch (Exception e) {
> -            throw new DeploymentException(e);
> +            configId = new URI(gerAppClient.getConfigId());
> +        } catch (URISyntaxException e) {
> +            throw new DeploymentException("Invalid configId " +  
> gerAppClient.getConfigId(), e);
>          }
> -    }
>
> -    private GerApplicationClientType createDefaultPlan(JarFile  
> module) {
> -        // load the application-client.xml
> -        URL appClientXmlUrl = null;
> -        try {
> -            appClientXmlUrl = JarUtil.createJarURL(module,  
> "META-INF/application-client.xml");
> -        } catch (DeploymentException e) {
> -            return null;
> +        URI parentId = null;
> +        if (gerAppClient.isSetParentId()) {
> +            try {
> +                parentId = new URI(gerAppClient.getParentId());
> +            } catch (URISyntaxException e) {
> +                throw new DeploymentException("Invalid parentId " +  
> gerAppClient.getParentId(), e);
> +            }
>          }
>
> -        ApplicationClientType appClient;
> -        try {
> -            appClient = (ApplicationClientType)  
> parseSpecDD(appClientXmlUrl);
> -        } catch (DeploymentException e) {
> -            return null;
> +        URI moduleURI;
> +        if (targetPath != null) {
> +            moduleURI = URI.create(targetPath);
> +            if (targetPath.endsWith("/")) {
> +                throw new DeploymentException("targetPath must not  
> end with a '/'");
> +            }
> +        } else {
> +            targetPath = "app-client";
> +            moduleURI = URI.create("");
>          }
> +
> +        return new AppClientModule(name, configId, parentId,  
> moduleURI, moduleFile, targetPath, appClient, gerAppClient, specDD);
> +    }
> +
> +    private GerApplicationClientType createDefaultPlan(String name,  
> ApplicationClientType appClient) {
>          String id = appClient.getId();
>          if (id == null) {
> -            // TODO this name is not necessairly the original name  
> specified on the command line which is what we want
> -            id = module.getName();
> -            if (id.endsWith("!/")) {
> -                id = id.substring(0, id.length() - 2);
> -            }
> +            id = name;
>              if (id.endsWith(".jar")) {
>                  id = id.substring(0, id.length() - 4);
>              }
>              if (id.endsWith("/")) {
>                  id = id.substring(0, id.length() - 1);
>              }
> -            id = id.substring(id.lastIndexOf('/') + 1);
>          }
> -        return newGerApplicationClientType(appClient, id);
> -    }
>
> -    private GerApplicationClientType  
> newGerApplicationClientType(ApplicationClientType appClient, String  
> id) {
>          GerApplicationClientType geronimoAppClient =  
> GerApplicationClientType.Factory.newInstance();
>
>          // set the parentId, configId and context root
> @@ -184,81 +188,6 @@
>          return geronimoAppClient;
>      }
>
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return plan instanceof GerApplicationClientType;
> -    }
> -
> -    public URI getParentId(XmlObject plan) throws DeploymentException  
> {
> -        GerApplicationClientType geronimoAppClient =  
> (GerApplicationClientType) plan;
> -        try {
> -            return new URI(geronimoAppClient.getParentId());
> -        } catch (URISyntaxException e) {
> -            throw new DeploymentException("Invalid parentId " +  
> geronimoAppClient.getParentId(), e);
> -        }
> -    }
> -
> -    public URI getConfigId(XmlObject plan) throws DeploymentException  
> {
> -        GerApplicationClientType geronimoAppClient =  
> (GerApplicationClientType) plan;
> -        try {
> -            return new URI(geronimoAppClient.getConfigId());
> -        } catch (URISyntaxException e) {
> -            throw new DeploymentException("Invalid configId " +  
> geronimoAppClient.getConfigId(), e);
> -        }
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "app-client",  
> null);
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDDUrl) throws  
> DeploymentException {
> -        URI moduleURI;
> -        if (targetPath != null) {
> -            moduleURI = URI.create(targetPath);
> -            if (targetPath.endsWith("/")) {
> -                throw new DeploymentException("targetPath must not  
> end with a '/'");
> -            }
> -        } else {
> -            targetPath = "app-client";
> -            moduleURI = URI.create("");
> -        }
> -
> -        if (specDDUrl == null) {
> -            specDDUrl = JarUtil.createJarURL(moduleFile,  
> "META-INF/application-client.xml");
> -        }
> -        String specDD;
> -        try {
> -            specDD = IOUtil.readAll(specDDUrl);
> -        } catch (IOException e) {
> -            throw new DeploymentException("Unable to read specDD: " +  
> specDDUrl.toExternalForm());
> -        }
> -        ApplicationClientType appClient = (ApplicationClientType)  
> parseSpecDD(specDD);
> -
> -        if (vendorDD == null) {
> -            InputStream in = null;
> -            try {
> -                JarEntry entry =  
> moduleFile.getJarEntry("META-INF/geronimo-application-client.xml");
> -                if (entry != null) {
> -                    in = moduleFile.getInputStream(entry);
> -                    if (in != null) {
> -                        XmlObject dd =  
> SchemaConversionUtils.parse(in);
> -                        vendorDD = validateVendorDD(dd);
> -                    }
> -                }
> -            } catch (Exception e) {
> -                throw new DeploymentException("Unable to parse  
> META-INF/geronimo-application-client.xml", e);
> -            } finally {
> -                IOUtil.close(in);
> -            }
> -        }
> -        if (vendorDD == null) {
> -            vendorDD = newGerApplicationClientType(appClient, name);
> -        }
> -
> -        GerApplicationClientType geronimoAppClient =  
> (GerApplicationClientType) vendorDD;
> -
> -        return new AppClientModule(name, moduleURI, moduleFile,  
> targetPath, appClient, geronimoAppClient);
> -    }
> -
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module module) throws DeploymentException {
>          // extract the ejbJar file into a standalone packed jar file  
> and add the contents to the output
>          JarFile moduleFile = module.getModuleFile();
> @@ -325,9 +254,7 @@
>          }
>          earContext.addGBean(appClientModuleName,  
> appClientModuleGBean);
>
> -
> -
> -        // Create a new executable jar within the ear context
> +        // create another child configuration within the config store  
> for the client application
>          DeploymentContext appClientDeploymentContext = null;
>          File appClientConfiguration = null;
>          try {
> @@ -414,10 +341,6 @@
>          } catch (Exception e) {
>              throw new DeploymentException(e);
>          }
> -    }
> -
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return SCHEMA_TYPE_LOADER;
>      }
>
>      private ReadOnlyContext buildComponentContext(EARContext  
> earContext, AppClientModule appClientModule, ApplicationClientType  
> appClient, GerApplicationClientType geronimoAppClient, ClassLoader cl)  
> throws DeploymentException {
>
> Modified:  
> geronimo/trunk/modules/connector/src/java/org/apache/geronimo/ 
> connector/deployment/ConnectorModuleBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/connector/src/java/org/apache/geronimo/ 
> connector/deployment/ConnectorModuleBuilder.java	(original)
> +++  
> geronimo/trunk/modules/connector/src/java/org/apache/geronimo/ 
> connector/deployment/ConnectorModuleBuilder.java	Sun Sep 26 03:05:01  
> 2004
> @@ -17,6 +17,7 @@
>  package org.apache.geronimo.connector.deployment;
>
>  import java.beans.PropertyEditor;
> +import java.io.File;
>  import java.io.IOException;
>  import java.io.InputStream;
>  import java.net.URI;
> @@ -84,8 +85,6 @@
>  import  
> org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorDocument10;
>  import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorType10;
>  import  
> org.apache.geronimo.xbeans.j2ee.connector_1_0.ResourceadapterType10;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
>  import org.apache.xmlbeans.XmlException;
>  import org.apache.xmlbeans.XmlObject;
>
> @@ -93,110 +92,85 @@
>   * @version $Rev$ $Date$
>   */
>  public class ConnectorModuleBuilder implements ModuleBuilder {
> -    private static final SchemaTypeLoader SCHEMA_TYPE_LOADER =  
> XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
> -         
> XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.Strin 
> g.class.getClassLoader()),
> -         
> XmlBeans.typeLoaderForClassLoader(GerConnectorDocument.class.getClassLo 
> ader())
> -    });
> -
>      private static final String BASE_REALM_BRIDGE_NAME =  
> "geronimo.security:service=RealmBridge,name=";
>      private static final String  
> BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME =  
> "geronimo.security:service=Realm,type=PasswordCredential,name=";
>      private static final String BASE_WORK_MANAGER_NAME =  
> "geronimo.server:type=WorkManager,name=";
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> +    public Module createModule(String name, Object plan, JarFile  
> moduleFile, URL appClientXmlUrl, String targetPath) throws  
> DeploymentException {
>          String specDD;
> +        XmlObject connector;
>          try {
> -            specDD = IOUtil.readAll(path);
> -        } catch (IOException e) {
> -            throw new DeploymentException("Unable to read specDD: " +  
> path.toExternalForm());
> -        }
> -        return parseSpecDD(specDD);
> -    }
> -
> -    public XmlObject parseSpecDD(String specDD) throws  
> DeploymentException {
> -        try {
> -            // try 1.0
> -            ConnectorDocument10 connectorDoc =  
> ConnectorDocument10.Factory.parse(specDD);
> -            SchemaConversionUtils.validateDD(connectorDoc);
> -            return connectorDoc.getConnector();
> -        } catch (Exception ignore) {
> -            // ignore
> -        }
> -
> -        // that didn't work try 1.5
> -        try {
> -            ConnectorDocument connectorDoc =  
> ConnectorDocument.Factory.parse(specDD);
> -            SchemaConversionUtils.validateDD(connectorDoc);
> -            return connectorDoc.getConnector();
> -        } catch (Exception e) {
> -            // ignore
> -        }
> +            if (appClientXmlUrl == null) {
> +                appClientXmlUrl = JarUtil.createJarURL(moduleFile,  
> "META-INF/ra.xml");
> +            }
>
> -        throw new DeploymentException("Unable to parse specDD");
> -    }
> +            specDD = IOUtil.readAll(appClientXmlUrl);
>
> -    public XmlObject validateVendorDD(XmlObject dd) throws  
> DeploymentException {
> -        try {
> -            dd = SchemaConversionUtils.getNestedObjectAsType(dd,  
> "connector", GerConnectorType.type);
> -            SchemaConversionUtils.validateDD(dd);
> -            return dd;
> +            try {
> +                // try 1.0
> +                ConnectorDocument10 connectorDoc =  
> ConnectorDocument10.Factory.parse(specDD);
> +                SchemaConversionUtils.validateDD(connectorDoc);
> +                connector = connectorDoc.getConnector();
> +            } catch (Exception ignore) {
> +                // that didn't work try 1.5
> +                ConnectorDocument connectorDoc =  
> ConnectorDocument.Factory.parse(specDD);
> +                SchemaConversionUtils.validateDD(connectorDoc);
> +                connector = connectorDoc.getConnector();
> +            }
>          } catch (Exception e) {
> -            throw new DeploymentException(e);
> -        }
> -    }
> -
> -    public XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException {
> -        URL path = null;
> -        try {
> -            path = JarUtil.createJarURL(module,  
> "META-INF/geronimo-ra.xml");
> -        } catch (DeploymentException e) {
>              return null;
>          }
> -        return getGerConnector(path);
> -    }
>
> -    GerConnectorType getGerConnector(URL path) throws  
> DeploymentException {
> +        GerConnectorType gerConnector = null;
>          try {
> -            XmlObject dd =  
> SchemaConversionUtils.parse(path.openStream());
> -            return (GerConnectorType) validateVendorDD(dd);
> -        } catch (IOException e) {
> -            //todo should this throw an exception? we have already  
> opened the stream!
> -            return null;
> +            // load the geronimo-application-client.xml from either  
> the supplied plan or from the earFile
> +            try {
> +                if (plan instanceof XmlObject) {
> +                    gerConnector = (GerConnectorType)  
> SchemaConversionUtils.getNestedObjectAsType(
> +                            (XmlObject) plan,
> +                            "connector",
> +                            GerConnectorType.type);
> +                } else {
> +                    GerConnectorDocument gerConnectorDoc = null;
> +                    if (plan != null) {
> +                        gerConnectorDoc =  
> GerConnectorDocument.Factory.parse((File)plan);
> +                    } else {
> +                        URL path = JarUtil.createJarURL(moduleFile,  
> "META-INF/geronimo-ra.xml");
> +                        gerConnectorDoc =  
> GerConnectorDocument.Factory.parse(path);
> +                    }
> +                    if (gerConnectorDoc != null) {
> +                        gerConnector = gerConnectorDoc.getConnector();
> +                    }
> +                }
> +            } catch (IOException e) {
> +            }
> +
> +            // if we got one extract the validate it otherwise create  
> a default one
> +            if (gerConnector == null) {
> +                throw new DeploymentException("A connector module  
> must contain a geronimo-ra.xml");
> +            }
> +            SchemaConversionUtils.validateDD(gerConnector);
>          } catch (XmlException e) {
>              throw new DeploymentException(e);
>          }
> -    }
>
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return plan instanceof GerConnectorType;
> -    }
> +        // get the ids from either the application plan or for a  
> stand alone module from the specific deployer
> +        URI configId = null;
> +        try {
> +            configId = new URI(gerConnector.getConfigId());
> +        } catch (URISyntaxException e) {
> +            throw new DeploymentException("Invalid configId " +  
> gerConnector.getConfigId(), e);
> +        }
>
> -    public URI getParentId(XmlObject plan) throws DeploymentException  
> {
> -        GerConnectorType geronimoConnector = (GerConnectorType) plan;
> -        if (geronimoConnector.isSetParentId()) {
> +        URI parentId = null;
> +        if (gerConnector.isSetParentId()) {
>              try {
> -                return new URI(geronimoConnector.getParentId());
> +                parentId = new URI(gerConnector.getParentId());
>              } catch (URISyntaxException e) {
> -                throw new DeploymentException("Invalid parentId " +  
> geronimoConnector.getParentId(), e);
> +                throw new DeploymentException("Invalid parentId " +  
> gerConnector.getParentId(), e);
>              }
> -        } else {
> -            return null;
>          }
> -    }
> -
> -    public URI getConfigId(XmlObject plan) throws DeploymentException  
> {
> -        GerConnectorType geronimoConnector = (GerConnectorType) plan;
> -        try {
> -            return new URI(geronimoConnector.getConfigId());
> -        } catch (URISyntaxException e) {
> -            throw new DeploymentException("Invalid configId " +  
> geronimoConnector.getConfigId(), e);
> -        }
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "connector",  
> null);
> -    }
>
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDDUrl) throws  
> DeploymentException {
>          URI moduleURI;
>          if (targetPath != null) {
>              moduleURI = URI.create(targetPath);
> @@ -209,33 +183,7 @@
>              moduleURI = URI.create("");
>          }
>
> -
> -        if (specDDUrl == null) {
> -            specDDUrl = JarUtil.createJarURL(moduleFile,  
> "META-INF/ra.xml");
> -        }
> -        String specDD;
> -        try {
> -            specDD = IOUtil.readAll(specDDUrl);
> -        } catch (IOException e) {
> -            throw new DeploymentException("Unable to read specDD: " +  
> specDDUrl.toExternalForm());
> -        }
> -        XmlObject connector = parseSpecDD(specDD);
> -
> -        if (vendorDD == null) {
> -            try {
> -                URL vendorURL = JarUtil.createJarURL(moduleFile,  
> "META-INF/geronimo-ra.xml");
> -                vendorDD = getGerConnector(vendorURL);
> -            } catch (Exception e) {
> -                throw new DeploymentException("Unable to parse  
> META-INF/geronimo-ra.xml", e);
> -            }
> -        }
> -        if (vendorDD == null) {
> -            throw new DeploymentException("No geronimo-ra.xml.");
> -        }
> -
> -        GerConnectorType geronimoConnector = (GerConnectorType)  
> vendorDD;
> -
> -        return new ConnectorModule(name, moduleURI, moduleFile,  
> targetPath, connector, geronimoConnector, specDD);
> +        return new ConnectorModule(name, configId, parentId,  
> moduleURI, moduleFile, targetPath, connector, gerConnector, specDD);
>      }
>
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module module) throws DeploymentException {
> @@ -293,10 +241,6 @@
>          for (int i = 0; i < gbeans.length; i++) {
>              GBeanHelper.addGbean(new RARGBeanAdapter(gbeans[i]), cl,  
> earContext);
>          }
> -    }
> -
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return SCHEMA_TYPE_LOADER;
>      }
>
>      private void addResourceAdapterModuleGBean(EARContext earContext,  
> Module module, ClassLoader cl) throws DeploymentException {
>
> Modified:  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_0ConfigBuilderTest.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_0ConfigBuilderTest.java	(original)
> +++  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_0ConfigBuilderTest.java	Sun Sep 26 03:05:01  
> 2004
> @@ -24,7 +24,6 @@
>  import java.io.InputStream;
>  import java.io.ObjectInputStream;
>  import java.net.MalformedURLException;
> -import java.net.URI;
>  import java.net.URL;
>  import java.net.URLClassLoader;
>  import java.sql.Connection;
> @@ -33,8 +32,8 @@
>  import java.util.Collections;
>  import java.util.List;
>  import java.util.Set;
> -import java.util.jar.JarOutputStream;
>  import java.util.jar.JarFile;
> +import java.util.jar.JarOutputStream;
>  import javax.management.ObjectName;
>  import javax.sql.DataSource;
>
> @@ -44,23 +43,19 @@
>  import org.apache.geronimo.deployment.util.UnpackedJarFile;
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.jmx.GBeanMBean;
> +import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
>  import org.apache.geronimo.j2ee.deployment.EARContext;
>  import org.apache.geronimo.j2ee.deployment.Module;
>  import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
> -import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
>  import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.config.Configuration;
> -import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>  import org.apache.geronimo.kernel.management.State;
>  import org.apache.geronimo.system.configuration.LocalConfigStore;
>  import org.apache.geronimo.system.serverinfo.ServerInfo;
>  import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
>  import  
> org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorDocument10;
> -import org.apache.geronimo.schema.SchemaConversionUtils;
> -import org.apache.xmlbeans.XmlObject;
>  import org.apache.xmlbeans.XmlOptions;
> -import org.apache.xmlbeans.XmlCursor;
>  import org.tranql.sql.jdbc.JDBCUtil;
>
>  /**
> @@ -94,7 +89,7 @@
>
>      public void testBuildUnpackedModule() throws Exception {
>          InstallAction action = new InstallAction() {
> -            public URL getVendorDD() {
> +            public File getVendorDD() {
>                  return null;
>              }
>
> @@ -117,8 +112,8 @@
>
>      public void testBuildUnpackedAltSpecDDModule() throws Exception {
>          InstallAction action = new InstallAction() {
> -            public URL getVendorDD() throws MalformedURLException {
> -                return new File(basedir,  
> "target/test-rar-10/META-INF/geronimo-ra.xml").toURL();
> +            public File getVendorDD() {
> +                return new File(basedir,  
> "target/test-rar-10/META-INF/geronimo-ra.xml");
>              }
>
>              public URL getSpecDD() throws MalformedURLException {
> @@ -144,9 +139,9 @@
>
>      public void testBuildUnpackedAltVendorDDModule() throws Exception  
> {
>          InstallAction action = new InstallAction() {
> -            public URL getVendorDD() throws MalformedURLException {
> +            public File getVendorDD() {
>                  // this file does not exist, one expects a  
> DeploymentException.
> -                return new File(basedir,  
> "target/test-rar-10/dummy.xml").toURL();
> +                return new File(basedir,  
> "target/test-rar-10/dummy.xml");
>              }
>
>              public URL getSpecDD() throws MalformedURLException {
> @@ -172,9 +167,9 @@
>
>      public void testBuildUnpackedAltSpecVendorDDModule() throws  
> Exception {
>          InstallAction action = new InstallAction() {
> -            public URL getVendorDD() throws MalformedURLException {
> +            public File getVendorDD() {
>                  // this file exists
> -                return new File(basedir,  
> "target/test-rar-10/META-INF/geronimo-ra.xml").toURL();
> +                return new File(basedir,  
> "target/test-rar-10/META-INF/geronimo-ra.xml");
>              }
>
>              public URL getSpecDD() throws MalformedURLException {
> @@ -196,7 +191,7 @@
>
>      public void testBuildPackedModule() throws Exception {
>          InstallAction action = new InstallAction() {
> -            public URL getVendorDD() {
> +            public File getVendorDD() {
>                  return null;
>              }
>
> @@ -233,27 +228,17 @@
>          Thread.currentThread().setContextClassLoader(cl);
>
>          JarFile rarJarFile = JarUtil.createJarFile(rarFile);
> -        URL vendorURL = action.getVendorDD();
> -        if (vendorURL == null) {
> -            vendorURL = JarUtil.createJarURL(rarJarFile,  
> "META-INF/geronimo-ra.xml");
> -        }
> -        XmlObject plan = moduleBuilder.getGerConnector(vendorURL);
> -        if (plan == null) {
> -            throw new DeploymentException();
> +        Module module = moduleBuilder.createModule(j2eeModuleName,  
> action.getVendorDD(), rarJarFile, action.getSpecDD(), "connector");
> +        if (module == null) {
> +            throw new DeploymentException("Was not a connector  
> module");
>          }
>
> -        URI parentId = moduleBuilder.getParentId(plan);
> -        URI configId = moduleBuilder.getConfigId(plan);
> -        assertEquals(j2eeModuleName, configId.toString());
> -
> -        Module module =  
> moduleBuilder.createModule(configId.toString(), rarJarFile, plan,  
> "connector", action.getSpecDD());
> -
>          File carFile = File.createTempFile("RARTest", ".car");
>          try {
>              EARContext earContext = new EARContext(new  
> JarOutputStream(new FileOutputStream(carFile)),
> -                    configId,
> -                    ConfigurationModuleType.RAR,
> -                    parentId,
> +                    module.getConfigId(),
> +                    module.getType(),
> +                    module.getParentId(),
>                      null,
>                      j2eeDomainName,
>                      j2eeServerName,
> @@ -293,12 +278,8 @@
>              File outFile = File.createTempFile("EARTest", ".car");
>              try {
>                  File planFile = new File(basedir,  
> "src/test-data/data/external-application-plan.xml");
> -                XmlObject planDoc =  
> SchemaConversionUtils.parse(planFile.toURL().openStream());
> -                XmlCursor cursor = planDoc.newCursor();
> -                cursor.toFirstChild();
> -                XmlObject plan = cursor.getObject();
> -                cursor.dispose();
> -                configBuilder.buildConfiguration(outFile, null,  
> rarFile, plan);
> +                Object plan =  
> configBuilder.getDeploymentPlan(planFile, rarFile);
> +                configBuilder.buildConfiguration(outFile, null, plan,  
> rarFile);
>
>              } finally {
>                  outFile.delete();
> @@ -473,7 +454,7 @@
>
>          void install(ModuleBuilder moduleBuilder, EARContext  
> earContext, Module module) throws Exception;
>
> -        URL getVendorDD() throws MalformedURLException;
> +        File getVendorDD() throws MalformedURLException;
>
>          URL getSpecDD() throws MalformedURLException;
>      }
>
> Modified:  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_5ConfigBuilderTest.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_5ConfigBuilderTest.java	(original)
> +++  
> geronimo/trunk/modules/connector/src/test/org/apache/geronimo/ 
> connector/deployment/RAR_1_5ConfigBuilderTest.java	Sun Sep 26 03:05:01  
> 2004
> @@ -23,7 +23,6 @@
>  import java.io.FileOutputStream;
>  import java.io.InputStream;
>  import java.io.ObjectInputStream;
> -import java.net.URI;
>  import java.net.URL;
>  import java.net.URLClassLoader;
>  import java.sql.Connection;
> @@ -48,13 +47,11 @@
>  import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.config.Configuration;
> -import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>  import org.apache.geronimo.kernel.management.State;
>  import org.apache.geronimo.system.configuration.LocalConfigStore;
>  import org.apache.geronimo.system.serverinfo.ServerInfo;
>  import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
>  import org.apache.geronimo.xbeans.j2ee.ConnectorDocument;
> -import org.apache.xmlbeans.XmlObject;
>  import org.apache.xmlbeans.XmlOptions;
>  import org.tranql.sql.jdbc.JDBCUtil;
>
> @@ -129,19 +126,15 @@
>
>          Thread.currentThread().setContextClassLoader(cl);
>
> -        XmlObject plan =  
> moduleBuilder.getDeploymentPlan(JarUtil.createJarFile(rarFile));
> -        URI parentId = moduleBuilder.getParentId(plan);
> -        URI configId = moduleBuilder.getConfigId(plan);
> -        assertEquals(j2eeModuleName, configId.toString());
> -
> -        Module module =  
> moduleBuilder.createModule(configId.toString(),  
> JarUtil.createJarFile(action.getRARFile()), plan);
> +        Module module = moduleBuilder.createModule(j2eeModuleName,  
> null, JarUtil.createJarFile(action.getRARFile()), null, null);
> +        assertEquals(j2eeModuleName, module.getConfigId().toString());
>
>          File carFile = File.createTempFile("RARTest", ".car");
>          try {
>              EARContext earContext = new EARContext(new  
> JarOutputStream(new FileOutputStream(carFile)),
> -                    configId,
> -                    ConfigurationModuleType.RAR,
> -                    parentId,
> +                    module.getConfigId(),
> +                    module.getType(),
> +                    module.getParentId(),
>                      null,
>                      j2eeDomainName,
>                      j2eeServerName,
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Bootstrap.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Bootstrap.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Bootstrap.java	Sun Sep 26 03:05:01 2004
> @@ -156,7 +156,7 @@
>              // build and install the j2ee-deployer configuration
>              File tempFile = File.createTempFile("j2ee-deployer",  
> ".car");
>              try {
> -                builder.buildConfiguration(tempFile, manifest, null,  
> j2eeDeployerConfig);
> +                builder.buildConfiguration(tempFile, manifest,  
> j2eeDeployerConfig, null);
>                  configStore.install(tempFile.toURL());
>              } finally {
>                  tempFile.delete();
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/ConfigurationBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/ConfigurationBuilder.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/ConfigurationBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -19,42 +19,32 @@
>
>  import java.io.File;
>  import java.io.IOException;
> -import java.util.jar.Manifest;
>  import java.util.jar.JarFile;
> -
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlObject;
> +import java.util.jar.Manifest;
>
>  /**
> - *
> - *
>   * @version $Rev$ $Date$
>   */
>  public interface ConfigurationBuilder {
> -    SchemaTypeLoader[] getTypeLoaders();
> -
> -    /**
> -     * Determine if this builder can handle the supplied plan.
> -     * @param plan the plan to examine
> -     * @return true if this builder will handle it
> -     */
> -    boolean canConfigure(XmlObject plan);
> -
>      /**
> -     * Extract the deployment plan from a module if this builder can
> -     * process it.
> -     * @param module the URL of the module to examine
> -     * @return the deployment plan, or null if this module can not  
> handle it
> +     * Builds a the deployment plan specific to this builder from a  
> planFile and/or
> +     * module if this builder can process it.
> +     * @param planFile the deployment plan to examine; can be null
> +     * @param module the URL of the module to examine; can be null
> +     * @return the deployment plan, or null if this builder can not  
> handle the module
> +     * @throws DeploymentException if there was a problem with the  
> configuration
>       */
> -    XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException;
> +    Object getDeploymentPlan(File planFile, JarFile module) throws  
> DeploymentException;
>
>      /**
>       * Build a configuration from a local file
> +     *
>       * @param outfile the file to write the configuration to
> -     * @param module the module to build
> +     * @param manifest the manifest to add to the output file
>       * @param plan the deployment plan
> +     * @param module the module to build
>       * @throws IOException if there was a problem reading or writing  
> the files
>       * @throws DeploymentException if there was a problem with the  
> configuration
>       */
> -    void buildConfiguration(File outfile, Manifest manifest, JarFile  
> module, XmlObject plan) throws IOException, DeploymentException;
> +    void buildConfiguration(File outfile, Manifest manifest, Object  
> plan, JarFile module) throws IOException, DeploymentException;
>  }
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Deployer.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Deployer.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/Deployer.java	Sun Sep 26 03:05:01 2004
> @@ -20,17 +20,11 @@
>  import java.io.File;
>  import java.io.IOException;
>  import java.net.URI;
> -import java.util.ArrayList;
> -import java.util.Arrays;
>  import java.util.Collection;
>  import java.util.Iterator;
> -import java.util.List;
> -import java.util.Properties;
>  import java.util.jar.Attributes;
> -import java.util.jar.Manifest;
>  import java.util.jar.JarFile;
> -import javax.management.MalformedObjectNameException;
> -import javax.management.ObjectName;
> +import java.util.jar.Manifest;
>
>  import org.apache.commons.cli.CommandLine;
>  import org.apache.commons.cli.HelpFormatter;
> @@ -43,11 +37,6 @@
>  import org.apache.geronimo.gbean.GBeanInfoFactory;
>  import org.apache.geronimo.kernel.config.ConfigurationStore;
>  import org.apache.geronimo.kernel.config.InvalidConfigException;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
> -import org.apache.xmlbeans.XmlCursor;
> -import org.apache.xmlbeans.XmlException;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * Command line based deployment utility which combines multiple  
> deployable modules
> @@ -64,73 +53,8 @@
>          this.store = store;
>      }
>
> -    public URI deploy(File moduleFile, File deploymentPlan) throws  
> DeploymentException {
> -        ConfigurationBuilder builder = null;
> -
> -        XmlObject plan = null;
> -        JarFile moduleJarFile = null;
> -        if (moduleFile != null) {
> -            try {
> -                moduleJarFile = JarUtil.createJarFile(moduleFile);
> -            } catch (IOException e) {
> -                throw new DeploymentException("Could not open module  
> file: " + moduleFile.getAbsolutePath());
> -            }
> -        }
> -        if (deploymentPlan != null) {
> -            plan = getPlan(deploymentPlan);
> -            for (Iterator i = builders.iterator(); i.hasNext();) {
> -                ConfigurationBuilder candidate =  
> (ConfigurationBuilder) i.next();
> -                if (candidate.canConfigure(plan)) {
> -                    builder = candidate;
> -                    break;
> -                }
> -            }
> -            if (builder == null) {
> -                throw new DeploymentException("No deployer found for  
> this plan type: " + deploymentPlan);
> -            }
> -        } else if (moduleFile != null) {
> -            for (Iterator i = builders.iterator(); i.hasNext();) {
> -                ConfigurationBuilder candidate =  
> (ConfigurationBuilder) i.next();
> -                plan = candidate.getDeploymentPlan(moduleJarFile);
> -                if (plan != null) {
> -                    builder = candidate;
> -                    break;
> -                }
> -            }
> -            if (builder == null) {
> -                throw new DeploymentException("No deployer found for  
> this module type: " + moduleFile);
> -            }
> -        }
> -        try {
> -            File carfile = FileUtil.createTempFile();
> -            try {
> -
> -                Manifest manifest = new Manifest();
> -                Attributes mainAttributes =  
> manifest.getMainAttributes();
> -                 
> mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(),  
> "1.0");
> -                builder.buildConfiguration(carfile, manifest,  
> moduleJarFile, plan);
> -                return store.install(carfile.toURL());
> -            } catch (InvalidConfigException e) {
> -                throw new DeploymentException(e);
> -            } finally {
> -                carfile.delete();
> -            }
> -        } catch (IOException e) {
> -            throw new DeploymentException(e);
> -        }
> -    }
> -
> -    private XmlObject getPlan(File deploymentPlan) throws  
> DeploymentException {
> -        try {
> -            XmlObject plan = getLoader().parse(deploymentPlan, null,  
> null);
> -            XmlCursor cursor = plan.newCursor();
> -            cursor.toFirstChild();
> -            return cursor.getObject();
> -        } catch (XmlException e) {
> -            throw new DeploymentException(e);
> -        } catch (IOException e) {
> -            throw new DeploymentException(e);
> -        }
> +    public URI deploy(File moduleFile, File planFile) throws  
> DeploymentException {
> +        return deploy(planFile, moduleFile, null, true, null, null);
>      }
>
>      /**
> @@ -141,45 +65,57 @@
>      public void deploy(String[] args) throws Exception {
>          Command cmd = parseArgs(args);
>          if (cmd == null) {
> -            return;
> +            return;
>          }
>
> -        ConfigurationBuilder builder = null;
> +        File planFile = cmd.planFile;
> +        File module = cmd.module;
> +        File carfile = cmd.carfile;
> +        boolean install = cmd.install;
> +        String mainClass = cmd.mainClass;
> +        String classPath = cmd.classPath;
>
> -        // parse the plan
> -        XmlObject plan = null;
> -        if (cmd.plan != null) {
> -            plan = getPlan(cmd.plan);
> -            for (Iterator i = builders.iterator(); i.hasNext();) {
> -                ConfigurationBuilder candidate =  
> (ConfigurationBuilder) i.next();
> -                if (candidate.canConfigure(plan)) {
> -                    builder = candidate;
> -                    break;
> -                }
> -            }
> -            if (builder == null) {
> -                throw new DeploymentException("No deployer found for  
> this plan type: " + cmd.plan);
> -            }
> -        } else if (cmd.module != null) {
> -            for (Iterator i = builders.iterator(); i.hasNext();) {
> -                ConfigurationBuilder candidate =  
> (ConfigurationBuilder) i.next();
> -                plan = candidate.getDeploymentPlan(cmd.module);
> -                if (plan != null) {
> -                    builder = candidate;
> -                    break;
> -                }
> +
> +        URI uri = deploy(planFile, module, carfile, install,  
> mainClass, classPath);
> +        System.out.println("Deployment uri is " + uri);
> +    }
> +
> +    public URI deploy(File planFile, File moduleFile, File carfile,  
> boolean install, String mainClass, String classPath) throws  
> DeploymentException {
> +        if (planFile == null && moduleFile == null) {
> +            throw new DeploymentException("No plan or module  
> specified");
> +        }
> +
> +        JarFile module = null;
> +        if (moduleFile != null) {
> +            try {
> +                module = JarUtil.createJarFile(moduleFile);
> +            } catch (IOException e) {
> +                throw new DeploymentException("Cound not open module  
> file: " + moduleFile.getAbsolutePath(), e);
>              }
> -            if (builder == null) {
> -                throw new DeploymentException("No deployer found for  
> this module type: " + cmd.module);
> +        }
> +
> +        Object plan = null;
> +        ConfigurationBuilder builder = null;
> +        for (Iterator i = builders.iterator(); i.hasNext();) {
> +            ConfigurationBuilder candidate = (ConfigurationBuilder)  
> i.next();
> +            plan = candidate.getDeploymentPlan(planFile, module);
> +            if (plan != null) {
> +                builder = candidate;
> +                break;
>              }
> -        } else {
> -            throw new DeploymentException("No plan or module  
> supplied");
> +        }
> +        if (builder == null) {
> +            throw new DeploymentException("No deployer found for this  
> plan type: " + planFile);
>          }
>
>          boolean saveOutput;
> -        if (cmd.carfile == null) {
> +        if (carfile == null) {
>              saveOutput = false;
> -            cmd.carfile = FileUtil.createTempFile();
> +            try {
> +                carfile = FileUtil.createTempFile();
> +            } catch (IOException e) {
> +                throw new DeploymentException("Unable to create temp  
> file for deployment", e);
> +            }
>          } else {
>              saveOutput = true;
>          }
> @@ -187,54 +123,40 @@
>          Manifest manifest = new Manifest();
>          Attributes mainAttributes = manifest.getMainAttributes();
>           
> mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(),  
> "1.0");
> -        if (cmd.mainClass != null) {
> -             
> mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(),  
> cmd.mainClass);
> +        if (mainClass != null) {
> +             
> mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(),  
> mainClass);
>          }
> -        if (cmd.classPath != null) {
> -             
> mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(),  
> cmd.classPath);
> +        if (classPath != null) {
> +             
> mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(),  
> classPath);
>          }
>
>
>          try {
> -            builder.buildConfiguration(cmd.carfile, manifest,  
> cmd.module, plan);
> +            builder.buildConfiguration(carfile, manifest, plan,  
> module);
>
>              try {
> -                if (cmd.install) {
> -                    store.install(cmd.carfile.toURL());
> +                if (install) {
> +                    return store.install(carfile.toURL());
>                  }
> +                return null;
>              } catch (InvalidConfigException e) {
>                  // unlikely as we just built this
>                  throw new DeploymentException(e);
>              }
> -        } catch (Exception e) {
> +        } catch (DeploymentException e) {
>              saveOutput = false;
>              throw e;
> +        } catch (Exception e) {
> +            saveOutput = false;
> +            throw new DeploymentException(e);
>          } finally {
>              if (!saveOutput) {
> -                cmd.carfile.delete();
> +                carfile.delete();
>              }
>          }
>      }
>
> -    private SchemaTypeLoader getLoader() {
> -        List types = new ArrayList(builders.size());
> -        for (Iterator i = builders.iterator(); i.hasNext();) {
> -            ConfigurationBuilder builder = (ConfigurationBuilder)  
> i.next();
> -            types.addAll(Arrays.asList(builder.getTypeLoaders()));
> -        }
> -        // @todo this should also set up the entity resolver and  
> error handlers
> -        SchemaTypeLoader[] loaders = (SchemaTypeLoader[])  
> types.toArray(new SchemaTypeLoader[types.size()]);
> -        return XmlBeans.typeLoaderUnion(loaders);
> -    }
> -
> -    public static ObjectName getDeployerName(URI configID) throws  
> MalformedObjectNameException {
> -        Properties props = new Properties();
> -        props.put("role", "Deployer");
> -        props.put("config", configID.toString());
> -        return new ObjectName("geronimo.deployment", props);
> -    }
> -
> -    public static Command parseArgs(String[] args) throws  
> ParseException, DeploymentException {
> +    private static Command parseArgs(String[] args) throws  
> ParseException, DeploymentException {
>          Options options = new Options();
>          options.addOption("h", "help", false, "print this message");
>          options.addOption("I", "install", false, "install  
> configuration in store");
> @@ -256,17 +178,13 @@
>              command.carfile = new File(cmd.getOptionValue('o'));
>          }
>          if (cmd.hasOption('p')) {
> -            command.plan = getFile(cmd.getOptionValue('p'));
> +            command.planFile = getFile(cmd.getOptionValue('p'));
>          }
>          if (cmd.hasOption('m')) {
> -            try {
> -                 command.module =  
> JarUtil.createJarFile(getFile(cmd.getOptionValue('m')));
> -            } catch (IOException e) {
> -                throw new DeploymentException("Could not open module  
> file: " + cmd.getOptionValue('m'));
> -            }
> +             command.module = getFile(cmd.getOptionValue('m'));
>          }
>
> -        if (command.module == null && command.plan == null) {
> +        if (command.module == null && command.planFile == null) {
>              System.err.println("No plan or module specified");
>              return null;
>          }
> @@ -301,8 +219,8 @@
>      private static class Command {
>          private boolean install;
>          private File carfile;
> -        private JarFile module;
> -        private File plan;
> +        private File module;
> +        private File planFile;
>          private String mainClass;
>          private String classPath;
>      }
> @@ -314,6 +232,7 @@
>
>          infoFactory.addOperation("deploy", new  
> Class[]{String[].class});
>          infoFactory.addOperation("deploy", new Class[]{File.class,  
> File.class});
> +        infoFactory.addOperation("deploy", new Class[]{File.class,  
> File.class, File.class, boolean.class, String.class, String.class});
>
>          infoFactory.addReference("Builders",  
> ConfigurationBuilder.class);
>          infoFactory.addReference("Store", ConfigurationStore.class);
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/plugin/DeploymentManagerImpl.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/plugin/DeploymentManagerImpl.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/plugin/DeploymentManagerImpl.java	Sun Sep 26 03:05:01 2004
> @@ -60,9 +60,7 @@
>      private final Collection configurers;
>      private final Collection builders = new ArrayList();
>
> -    public DeploymentManagerImpl(
> -            DeploymentServer server,
> -            Collection configurers) {
> +    public DeploymentManagerImpl(DeploymentServer server, Collection  
> configurers) {
>          this.server = server;
>          this.configurers = configurers;
>          //make sure context loader is always present
> @@ -71,27 +69,10 @@
>
>      public synchronized void  
> addConfigurationBuilder(ConfigurationBuilder builder) {
>          builders.add(builder);
> -        SchemaTypeLoader[] loaders = builder.getTypeLoaders();
> -        for (int i = 0; i < loaders.length; i++) {
> -            typeLoaders.add(loaders[i]);
> -
> -        }
> -        rebuildSchemaTypeLoader();
>      }
>
>      public synchronized void  
> removeConfigurationBuilder(ConfigurationBuilder builder) {
>          builders.remove(builder);
> -        SchemaTypeLoader[] loaders = builder.getTypeLoaders();
> -        for (int i = 0; i < loaders.length; i++) {
> -            typeLoaders.remove(loaders[i]);
> -
> -        }
> -        rebuildSchemaTypeLoader();
> -    }
> -
> -    private void rebuildSchemaTypeLoader() {
> -        SchemaTypeLoader[] loaders = (SchemaTypeLoader[])  
> typeLoaders.toArray(new SchemaTypeLoader[typeLoaders.size()]);
> -        schemaTypeLoader = XmlBeans.typeLoaderUnion(loaders);
>      }
>
>      public DeploymentConfiguration  
> createConfiguration(DeployableObject deployable) throws  
> InvalidModuleException {
> @@ -188,12 +169,15 @@
>          } catch (java.io.IOException e) {
>              return new FailedProgressObject(CommandType.DISTRIBUTE,  
> "Could not read deployment plan");
>          }
> -        for (Iterator iterator = builders.iterator();  
> iterator.hasNext();) {
> -            ConfigurationBuilder configurationBuilder =  
> (ConfigurationBuilder) iterator.next();
> -            if (configurationBuilder.canConfigure(plan)) {
> -                return server.distribute(targetList,  
> configurationBuilder, moduleArchive, plan);
> -            }
> -        }
> +//
> +//  DS: I don't think this is every called....
> +//
> +//        for (Iterator iterator = builders.iterator();  
> iterator.hasNext();) {
> +//            ConfigurationBuilder configurationBuilder =  
> (ConfigurationBuilder) iterator.next();
> +//            if (configurationBuilder.canConfigure(plan)) {
> +//                return server.distribute(targetList,  
> configurationBuilder, moduleArchive, plan);
> +//            }
> +//        }
>          return new FailedProgressObject(CommandType.DISTRIBUTE, "No  
> configuration builder found for module");
>      }
>
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/service/ServiceConfigBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/service/ServiceConfigBuilder.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/service/ServiceConfigBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -37,6 +37,7 @@
>  import org.apache.geronimo.deployment.ConfigurationBuilder;
>  import org.apache.geronimo.deployment.DeploymentContext;
>  import org.apache.geronimo.deployment.DeploymentException;
> +import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
>  import org.apache.geronimo.deployment.xbeans.ConfigurationType;
>  import org.apache.geronimo.deployment.xbeans.DependencyType;
>  import org.apache.geronimo.deployment.xbeans.GbeanType;
> @@ -46,8 +47,6 @@
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>  import org.apache.geronimo.kernel.repository.Repository;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
>  import org.apache.xmlbeans.XmlObject;
>
>  /**
> @@ -66,19 +65,20 @@
>          this.kernel = kernel;
>      }
>
> -    public SchemaTypeLoader[] getTypeLoaders() {
> -        return new  
> SchemaTypeLoader[]{XmlBeans.getContextTypeLoader()};
> -    }
> -
> -    public boolean canConfigure(XmlObject plan) {
> -        return plan instanceof ConfigurationType;
> -    }
> +    public Object getDeploymentPlan(File planFile, JarFile module)  
> throws DeploymentException {
> +        if (planFile == null) {
> +            return null;
> +        }
>
> -    public XmlObject getDeploymentPlan(JarFile module) {
> -        return null;
> +        try {
> +            ConfigurationDocument configurationDoc =  
> ConfigurationDocument.Factory.parse(planFile);
> +            return configurationDoc.getConfiguration();
> +        } catch (Exception e) {
> +            throw new DeploymentException(e);
> +        }
>      }
>
> -    public void buildConfiguration(File outfile, Manifest manifest,  
> JarFile unused, XmlObject plan) throws IOException,  
> DeploymentException {
> +    public void buildConfiguration(File outfile, Manifest manifest,  
> Object plan, JarFile unused) throws IOException, DeploymentException {
>          FileOutputStream fos = new FileOutputStream(outfile);
>          try {
>              JarOutputStream os = new JarOutputStream(new  
> BufferedOutputStream(fos), manifest);
> @@ -89,7 +89,7 @@
>                  os.closeEntry();
>              }
>
> -            buildConfiguration(os, plan);
> +            buildConfiguration(os, (XmlObject) plan);
>
>          } finally {
>              fos.close();
> @@ -97,6 +97,9 @@
>
>      }
>
> +    //
> +    // For use by the bootstrap deployer
> +    //
>      public void buildConfiguration(JarOutputStream os, XmlObject  
> plan) throws DeploymentException, IOException {
>          ConfigurationType configType = (ConfigurationType) plan;
>          URI configID;
>
> Modified:  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/util/JarUtil.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/util/JarUtil.java	(original)
> +++  
> geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/ 
> deployment/util/JarUtil.java	Sun Sep 26 03:05:01 2004
> @@ -35,6 +35,8 @@
>   */
>  public class JarUtil {
>      public static final File DUMMY_JAR_FILE;
> +    private static File file;
> +
>      static {
>          try {
>              DUMMY_JAR_FILE = FileUtil.createTempFile();
> @@ -43,6 +45,25 @@
>              throw new ExceptionInInitializerError(e);
>          }
>      }
> +
> +    public static File toFile(JarFile jarFile, String path) throws  
> DeploymentException {
> +        if (jarFile instanceof UnpackedJarFile) {
> +            File baseDir = ((UnpackedJarFile) jarFile).getBaseDir();
> +            file = new File(baseDir, path);
> +            if (!file.isFile()) {
> +                throw new DeploymentException("No such file: " +  
> file.getAbsolutePath());
> +            }
> +            return file;
> +        } else {
> +            try {
> +                String urlString = "jar:" + new  
> File(jarFile.getName()).toURL() + "!/" + path;
> +                return FileUtil.toTempFile(new URL(urlString));
> +            } catch (Exception e) {
> +                throw new DeploymentException("Can not create File",  
> e);
> +            }
> +        }
> +    }
> +
>
>      public static URL createJarURL(JarFile jarFile, String path)  
> throws DeploymentException {
>          try {
>
> Added:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> ApplicationInfo.java
> ======================================================================= 
> =======
> --- (empty file)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> ApplicationInfo.java	Sun Sep 26 03:05:01 2004
> @@ -0,0 +1,104 @@
> +/**
> + *
> + * Copyright 2004 The Apache Software Foundation
> + *
> + *  Licensed under the Apache License, Version 2.0 (the "License");
> + *  you may not use this file except in compliance with the License.
> + *  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,  
> software
> + *  distributed under the License is distributed on an "AS IS" BASIS,
> + *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or  
> implied.
> + *  See the License for the specific language governing permissions  
> and
> + *  limitations under the License.
> + */
> +package org.apache.geronimo.j2ee.dd;
> +
> +import java.net.URI;
> +import java.util.Set;
> +
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
> +
> +/**
> + * @version $Revision$ $Date$
> + */
> +public class ApplicationInfo {
> +    private ConfigurationModuleType type;
> +    private URI configId;
> +    private URI parentId;
> +    private String applicationName;
> +    private Set modules;
> +    private Set moduleLocations;
> +    private String specDD;
> +
> +    public ApplicationInfo() {
> +    }
> +
> +    public ApplicationInfo(ConfigurationModuleType type, URI  
> configId, URI parentId, String applicationName, Set modules, Set  
> moduleLocations, String specDD) {
> +        this.type = type;
> +        this.configId = configId;
> +        this.parentId = parentId;
> +        this.applicationName = applicationName;
> +        this.modules = modules;
> +        this.moduleLocations = moduleLocations;
> +        this.specDD = specDD;
> +    }
> +
> +    public ConfigurationModuleType getType() {
> +        return type;
> +    }
> +
> +    public void setType(ConfigurationModuleType type) {
> +        this.type = type;
> +    }
> +
> +    public URI getConfigId() {
> +        return configId;
> +    }
> +
> +    public void setConfigId(URI configId) {
> +        this.configId = configId;
> +    }
> +
> +    public URI getParentId() {
> +        return parentId;
> +    }
> +
> +    public void setParentId(URI parentId) {
> +        this.parentId = parentId;
> +    }
> +
> +    public String getApplicationName() {
> +        return applicationName;
> +    }
> +
> +    public void setApplicationName(String applicationName) {
> +        this.applicationName = applicationName;
> +    }
> +
> +    public Set getModules() {
> +        return modules;
> +    }
> +
> +    public void setModules(Set modules) {
> +        this.modules = modules;
> +    }
> +
> +    public Set getModuleLocations() {
> +        return moduleLocations;
> +    }
> +
> +    public void setModuleLocations(Set moduleLocations) {
> +        this.moduleLocations = moduleLocations;
> +    }
> +
> +    public String getSpecDD() {
> +        return specDD;
> +    }
> +
> +    public void setSpecDD(String specDD) {
> +        this.specDD = specDD;
> +    }
> +}
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/AppClientModule.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/AppClientModule.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/AppClientModule.java	Sun Sep 26 03:05:01 2004
> @@ -20,13 +20,19 @@
>  import java.net.URI;
>
>  import org.apache.xmlbeans.XmlObject;
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>
>  /**
>   * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14  
> Sep 2004) $
>   */
>  public class AppClientModule extends Module {
> -    public AppClientModule(String name, URI moduleURI, JarFile  
> moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD) {
> -        super(name, moduleURI, moduleFile, targetPath, specDD,  
> vendorDD, null);
> +    public AppClientModule(String name, URI configId, URI parentId,  
> URI moduleURI, JarFile moduleFile, String targetPath, XmlObject  
> specDD, XmlObject vendorDD, String originalSpecDD) {
> +        super(name, configId, parentId, moduleURI, moduleFile,  
> targetPath, specDD, vendorDD, originalSpecDD);
> +    }
> +
> +    public ConfigurationModuleType getType() {
> +        return ConfigurationModuleType.APP_CLIENT;
>      }
>  }
> +
>
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ConnectorModule.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ConnectorModule.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ConnectorModule.java	Sun Sep 26 03:05:01 2004
> @@ -20,13 +20,18 @@
>  import java.util.jar.JarFile;
>
>  import org.apache.xmlbeans.XmlObject;
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public class ConnectorModule extends Module {
> -    public ConnectorModule(String name, URI moduleURI, JarFile  
> moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD,  
> String originalSpecDD) {
> -        super(name, moduleURI, moduleFile, targetPath, specDD,  
> vendorDD, originalSpecDD);
> +    public ConnectorModule(String name, URI configId, URI parentId,  
> URI moduleURI, JarFile moduleFile, String targetPath, XmlObject  
> specDD, XmlObject vendorDD, String originalSpecDD) {
> +        super(name, configId, parentId, moduleURI, moduleFile,  
> targetPath, specDD, vendorDD, originalSpecDD);
> +    }
> +
> +    public ConfigurationModuleType getType() {
> +        return ConfigurationModuleType.RAR;
>      }
>  }
>
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilder.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -23,14 +23,12 @@
>  import java.net.URI;
>  import java.net.URISyntaxException;
>  import java.net.URL;
> -import java.util.ArrayList;
>  import java.util.Collections;
>  import java.util.Enumeration;
>  import java.util.HashMap;
>  import java.util.HashSet;
>  import java.util.Iterator;
>  import java.util.LinkedHashSet;
> -import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
>  import java.util.jar.JarFile;
> @@ -48,6 +46,7 @@
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoFactory;
>  import org.apache.geronimo.gbean.jmx.GBeanMBean;
> +import org.apache.geronimo.j2ee.dd.ApplicationInfo;
>  import org.apache.geronimo.j2ee.management.impl.J2EEApplicationImpl;
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.config.ConfigurationModuleType;
> @@ -60,23 +59,14 @@
>  import org.apache.geronimo.xbeans.geronimo.j2ee.GerModuleType;
>  import org.apache.geronimo.xbeans.j2ee.ApplicationType;
>  import org.apache.geronimo.xbeans.j2ee.ModuleType;
> -import org.apache.geronimo.xbeans.j2ee.WebType;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
> +import org.apache.xmlbeans.XmlCursor;
>  import org.apache.xmlbeans.XmlException;
>  import org.apache.xmlbeans.XmlObject;
> -import org.apache.xmlbeans.XmlCursor;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public class EARConfigBuilder implements ConfigurationBuilder {
> -    static final SchemaTypeLoader SCHEMA_TYPE_LOADER =  
> XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
> -         
> XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.Strin 
> g.class.getClassLoader()),
> -         
> XmlBeans.typeLoaderForClassLoader(GerApplicationDocument.class.getClass 
> Loader())
> -    });
> -
> -
>      private static final String PARENT_ID =  
> "org/apache/geronimo/Server";
>
>      private final Kernel kernel;
> @@ -113,107 +103,128 @@
>          this.nonTransactionalTimerObjectName =  
> nonTransactionalTimerObjectName;
>      }
>
> -    public boolean canConfigure(XmlObject plan) {
> -        if (plan instanceof GerApplicationType) {
> -            return true;
> -        }
> -        if (ejbConfigBuilder != null &&  
> ejbConfigBuilder.canHandlePlan(plan)) {
> -            return true;
> -        }
> -        if (webConfigBuilder != null &&  
> webConfigBuilder.canHandlePlan(plan)) {
> -            return true;
> -        }
> -        if (connectorConfigBuilder != null &&  
> connectorConfigBuilder.canHandlePlan(plan)) {
> -            return true;
> -        }
> -        if (appClientConfigBuilder != null &&  
> appClientConfigBuilder.canHandlePlan(plan)) {
> -            return true;
> +    public Object getDeploymentPlan(File planFile, JarFile jarFile)  
> throws DeploymentException {
> +        if (jarFile == null) {
> +            return null;
>          }
> -        return false;
> -    }
>
> -    public SchemaTypeLoader[] getTypeLoaders() {
> -        List typeLoaders = new ArrayList();
> -        typeLoaders.add(SCHEMA_TYPE_LOADER);
> -        if (ejbConfigBuilder != null) {
> -            typeLoaders.add(ejbConfigBuilder.getSchemaTypeLoader());
> +        Object plan = getEarPlan(planFile, jarFile);
> +        if (plan != null) {
> +            return plan;
>          }
> +
> +        // give the module the default name of the module file
> +        String name = new File(jarFile.getName()).getName();
> +
> +        // get the modules either the application plan or for a stand  
> alone module from the specific deployer
> +        Module module = null;
>          if (webConfigBuilder != null) {
> -            typeLoaders.add(webConfigBuilder.getSchemaTypeLoader());
> +            module = webConfigBuilder.createModule(name, planFile,  
> jarFile, null, null);
> +        }
> +        if (module == null && ejbConfigBuilder != null) {
> +            module = ejbConfigBuilder.createModule(name, planFile,  
> jarFile, null, null);
>          }
> -        if (connectorConfigBuilder != null) {
> -             
> typeLoaders.add(connectorConfigBuilder.getSchemaTypeLoader());
> +        if (module == null && connectorConfigBuilder != null) {
> +            module = connectorConfigBuilder.createModule(name,  
> planFile, jarFile, null, null);
>          }
> -        if (appClientConfigBuilder != null) {
> -             
> typeLoaders.add(appClientConfigBuilder.getSchemaTypeLoader());
> +        if (module == null && appClientConfigBuilder != null) {
> +            module = appClientConfigBuilder.createModule(name,  
> planFile, jarFile, null, null);
>          }
> -        return (SchemaTypeLoader[]) typeLoaders.toArray(new  
> SchemaTypeLoader[typeLoaders.size()]);
> +        if (module == null) {
> +            throw new DeploymentException("Could not build module  
> list; Unknown plan type");
> +        }
> +
> +        // in the case of a stand alone module we actually want the  
> name to be the
> +        // config id, which may be derived from the module file name  
> set above
> +        module.setName(module.getConfigId().toString());
> +
> +        return new ApplicationInfo(
> +                module.getType(),
> +                module.getConfigId(),
> +                module.getParentId(),
> +                "null",
> +                Collections.singleton(module),
> +                Collections.EMPTY_SET,
> +                null);
>      }
>
> -    public XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException {
> -        URL path = JarUtil.createJarURL(module,  
> "META-INF/geronimo-application.xml");
> +    private Object getEarPlan(File planFile, JarFile earFile) throws  
> DeploymentException {
> +        URL applicationXmlUrl = JarUtil.createJarURL(earFile,  
> "META-INF/application.xml");
>
> +        ApplicationType application;
>          try {
> -            XmlObject xmlObject = SchemaConversionUtils.parse(path);
> -            xmlObject =  
> SchemaConversionUtils.getNestedObjectAsType(xmlObject, "application",  
> GerApplicationType.type);
> -            SchemaConversionUtils.validateDD(xmlObject);
> -            return (GerApplicationType) xmlObject;
> -        } catch (IOException e) {
> -        } catch (XmlException e) {
> -            throw new DeploymentException(e);
> +            XmlObject xmlObject =  
> SchemaConversionUtils.parse(applicationXmlUrl);
> +            application =   
> SchemaConversionUtils.convertToApplicationSchema(xmlObject).getApplicat 
> ion();
> +        } catch (Exception e) {
> +            return null;
>          }
> -
> -        // try to create a default plan (will return null if this is  
> not an ear file)
> -        GerApplicationType defaultPlan = createDefaultPlan(module);
> -        if (defaultPlan != null) {
> -            return defaultPlan;
> +        if (application == null) {
> +            return null;
>          }
>
> -        // support a naked modules
> -        if (webConfigBuilder != null) {
> -            XmlObject plan =  
> webConfigBuilder.getDeploymentPlan(module);
> -            if (plan != null) {
> -                return plan;
> +        GerApplicationType gerApplication = null;
> +        try {
> +            // load the geronimo-application.xml from either the  
> supplied plan or from the earFile
> +            GerApplicationDocument gerApplicationDoc = null;
> +            try {
> +                if (planFile != null) {
> +                    gerApplicationDoc =  
> GerApplicationDocument.Factory.parse(planFile);
> +                } else {
> +                    URL path = JarUtil.createJarURL(earFile,  
> "META-INF/geronimo-application.xml");
> +                    gerApplicationDoc =  
> GerApplicationDocument.Factory.parse(path);
> +                }
> +            } catch (IOException e) {
>              }
> -        }
>
> -        if (ejbConfigBuilder != null) {
> -            XmlObject plan =  
> ejbConfigBuilder.getDeploymentPlan(module);
> -            if (plan != null) {
> -                return plan;
> +            // if we got one extract the validate it otherwise create  
> a default one
> +            if (gerApplicationDoc != null) {
> +                SchemaConversionUtils.validateDD(gerApplicationDoc);
> +                gerApplication = gerApplicationDoc.getApplication();
> +            } else {
> +                gerApplication = createDefaultPlan(application,  
> earFile);
>              }
> +        } catch (XmlException e) {
> +            throw new DeploymentException(e);
>          }
>
> -        if (connectorConfigBuilder != null) {
> -            XmlObject plan =  
> connectorConfigBuilder.getDeploymentPlan(module);
> -            if (plan != null) {
> -                return plan;
> -            }
> +        // get the ids from either the application plan or for a  
> stand alone module from the specific deployer
> +        URI configId = null;
> +        try {
> +            configId = new URI(gerApplication.getConfigId());
> +        } catch (URISyntaxException e) {
> +            throw new DeploymentException("Invalid configId " +  
> gerApplication.getConfigId(), e);
>          }
>
> -        if (appClientConfigBuilder != null) {
> -            XmlObject plan =  
> appClientConfigBuilder.getDeploymentPlan(module);
> -            if (plan != null) {
> -                return plan;
> +        URI parentId = null;
> +        if (gerApplication.isSetParentId()) {
> +            try {
> +                parentId = new URI(gerApplication.getParentId());
> +            } catch (URISyntaxException e) {
> +                throw new DeploymentException("Invalid parentId " +  
> gerApplication.getParentId(), e);
>              }
>          }
>
> -        return null;
> -    }
> -
> -    private GerApplicationType createDefaultPlan(JarFile module)  
> throws DeploymentException {
> -        // load the web.xml
> -        URL applicationXmlUrl = JarUtil.createJarURL(module,  
> "META-INF/application.xml");
> -
> -        ApplicationType application = null;
> +        // get the modules either the application plan or for a stand  
> alone module from the specific deployer
> +        Set moduleLocations = new HashSet();
> +        Set modules = new LinkedHashSet();
>          try {
> -            application = parseSpecDD(applicationXmlUrl);
> -        } catch (DeploymentException e) {
> -        }
> -        if (application == null) {
> -            return null;
> +            addModules(earFile, application, gerApplication,  
> moduleLocations, modules);
> +        } catch (IOException e) {
> +            throw new DeploymentException(e);
>          }
>
> +        return new ApplicationInfo(
> +                ConfigurationModuleType.EAR,
> +                configId,
> +                parentId,
> +                configId.toString(),
> +                modules,
> +                moduleLocations,
> +                application.toString());
> +    }
> +
> +
> +    private GerApplicationType createDefaultPlan(ApplicationType  
> application, JarFile module) {
>          // construct the empty geronimo-application.xml
>          GerApplicationType gerApplication =  
> GerApplicationType.Factory.newInstance();
>
> @@ -221,7 +232,6 @@
>          gerApplication.setParentId(PARENT_ID);
>          String id = application.getId();
>          if (id == null) {
> -            // TODO this name is not necessairly the original name  
> specified on the command line which is what we want
>              File fileName = new File(module.getName());
>              id = fileName.getName();
>              if (id.endsWith(".ear")) {
> @@ -236,38 +246,23 @@
>          return gerApplication;
>      }
>
> -    public void buildConfiguration(File outfile, Manifest manifest,  
> JarFile earFile, XmlObject plan) throws IOException,  
> DeploymentException {
> +    public void buildConfiguration(File outfile, Manifest manifest,  
> Object plan, JarFile earFile) throws IOException, DeploymentException  
> {
> +        ApplicationInfo applicationInfo = (ApplicationInfo)plan;
>          FileOutputStream fos = new FileOutputStream(outfile);
>          try {
> -            // get the ids from either the application plan or for a  
> stand alone module from the specific deployer
> -            URI configId = getConfigId(plan);
> -            ConfigurationModuleType type = getType(plan);
> -            URI parentId = getParentId(plan);
> -
> -            // get the modules either the application plan or for a  
> stand alone module from the specific deployer
> -            Set moduleLocations = new HashSet();
> -            Set modules = new LinkedHashSet();
> -            ApplicationType application = addModules(earFile, plan,  
> configId, moduleLocations, modules);
> -            // if this is an ear, the application name is the  
> configId; otherwise application name is "null"
> -            String applicationName;
> -            if (application != null) {
> -                applicationName = configId.toString();
> -            } else {
> -                applicationName = "null";
> -            }
> -
>              // Create the output ear context
>              JarOutputStream os = new JarOutputStream(new  
> BufferedOutputStream(fos));
>              EARContext earContext = null;
> +            ConfigurationModuleType applicationType =  
> applicationInfo.getType();
>              try {
>                  earContext = new EARContext(os,
> -                        configId,
> -                        type,
> -                        parentId,
> +                        applicationInfo.getConfigId(),
> +                        applicationType,
> +                        applicationInfo.getParentId(),
>                          kernel,
>                          j2eeDomainName,
>                          j2eeServerName,
> -                        applicationName,
> +                        applicationInfo.getApplicationName(),
>                          transactionContextManagerObjectName,
>                          connectionTrackerObjectName,
>                          transactionalTimerObjectName,
> @@ -277,7 +272,8 @@
>              }
>
>              // Copy over all files that are _NOT_ modules
> -            if (application != null) {
> +            Set moduleLocations =  
> applicationInfo.getModuleLocations();
> +            if (ConfigurationModuleType.EAR == applicationType) {
>                  for (Enumeration e = earFile.entries();  
> e.hasMoreElements();) {
>                      ZipEntry entry = (ZipEntry) e.nextElement();
>                      if (!moduleLocations.contains(entry.getName())) {
> @@ -296,6 +292,7 @@
>              }
>
>              // each module installs it's files into the output  
> context.. this is different for each module type
> +            Set modules = applicationInfo.getModules();
>              for (Iterator iterator = modules.iterator();  
> iterator.hasNext();) {
>                  Module module = (Module) iterator.next();
>                  getBuilder(module).installModule(earFile, earContext,  
> module);
> @@ -318,10 +315,10 @@
>              }
>
>              // Create the J2EEApplication managed object
> -            if (application != null) {
> +            if (ConfigurationModuleType.EAR == applicationType) {
>                  GBeanMBean gbean = new  
> GBeanMBean(J2EEApplicationImpl.GBEAN_INFO, cl);
>                  try {
> -                    gbean.setAttribute("deploymentDescriptor",  
> application.toString());
> +                    gbean.setAttribute("deploymentDescriptor",  
> applicationInfo.getSpecDD());
>                  } catch (Exception e) {
>                      throw new DeploymentException("Error initializing  
> J2EEApplication managed object");
>                  }
> @@ -342,135 +339,98 @@
>          }
>      }
>
> -    private ApplicationType addModules(JarFile earFile, XmlObject  
> plan, URI configId, Set moduleLocations, Set modules) throws  
> IOException, DeploymentException {
> -        if (plan instanceof GerApplicationType) {
> -            URL applicationXmlUrl = JarUtil.createJarURL(earFile,  
> "META-INF/application.xml");
> +    private void addModules(JarFile earFile, ApplicationType  
> application, GerApplicationType gerApplication, Set moduleLocations,  
> Set modules) throws IOException, DeploymentException {
> +        // build map from module path to alt vendor dd
> +        Map altVendorDDs = new HashMap();
> +        GerModuleType gerModuleTypes[] =  
> gerApplication.getModuleArray();
> +        for (int i = 0; i < gerModuleTypes.length; i++) {
> +            GerModuleType gerModule = gerModuleTypes[i];
> +            String path = null;
> +            if (gerModule.isSetAltDd()) {
> +                // the the url of the alt dd
> +                if (gerModule.isSetEjb()) {
> +                    path = gerModule.getEjb().getStringValue();
> +                } else if (gerModule.isSetWeb()) {
> +                    path = gerModule.getWeb().getStringValue();
> +                } else if (gerModule.isSetConnector()) {
> +                    path = gerModule.getConnector().getStringValue();
> +                } else if (gerModule.isSetJava()) {
> +                    path = gerModule.getJava().getStringValue();
> +                }
>
> -            ApplicationType application = null;
> -            try {
> -                application = parseSpecDD(applicationXmlUrl);
> -            } catch (DeploymentException e) {
> -            }
> -            if (application == null) {
> -                return null;
> +                altVendorDDs.put(path, JarUtil.toFile(earFile,  
> gerModule.getAltDd().getStringValue()));
> +            } else {
> +                //dd is included explicitly
> +                XmlCursor cursor = gerModule.newCursor();
> +                try {
> +                    cursor.toFirstChild();
> +                    cursor.toNextSibling();
> +                    //should be at the "any" element
> +                    XmlObject any = cursor.getObject();
> +                    altVendorDDs.put(path, any);
> +                } finally {
> +                    cursor.dispose();
> +                }
>              }
> +        }
>
> -            // build map from module path to alt vendor dd
> -            Map altVendorDDs = new HashMap();
> -            GerApplicationType gerApplication = (GerApplicationType)  
> plan;
> -            GerModuleType gerModuleTypes[] =  
> gerApplication.getModuleArray();
> -            for (int i = 0; i < gerModuleTypes.length; i++) {
> -                GerModuleType gerModuleType = gerModuleTypes[i];
> -                String path = null;
> -                if (gerModuleType.isSetAltDd()) {
> -                    if (gerModuleType.isSetEjb()) {
> -                        path =  
> gerModuleType.getEjb().getStringValue();
> -                    } else if (gerModuleType.isSetWeb()) {
> -                        path =  
> gerModuleType.getWeb().getStringValue();
> -                    } else if (gerModuleType.isSetConnector()) {
> -                        path =  
> gerModuleType.getConnector().getStringValue();
> -                    }
> -                    URL ddURL = JarUtil.createJarURL(earFile,  
> gerModuleType.getAltDd().getStringValue());
> -                    XmlObject dd = null;
> -                    try {
> -                        dd =  
> SchemaConversionUtils.parse(ddURL.openStream());
> -                    } catch (XmlException e) {
> -                        throw new DeploymentException(e);
> -                    }
>
> -                    altVendorDDs.put(path, dd);
> -                } else {
> -                    //dd is included explicitly
> -                    XmlCursor cursor = gerModuleType.newCursor();
> -                    try {
> -                        cursor.toFirstChild();
> -                        cursor.toNextSibling();
> -                        //should be at the "any" element
> -                        XmlObject any = cursor.getObject();
> -                        altVendorDDs.put(path, any);
> -                    } finally {
> -                        cursor.dispose();
> -                    }
> +        // get a set containing all of the files in the ear that are  
> actually modules
> +        ModuleType[] moduleTypes = application.getModuleArray();
> +        for (int i = 0; i < moduleTypes.length; i++) {
> +            ModuleType moduleXml = moduleTypes[i];
> +
> +            String modulePath;
> +            ModuleBuilder builder;
> +
> +            if (moduleXml.isSetEjb()) {
> +                modulePath = moduleXml.getEjb().getStringValue();
> +                if (ejbConfigBuilder == null) {
> +                    throw new DeploymentException("Can not deploy ejb  
> application; No ejb deployer defined: " + modulePath);
>                  }
> +                builder = ejbConfigBuilder;
> +            } else if (moduleXml.isSetWeb()) {
> +                modulePath =  
> moduleXml.getWeb().getWebUri().getStringValue();
> +                if (webConfigBuilder == null) {
> +                    throw new DeploymentException("Can not deploy web  
> application; No war deployer defined: " + modulePath);
> +                }
> +                builder = webConfigBuilder;
> +            } else if (moduleXml.isSetConnector()) {
> +                modulePath =  
> moduleXml.getConnector().getStringValue();
> +                if (connectorConfigBuilder == null) {
> +                    throw new DeploymentException("Can not deploy  
> resource adapter; No rar deployer defined: " + modulePath);
> +                }
> +                builder = connectorConfigBuilder;
> +            } else if (moduleXml.isSetJava()) {
> +                modulePath = moduleXml.getJava().getStringValue();
> +                if (appClientConfigBuilder == null) {
> +                    throw new DeploymentException("Can not deploy app  
> client; No app client deployer defined: " + modulePath);
> +                }
> +                builder = appClientConfigBuilder;
> +            } else {
> +                throw new DeploymentException("Could not find a  
> module builder for module: " + moduleXml);
>              }
>
> +            moduleLocations.add(modulePath);
>
> -            // get a set containing all of the files in the ear that  
> are actually modules
> -            ModuleType[] moduleTypes = application.getModuleArray();
> -
> -            for (int i = 0; i < moduleTypes.length; i++) {
> -                ModuleType moduleXml = moduleTypes[i];
> -
> -                String modulePath = null;
> -                ModuleBuilder builder = null;
> -                String webContextRoot = null;
> -
> -                if (moduleXml.isSetEjb()) {
> -                    modulePath = moduleXml.getEjb().getStringValue();
> -                    if (ejbConfigBuilder == null) {
> -                        throw new DeploymentException("Can not deploy  
> ejb application; No ejb deployer defined: " + modulePath);
> -                    }
> -                    builder = ejbConfigBuilder;
> -                } else if (moduleXml.isSetWeb()) {
> -                    WebType web = moduleXml.getWeb();
> -                    modulePath = web.getWebUri().getStringValue();
> -                    webContextRoot =  
> web.getContextRoot().getStringValue();
> -                    if (webConfigBuilder == null) {
> -                        throw new DeploymentException("Can not deploy  
> web application; No war deployer defined: " + modulePath);
> -                    }
> -                    builder = webConfigBuilder;
> -                } else if (moduleXml.isSetConnector()) {
> -                    modulePath =  
> moduleXml.getConnector().getStringValue();
> -                    if (connectorConfigBuilder == null) {
> -                        throw new DeploymentException("Can not deploy  
> resource adapter; No rar deployer defined: " + modulePath);
> -                    }
> -                    builder = connectorConfigBuilder;
> -                } else if (moduleXml.isSetJava()) {
> -                    modulePath = moduleXml.getJava().getStringValue();
> -                    if (appClientConfigBuilder == null) {
> -                        throw new DeploymentException("Can not deploy  
> app client; No app client deployer defined: " + modulePath);
> -                    }
> -                    builder = appClientConfigBuilder;
> -                }
> -                if (builder != null) {
> -                    moduleLocations.add(modulePath);
> -
> -                    URL altSpecDD = null;
> -                    if (moduleXml.isSetAltDd()) {
> -                        altSpecDD = JarUtil.createJarURL(earFile,  
> moduleXml.getAltDd().getStringValue());
> -                    }
> +            URL altSpecDD = null;
> +            if (moduleXml.isSetAltDd()) {
> +                altSpecDD = JarUtil.createJarURL(earFile,  
> moduleXml.getAltDd().getStringValue());
> +            }
>
> -                    XmlObject vendorDD = (XmlObject)  
> altVendorDDs.get(modulePath);
> -                    if (vendorDD != null) {
> -                        vendorDD = builder.validateVendorDD(vendorDD);
> -                        if (vendorDD == null) {
> -                            throw new DeploymentException("Invalid  
> alt vendor dd: modulePath=" + modulePath);
> -                        }
> -                    }
> +            Module module = builder.createModule(
> +                    modulePath,
> +                    altVendorDDs.get(modulePath),
> +                    new NestedJarFile(earFile, modulePath),
> +                    altSpecDD,
> +                    modulePath);
>
> -                    Module module = builder.createModule(modulePath,  
> new NestedJarFile(earFile, modulePath), vendorDD, modulePath,  
> altSpecDD);
> -                    if (module instanceof WebModule) {
> -                        ((WebModule)  
> module).setContextRoot(webContextRoot);
> -                    }
> -
> -                    modules.add(module);
> -                }
> +            if (module instanceof WebModule) {
> +                ((WebModule)  
> module).setContextRoot(moduleXml.getWeb().getContextRoot().getStringVal 
> ue());
>              }
> -            return application;
> -        } else if (webConfigBuilder != null &&  
> webConfigBuilder.canHandlePlan(plan)) {
> -             
> modules.add(webConfigBuilder.createModule(configId.toString(),  
> earFile, plan));
> -            return null;
> -        } else if (ejbConfigBuilder != null &&  
> ejbConfigBuilder.canHandlePlan(plan)) {
> -             
> modules.add(ejbConfigBuilder.createModule(configId.toString(),  
> earFile, plan));
> -            return null;
> -        } else if (connectorConfigBuilder != null &&  
> connectorConfigBuilder.canHandlePlan(plan)) {
> -             
> modules.add(connectorConfigBuilder.createModule(configId.toString(),  
> earFile, plan));
> -            return null;
> -        } else if (appClientConfigBuilder != null &&  
> appClientConfigBuilder.canHandlePlan(plan)) {
> -             
> modules.add(appClientConfigBuilder.createModule(configId.toString(),  
> earFile, plan));
> -            return null;
> +
> +            modules.add(module);
>          }
> -        throw new DeploymentException("Could not build module list;  
> Unknown plan type");
>      }
>
>      private ModuleBuilder getBuilder(Module module) throws  
> DeploymentException {
> @@ -496,125 +456,6 @@
>              return appClientConfigBuilder;
>          }
>          throw new IllegalArgumentException("Unknown module type: " +  
> module.getClass().getName());
> -    }
> -
> -    private ApplicationType parseSpecDD(URL url) throws  
> DeploymentException {
> -        try {
> -            XmlObject xmlObject = SchemaConversionUtils.parse(url);
> -            return  
> SchemaConversionUtils.convertToApplicationSchema(xmlObject).getApplicat 
> ion();
> -        } catch (Exception e) {
> -            throw new DeploymentException(e);
> -        }
> -    }
> -
> -    private URI getParentId(XmlObject plan) throws  
> DeploymentException {
> -        if (plan instanceof GerApplicationType) {
> -            GerApplicationType application = (GerApplicationType)  
> plan;
> -            if (application.isSetParentId()) {
> -                try {
> -                    return new URI(application.getParentId());
> -                } catch (URISyntaxException e) {
> -                    throw new DeploymentException("Invalid parentId "  
> + application.getParentId(), e);
> -                }
> -            } else {
> -                return null;
> -            }
> -        }
> -
> -        if (webConfigBuilder != null) {
> -            if (webConfigBuilder.canHandlePlan(plan)) {
> -                return webConfigBuilder.getParentId(plan);
> -            }
> -        }
> -
> -        if (ejbConfigBuilder != null) {
> -            if (ejbConfigBuilder.canHandlePlan(plan)) {
> -                return ejbConfigBuilder.getParentId(plan);
> -            }
> -        }
> -
> -        if (connectorConfigBuilder != null) {
> -            if (connectorConfigBuilder.canHandlePlan(plan)) {
> -                return connectorConfigBuilder.getParentId(plan);
> -            }
> -        }
> -
> -        if (appClientConfigBuilder != null) {
> -            if (appClientConfigBuilder.canHandlePlan(plan)) {
> -                return appClientConfigBuilder.getParentId(plan);
> -            }
> -        }
> -
> -        return null;
> -    }
> -
> -    private URI getConfigId(XmlObject plan) throws  
> DeploymentException {
> -        if (plan instanceof GerApplicationType) {
> -            GerApplicationType application = (GerApplicationType)  
> plan;
> -            try {
> -                return new URI(application.getConfigId());
> -            } catch (URISyntaxException e) {
> -                throw new DeploymentException("Invalid configId " +  
> application.getConfigId(), e);
> -            }
> -        }
> -
> -        if (webConfigBuilder != null) {
> -            if (webConfigBuilder.canHandlePlan(plan)) {
> -                return webConfigBuilder.getConfigId(plan);
> -            }
> -        }
> -
> -        if (ejbConfigBuilder != null) {
> -            if (ejbConfigBuilder.canHandlePlan(plan)) {
> -                return ejbConfigBuilder.getConfigId(plan);
> -            }
> -        }
> -
> -        if (connectorConfigBuilder != null) {
> -            if (connectorConfigBuilder.canHandlePlan(plan)) {
> -                return connectorConfigBuilder.getConfigId(plan);
> -            }
> -        }
> -
> -        if (appClientConfigBuilder != null) {
> -            if (appClientConfigBuilder.canHandlePlan(plan)) {
> -                return appClientConfigBuilder.getConfigId(plan);
> -            }
> -        }
> -
> -        throw new DeploymentException("Could not determine config  
> id");
> -    }
> -
> -    private ConfigurationModuleType getType(XmlObject plan) throws  
> DeploymentException {
> -        if (plan instanceof GerApplicationType) {
> -            return ConfigurationModuleType.EAR;
> -        }
> -
> -        if (webConfigBuilder != null) {
> -            if (webConfigBuilder.canHandlePlan(plan)) {
> -                return ConfigurationModuleType.WAR;
> -            }
> -        }
> -
> -        if (ejbConfigBuilder != null) {
> -            if (ejbConfigBuilder.canHandlePlan(plan)) {
> -                return ConfigurationModuleType.EJB;
> -            }
> -        }
> -
> -        if (connectorConfigBuilder != null) {
> -            if (connectorConfigBuilder.canHandlePlan(plan)) {
> -                return ConfigurationModuleType.RAR;
> -            }
> -        }
> -
> -        if (appClientConfigBuilder != null) {
> -            if (appClientConfigBuilder.canHandlePlan(plan)) {
> -                return ConfigurationModuleType.APP_CLIENT;
> -            }
> -        }
> -
> -        throw new DeploymentException("Could not determine type");
>      }
>
>      private URI getDependencyURI(GerDependencyType dep) throws  
> DeploymentException {
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EJBModule.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EJBModule.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/EJBModule.java	Sun Sep 26 03:05:01 2004
> @@ -20,13 +20,18 @@
>  import java.util.jar.JarFile;
>
>  import org.apache.xmlbeans.XmlObject;
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public class EJBModule extends Module {
> -    public EJBModule(String name, URI moduleURI, JarFile moduleFile,  
> String targetPath, XmlObject specDD, XmlObject vendorDD, String  
> originalSpecDD) {
> -        super(name, moduleURI, moduleFile, targetPath, specDD,  
> vendorDD, originalSpecDD);
> +    public EJBModule(String name, URI configId, URI parentId, URI  
> moduleURI, JarFile moduleFile, String targetPath, XmlObject specDD,  
> XmlObject vendorDD, String originalSpecDD) {
> +        super(name, configId, parentId, moduleURI, moduleFile,  
> targetPath, specDD, vendorDD, originalSpecDD);
> +    }
> +
> +    public ConfigurationModuleType getType() {
> +        return ConfigurationModuleType.EJB;
>      }
>  }
>
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/Module.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/Module.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/Module.java	Sun Sep 26 03:05:01 2004
> @@ -20,12 +20,15 @@
>  import java.net.URI;
>
>  import org.apache.xmlbeans.XmlObject;
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>
>  /**
>   * @version $Rev$ $Date$
>   */
> -public class Module {
> -    private final String name;
> +public abstract class Module {
> +    private String name;
> +    private final URI configId;
> +    private final URI parentId;
>      private final URI moduleURI;
>      private final JarFile moduleFile;
>      private final String targetPath;
> @@ -33,8 +36,10 @@
>      private final XmlObject vendorDD;
>      private final String originalSpecDD;
>
> -    public Module(String name, URI moduleURI, JarFile moduleFile,  
> String targetPath, XmlObject specDD, XmlObject vendorDD, String  
> originalSpecDD) {
> +    public Module(String name, URI configId, URI parentId, URI  
> moduleURI, JarFile moduleFile, String targetPath, XmlObject specDD,  
> XmlObject vendorDD, String originalSpecDD) {
>          this.name = name;
> +        this.configId = configId;
> +        this.parentId = parentId;
>          this.moduleURI = moduleURI;
>          this.moduleFile = moduleFile;
>          this.targetPath = targetPath;
> @@ -43,8 +48,22 @@
>          this.originalSpecDD = originalSpecDD;
>      }
>
> +    public abstract ConfigurationModuleType  getType();
> +
>      public String getName() {
>          return name;
> +    }
> +
> +    public void setName(String name) {
> +        this.name = name;
> +    }
> +
> +    public URI getConfigId() {
> +        return configId;
> +    }
> +
> +    public URI getParentId() {
> +        return parentId;
>      }
>
>      public URI getModuleURI() {
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ModuleBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ModuleBuilder.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/ModuleBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -16,33 +16,16 @@
>   */
>  package org.apache.geronimo.j2ee.deployment;
>
> -import java.net.URI;
>  import java.net.URL;
>  import java.util.jar.JarFile;
>
>  import org.apache.geronimo.deployment.DeploymentException;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public interface ModuleBuilder {
> -    XmlObject parseSpecDD(URL path) throws DeploymentException;
> -
> -    XmlObject validateVendorDD(XmlObject vendorDD) throws  
> DeploymentException;
> -
> -    XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException;
> -
> -    boolean canHandlePlan(XmlObject plan);
> -
> -    Module createModule(String name, JarFile moduleFile, XmlObject  
> vendorDD) throws DeploymentException;
> -
> -    Module createModule(String name, JarFile moduleFile, XmlObject  
> vendorDD, String targetPath, URL specDD) throws DeploymentException;
> -
> -    URI getParentId(XmlObject plan) throws DeploymentException;
> -
> -    URI getConfigId(XmlObject plan) throws DeploymentException;
> +    Module createModule(String name, Object planFile, JarFile  
> moduleFile, URL specDDUrl, String targetPath) throws  
> DeploymentException;
>
>      void installModule(JarFile earFile, EARContext earContext, Module  
> module) throws DeploymentException;
>
> @@ -50,5 +33,4 @@
>
>      void addGBeans(EARContext earContext, Module module, ClassLoader  
> cl) throws DeploymentException;
>
> -    SchemaTypeLoader getSchemaTypeLoader();
>  }
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/WebModule.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/WebModule.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/ 
> deployment/WebModule.java	Sun Sep 26 03:05:01 2004
> @@ -20,6 +20,7 @@
>  import java.net.URI;
>
>  import org.apache.xmlbeans.XmlObject;
> +import org.apache.geronimo.kernel.config.ConfigurationModuleType;
>
>  /**
>   * @version $Rev$ $Date$
> @@ -27,8 +28,8 @@
>  public class WebModule extends Module {
>      private String contextRoot;
>
> -    public WebModule(String name, URI moduleURI, JarFile moduleFile,  
> String targetPath, XmlObject specDD, XmlObject vendorDD, String  
> originalSpecDD) {
> -        super(name, moduleURI, moduleFile, targetPath, specDD,  
> vendorDD, originalSpecDD);
> +    public WebModule(String name, URI configId, URI parentId, URI  
> moduleURI, JarFile moduleFile, String targetPath, XmlObject specDD,  
> XmlObject vendorDD, String originalSpecDD) {
> +        super(name, configId, parentId, moduleURI, moduleFile,  
> targetPath, specDD, vendorDD, originalSpecDD);
>      }
>
>      public String getContextRoot() {
> @@ -37,6 +38,10 @@
>
>      public void setContextRoot(String contextRoot) {
>          this.contextRoot = contextRoot;
> +    }
> +
> +    public ConfigurationModuleType getType() {
> +        return ConfigurationModuleType.WAR;
>      }
>  }
>
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilderTest.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilderTest.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/EARConfigBuilderTest.java	Sun Sep 26 03:05:01 2004
> @@ -29,7 +29,6 @@
>  import org.apache.geronimo.deployment.DeploymentException;
>  import org.apache.geronimo.deployment.util.JarUtil;
>  import org.apache.geronimo.kernel.jmx.JMXUtil;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * @version $Rev$ $Date$
> @@ -55,11 +54,11 @@
>          TestSetup setup14 = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-ear14/test-ear.ear"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", URI.create("test-ejb-jar.jar"), null,  
> "test-ejb-jar.jar", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", null, null,  
> URI.create("test-ejb-jar.jar"), null, "test-ejb-jar.jar", null, null,  
> null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war", URI.create("test-war.war"), null,  
> "test-war.war", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war", null, null, URI.create("test-war.war"),  
> null, "test-war.war", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -68,11 +67,11 @@
>          TestSetup setupNaked14 = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-ear14/test-naked-ear.ear"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", URI.create("test-ejb-jar.jar"), null,  
> "test-ejb-jar.jar", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", null, null,  
> URI.create("test-ejb-jar.jar"), null, "test-ejb-jar.jar", null, null,  
> null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war", URI.create("test-war.war"), null,  
> "test-war.war", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war", null, null, URI.create("test-war.war"),  
> null, "test-war.war", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -81,11 +80,11 @@
>          TestSetup setup13 = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-ear13/test-ear.ear"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", URI.create("test-ejb-jar.jar"), null,  
> "test-ejb-jar.jar", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", null, null,  
> URI.create("test-ejb-jar.jar"), null, "test-ejb-jar.jar", null, null,  
> null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war", URI.create("test-war.war"), null,  
> "test-war.war", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war", null, null, URI.create("test-war.war"),  
> null, "test-war.war", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -94,11 +93,11 @@
>          TestSetup setupNaked13 = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,  
> "target/test-ear13/test-naked-ear.ear"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", URI.create("test-ejb-jar.jar"), null,  
> "test-ejb-jar.jar", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar", null, null,  
> URI.create("test-ejb-jar.jar"), null, "test-ejb-jar.jar", null, null,  
> null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war", URI.create("test-war.war"), null,  
> "test-war.war", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war", null, null, URI.create("test-war.war"),  
> null, "test-war.war", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -107,11 +106,11 @@
>          TestSetup setupUnpacked = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-unpacked-ear/full/"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", URI.create("test-ejb-jar.jar/"), null,  
> "test-ejb-jar.jar/", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", null, null,  
> URI.create("test-ejb-jar.jar/"), null, "test-ejb-jar.jar/", null,  
> null, null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", URI.create("test-war.war/"), null,  
> "test-war.war/", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", null, null, URI.create("test-war.war/"),  
> null, "test-war.war/", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -120,11 +119,11 @@
>          TestSetup setupUnpackedNaked = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-unpacked-ear/naked/"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", URI.create("test-ejb-jar.jar/"), null,  
> "test-ejb-jar.jar/", null, null, null);
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", null, null,  
> URI.create("test-ejb-jar.jar/"), null, "test-ejb-jar.jar/", null,  
> null, null);
>                  webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", URI.create("test-war.war/"), null,  
> "test-war.war", null, null, null);
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", null, null, URI.create("test-war.war/"),  
> null, "test-war.war", null, null, null);
>                  webConfigBuilder.webModule.setContextRoot("test");
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -133,17 +132,11 @@
>          TestSetup setupUnpackedAltDD = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-unpacked-ear/alt-dd/"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", URI.create("test-ejb-jar.jar/"), null,  
> "test-ejb-jar.jar/", null, null, null);
> -//                ejbConfigBuilder.ejbModule.setAltSpecDD(new  
> File(earFile, "alt-ejb-jar.xml").toURL());
> -//                ejbConfigBuilder.ejbModule.setAltVendorDD(new  
> File(earFile, "alt-ger-ejb-jar.xml").toURL());
> -                webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", URI.create("test-war.war/"), null,  
> "test-war.war/", null, null, null);
> -                webConfigBuilder.webModule.setContextRoot("test");
> -//                webConfigBuilder.webModule.setAltSpecDD(new  
> File(earFile, "alt-web.xml").toURL());
> -//                webConfigBuilder.webModule.setAltVendorDD(new  
> File(earFile, "alt-ger-war.xml").toURL());
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> -//                 
> connectorConfigBuilder.connectorModule.setAltSpecDD(new File(earFile,  
> "alt-ra.xml").toURL());
> -//                 
> connectorConfigBuilder.connectorModule.setAltVendorDD(new  
> File(earFile, "alt-ger-ra.xml").toURL());
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", null, null,  
> URI.create("test-ejb-jar.jar/"), null, "test-ejb-jar.jar/", null,  
> null, null);
> +                webConfigBuilder.contextRoot = "test";
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", null, null, URI.create("test-war.war/"),  
> null, "test-war.war/", null, null, null);
> +                webConfigBuilder.webModule.setContextRoot("test");
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -152,18 +145,11 @@
>          TestSetup setupPackedAltDD = new TestSetup(inner) {
>              protected void setUp() throws Exception {
>                  earFile = JarUtil.createJarFile(new File(basedir,   
> "target/test-unpacked-ear/alt-dd.ear"));
> -                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", URI.create("test-ejb-jar.jar/"), null,  
> "test-ejb-jar.jar/", null, null, null);
> -//                String baseURI = "jar:" + earFile.toURL() + "!/";
> -//                ejbConfigBuilder.ejbModule.setAltSpecDD(new  
> URL(baseURI + "alt-ejb-jar.xml"));
> -//                ejbConfigBuilder.ejbModule.setAltVendorDD(new  
> URL(baseURI + "alt-ger-ejb-jar.xml"));
> -                webConfigBuilder.contextRoot = "test";
> -                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", URI.create("test-war.war/"), null,  
> "test-war.war/", null, null, null);
> -                webConfigBuilder.webModule.setContextRoot("test");
> -//                webConfigBuilder.webModule.setAltSpecDD(new  
> URL(baseURI + "alt-web.xml"));
> -//                webConfigBuilder.webModule.setAltVendorDD(new  
> URL(baseURI + "alt-ger-war.xml"));
> -                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", URI.create("test-rar.rar"), null,  
> "test-rar.rar", null, null, null);
> -//                 
> connectorConfigBuilder.connectorModule.setAltSpecDD(new URL(baseURI +  
> "alt-ra.xml"));
> -//                 
> connectorConfigBuilder.connectorModule.setAltVendorDD(new URL(baseURI  
> + "alt-ger-ra.xml"));
> +                ejbConfigBuilder.ejbModule = new  
> EJBModule("test-ejb-jar.jar/", null, null,  
> URI.create("test-ejb-jar.jar/"), null, "test-ejb-jar.jar/", null,  
> null, null);
> +                webConfigBuilder.contextRoot = "test";
> +                webConfigBuilder.webModule = new  
> WebModule("test-war.war/", null, null, URI.create("test-war.war/"),  
> null, "test-war.war/", null, null, null);
> +                webConfigBuilder.webModule.setContextRoot("test");
> +                connectorConfigBuilder.connectorModule = new  
> ConnectorModule("test-rar.rar", null, null,  
> URI.create("test-rar.rar"), null, "test-rar.rar", null, null, null);
>              }
>
>              protected void tearDown() {
> @@ -187,8 +173,8 @@
>
>          File carFile = File.createTempFile("EARTest", ".car");
>          try {
> -            XmlObject plan = configBuilder.getDeploymentPlan(earFile);
> -            configBuilder.buildConfiguration(carFile, null, earFile,  
> plan);
> +            Object plan = configBuilder.getDeploymentPlan(null,  
> earFile);
> +            configBuilder.buildConfiguration(carFile, null, plan,  
> earFile);
>          } finally {
>              carFile.delete();
>          }
> @@ -199,8 +185,8 @@
>
>          File carFile = File.createTempFile("EARTest", ".car");
>          try {
> -            XmlObject plan = configBuilder.getDeploymentPlan(earFile);
> -            configBuilder.buildConfiguration(carFile, null, earFile,  
> plan);
> +            Object plan = configBuilder.getDeploymentPlan(null,  
> earFile);
> +            configBuilder.buildConfiguration(carFile, null, plan,  
> earFile);
>              fail("Should have thrown a DeploymentException");
>          } catch (DeploymentException e) {
>              // expected
> @@ -214,8 +200,8 @@
>
>          File carFile = File.createTempFile("EARTest", ".car");
>          try {
> -            XmlObject plan = configBuilder.getDeploymentPlan(earFile);
> -            configBuilder.buildConfiguration(carFile, null, earFile,  
> plan);
> +            Object plan = configBuilder.getDeploymentPlan(null,  
> earFile);
> +            configBuilder.buildConfiguration(carFile, null, plan,  
> earFile);
>              fail("Should have thrown a DeploymentException");
>          } catch (DeploymentException e) {
>              // expected
> @@ -229,8 +215,8 @@
>
>          File carFile = File.createTempFile("EARTest", ".car");
>          try {
> -            XmlObject plan = configBuilder.getDeploymentPlan(earFile);
> -            configBuilder.buildConfiguration(carFile, null, earFile,  
> plan);
> +            Object plan = configBuilder.getDeploymentPlan(null,  
> earFile);
> +            configBuilder.buildConfiguration(carFile, null, plan,  
> earFile);
>              fail("Should have thrown a DeploymentException");
>          } catch (DeploymentException e) {
>              // expected
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockConnectorConfigBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockConnectorConfigBuilder.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockConnectorConfigBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -16,16 +16,12 @@
>   */
>  package org.apache.geronimo.j2ee.deployment;
>
> -import java.io.IOException;
> -import java.io.InputStream;
> -import java.net.URI;
>  import java.net.URL;
> +import java.net.URI;
>  import java.util.jar.JarFile;
>
>  import junit.framework.Assert;
>  import org.apache.geronimo.deployment.DeploymentException;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * @version $Rev$ $Date$
> @@ -35,28 +31,8 @@
>      public Module connectorModule;
>      public ClassLoader cl;
>
> -    public XmlObject getDeploymentPlan(JarFile module) {
> -        return null;
> -    }
> -
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return false;
> -    }
> -
> -    public URI getParentId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public URI getConfigId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "connector",  
> null);
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDD) throws  
> DeploymentException {
> -        return new ConnectorModule(name, URI.create(targetPath),  
> moduleFile, targetPath, null, vendorDD, null);
> +    public Module createModule(String name, Object planFile, JarFile  
> moduleFile, URL specDDUrl, String targetPath) throws  
> DeploymentException {
> +        return new ConnectorModule(name, null, null,  
> URI.create(targetPath), moduleFile, targetPath, null, null, null);
>      }
>
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module connectorModule) {
> @@ -72,27 +48,6 @@
>  //        }
>      }
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> -        InputStream in = null;
> -        try {
> -            in = path.openStream();
> -            return XmlObject.Factory.newInstance();
> -        } catch (IOException e) {
> -            throw new DeploymentException(e);
> -        } finally {
> -            if (in != null) {
> -                try {
> -                    in.close();
> -                } catch (IOException e) {
> -                }
> -            }
> -        }
> -    }
> -
> -    public XmlObject validateVendorDD(XmlObject vendorDD) throws  
> DeploymentException {
> -        return XmlObject.Factory.newInstance();
> -    }
> -
>      public void initContext(EARContext earContext, Module  
> connectorModule, ClassLoader cl) {
>          assertEquals(this.earContext, earContext);
>  //        assertEquals(this.connectorModule, connectorModule);
> @@ -106,7 +61,4 @@
>          assertEquals(this.cl, cl);
>      }
>
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return null;
> -    }
>  }
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockEJBConfigBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockEJBConfigBuilder.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockEJBConfigBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -16,16 +16,12 @@
>   */
>  package org.apache.geronimo.j2ee.deployment;
>
> -import java.io.IOException;
> -import java.io.InputStream;
> -import java.net.URI;
>  import java.net.URL;
> +import java.net.URI;
>  import java.util.jar.JarFile;
>
>  import junit.framework.Assert;
>  import org.apache.geronimo.deployment.DeploymentException;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * @version $Rev$ $Date$
> @@ -35,28 +31,8 @@
>      public EJBModule ejbModule;
>      public ClassLoader cl;
>
> -    public XmlObject getDeploymentPlan(JarFile module) {
> -        return null;
> -    }
> -
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return false;
> -    }
> -
> -    public URI getParentId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public URI getConfigId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "connector",  
> null);
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDD) throws  
> DeploymentException {
> -        return new EJBModule(name, URI.create(targetPath),  
> moduleFile, targetPath, null, vendorDD, null);
> +    public Module createModule(String name, Object planFile, JarFile  
> moduleFile, URL specDDUrl, String targetPath) throws  
> DeploymentException {
> +        return new EJBModule(name, null, null,  
> URI.create(targetPath), moduleFile, targetPath, null, null, null);
>      }
>
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module ejbModule) {
> @@ -72,27 +48,6 @@
>  //        }
>      }
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> -        InputStream in = null;
> -        try {
> -            in = path.openStream();
> -            return XmlObject.Factory.newInstance();
> -        } catch (IOException e) {
> -            throw new DeploymentException(e);
> -        } finally {
> -            if (in != null) {
> -                try {
> -                    in.close();
> -                } catch (IOException e) {
> -                }
> -            }
> -        }
> -    }
> -
> -    public XmlObject validateVendorDD(XmlObject vendorDD) throws  
> DeploymentException {
> -        return XmlObject.Factory.newInstance();
> -    }
> -
>      public void initContext(EARContext earContext, Module ejbModule,  
> ClassLoader cl) {
>          assertEquals(this.earContext, earContext);
>  //        assertEquals(this.ejbModule, ejbModule);
> @@ -106,7 +61,4 @@
>          assertEquals(this.cl, cl);
>      }
>
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return null;
> -    }
>  }
>
> Modified:  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockWARConfigBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockWARConfigBuilder.java	(original)
> +++  
> geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/ 
> deployment/MockWARConfigBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -16,16 +16,12 @@
>   */
>  package org.apache.geronimo.j2ee.deployment;
>
> -import java.io.IOException;
> -import java.io.InputStream;
> -import java.net.URI;
>  import java.net.URL;
> +import java.net.URI;
>  import java.util.jar.JarFile;
>
>  import junit.framework.Assert;
>  import org.apache.geronimo.deployment.DeploymentException;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlObject;
>
>  /**
>   * @version $Rev$ $Date$
> @@ -36,28 +32,8 @@
>      public ClassLoader cl;
>      public String contextRoot;
>
> -    public XmlObject getDeploymentPlan(JarFile module) {
> -        return null;
> -    }
> -
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return false;
> -    }
> -
> -    public URI getParentId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public URI getConfigId(XmlObject plan) {
> -        return null;
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "connector",  
> null);
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDD) throws  
> DeploymentException {
> -        return new WebModule(name, URI.create(targetPath),  
> moduleFile, targetPath, null, vendorDD, null);
> +    public Module createModule(String name, Object planFile, JarFile  
> moduleFile, URL specDDUrl, String targetPath) throws  
> DeploymentException {
> +        return new WebModule(name, null, null,  
> URI.create(targetPath), moduleFile, targetPath, null, null, null);
>      }
>
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module webModule) throws DeploymentException {
> @@ -73,27 +49,6 @@
>  //        }
>      }
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> -        InputStream in = null;
> -        try {
> -            in = path.openStream();
> -            return XmlObject.Factory.newInstance();
> -        } catch (IOException e) {
> -            throw new DeploymentException(e);
> -        } finally {
> -            if (in != null) {
> -                try {
> -                    in.close();
> -                } catch (IOException e) {
> -                }
> -            }
> -        }
> -    }
> -
> -    public XmlObject validateVendorDD(XmlObject vendorDD) throws  
> DeploymentException {
> -        return XmlObject.Factory.newInstance();
> -    }
> -
>      public void initContext(EARContext earContext, Module webModule,  
> ClassLoader cl) {
>          assertEquals(this.earContext, earContext);
>  //        assertEquals(this.webModule, webModule);
> @@ -109,7 +64,4 @@
>          this.contextRoot = ((WebModule) webModule).getContextRoot();
>      }
>
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return null;
> -    }
>  }
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> deployment/JettyModuleBuilder.java
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> deployment/JettyModuleBuilder.java	(original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> deployment/JettyModuleBuilder.java	Sun Sep 26 03:05:01 2004
> @@ -18,9 +18,9 @@
>  package org.apache.geronimo.jetty.deployment;
>
>  import java.io.ByteArrayInputStream;
> +import java.io.File;
>  import java.io.IOException;
>  import java.io.InputStream;
> -import java.net.MalformedURLException;
>  import java.net.URI;
>  import java.net.URISyntaxException;
>  import java.net.URL;
> @@ -30,7 +30,6 @@
>  import java.util.Map;
>  import java.util.Properties;
>  import java.util.Set;
> -import java.util.jar.JarEntry;
>  import java.util.jar.JarFile;
>  import java.util.zip.ZipEntry;
>  import javax.management.AttributeNotFoundException;
> @@ -39,7 +38,6 @@
>  import javax.management.ReflectionException;
>  import javax.transaction.UserTransaction;
>
> -import org.apache.geronimo.common.xml.XmlBeansUtil;
>  import org.apache.geronimo.deployment.DeploymentException;
>  import org.apache.geronimo.deployment.service.GBeanHelper;
>  import org.apache.geronimo.deployment.util.IOUtil;
> @@ -70,15 +68,13 @@
>  import  
> org.apache.geronimo.xbeans.geronimo.jetty.JettyRoleMappingsType;
>  import org.apache.geronimo.xbeans.geronimo.jetty.JettyRoleType;
>  import org.apache.geronimo.xbeans.geronimo.jetty.JettySecurityType;
> -import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppType;
>  import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppDocument;
> +import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppType;
>  import org.apache.geronimo.xbeans.geronimo.naming.GerLocalRefType;
>  import org.apache.geronimo.xbeans.geronimo.naming.GerRemoteRefType;
>  import org.apache.geronimo.xbeans.j2ee.ResourceRefType;
>  import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
>  import org.apache.geronimo.xbeans.j2ee.WebAppType;
> -import org.apache.xmlbeans.SchemaTypeLoader;
> -import org.apache.xmlbeans.XmlBeans;
>  import org.apache.xmlbeans.XmlException;
>  import org.apache.xmlbeans.XmlObject;
>
> @@ -87,106 +83,107 @@
>   * @version $Rev$ $Date$
>   */
>  public class JettyModuleBuilder implements ModuleBuilder {
> -    static final SchemaTypeLoader SCHEMA_TYPE_LOADER =  
> XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
> -         
> XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.Strin 
> g.class.getClassLoader()),
> -         
> XmlBeans.typeLoaderForClassLoader(JettyWebAppType.class.getClassLoader( 
> ))
> -    });
> -
>      private static final String PARENT_ID =  
> "org/apache/geronimo/Server";
>
> -    public XmlObject parseSpecDD(URL path) throws DeploymentException  
> {
> +    public Module createModule(String name, Object plan, JarFile  
> moduleFile, URL webXmlUrl, String targetPath) throws  
> DeploymentException {
> +        String specDD;
> +        WebAppType webApp;
>          try {
> -            // check if we have an alt spec dd
> -            return parseSpecDD(SchemaConversionUtils.parse(path));
> -        } catch (Exception e) {
> -            throw new DeploymentException("Unable to parse " + path,  
> e);
> -        }
> -    }
> +            if (webXmlUrl == null) {
> +                webXmlUrl = JarUtil.createJarURL(moduleFile,  
> "WEB-INF/web.xml");
> +            }
> +
> +            specDD = IOUtil.readAll(webXmlUrl);
>
> -    public XmlObject parseSpecDD(String specDD) throws  
> DeploymentException {
> -        try {
>              // check if we have an alt spec dd
> -            return parseSpecDD(SchemaConversionUtils.parse(specDD));
> +            WebAppDocument webAppDoc =  
> SchemaConversionUtils.convertToServletSchema(SchemaConversionUtils.pars 
> e(specDD));
> +            webApp = webAppDoc.getWebApp();
>          } catch (Exception e) {
> -            throw new DeploymentException("Unable to parse spec dd",  
> e);
> +            return null;
>          }
> -    }
>
> -    private XmlObject parseSpecDD(XmlObject dd) throws XmlException {
> -        WebAppDocument webAppDoc =  
> SchemaConversionUtils.convertToServletSchema(dd);
> -        return webAppDoc.getWebApp();
> -    }
>
> -    public XmlObject validateVendorDD(XmlObject vendorDD) throws  
> DeploymentException {
> +        JettyWebAppType jettyWebApp = null;
>          try {
> -            vendorDD =  
> SchemaConversionUtils.getNestedObjectAsType(vendorDD, "web-app",  
> JettyWebAppType.type);
> -            vendorDD =  
> SchemaConversionUtils.convertToGeronimoNamingSchema(vendorDD);
> -            SchemaConversionUtils.validateDD(vendorDD);
> -            return vendorDD;
> -        } catch (Exception e) {
> +            // load the geronimo-jetty.xml from either the supplied  
> plan or from the earFile
> +            try {
> +                if (plan instanceof XmlObject) {
> +                    jettyWebApp = (JettyWebAppType)  
> SchemaConversionUtils.getNestedObjectAsType(
> +                            (XmlObject) plan,
> +                            "web-app",
> +                            JettyWebAppType.type);
> +                } else {
> +                    JettyWebAppDocument jettyWebAppdoc = null;
> +                    if (plan != null) {
> +                        jettyWebAppdoc =  
> JettyWebAppDocument.Factory.parse((File)plan);
> +                    } else {
> +                        URL path = JarUtil.createJarURL(moduleFile,  
> "WEB-INF/geronimo-jetty.xml");
> +                        jettyWebAppdoc =  
> JettyWebAppDocument.Factory.parse(path);
> +                    }
> +                    if (jettyWebAppdoc != null) {
> +                        jettyWebApp = jettyWebAppdoc.getWebApp();
> +                    }
> +                }
> +            } catch (IOException e) {
> +            }
> +
> +            // if we got one extract the validate it otherwise create  
> a default one
> +            if (jettyWebApp != null) {
> +                jettyWebApp = (JettyWebAppType)  
> SchemaConversionUtils.convertToGeronimoNamingSchema(jettyWebApp);
> +                SchemaConversionUtils.validateDD(jettyWebApp);
> +            } else {
> +                jettyWebApp = createDefaultPlan(name, webApp);
> +            }
> +        } catch (XmlException e) {
>              throw new DeploymentException(e);
>          }
> -    }
>
> -    public XmlObject getDeploymentPlan(JarFile module) throws  
> DeploymentException {
> -        URL path = null;
> +        // get the ids from either the application plan or for a  
> stand alone module from the specific deployer
> +        URI configId = null;
>          try {
> -            path = JarUtil.createJarURL(module,  
> "WEB-INF/geronimo-jetty.xml");
> -        } catch (DeploymentException e) {
> -            return null;
> +            configId = new URI(jettyWebApp.getConfigId());
> +        } catch (URISyntaxException e) {
> +            throw new DeploymentException("Invalid configId " +  
> jettyWebApp.getConfigId(), e);
>          }
>
> -        try {
> -            JettyWebAppDocument dd =  
> JettyWebAppDocument.Factory.parse(path);
> -            JettyWebAppType plan = (JettyWebAppType)  
> validateVendorDD(dd);
> -            if (plan == null) {
> -                return createDefaultPlan(module);
> +        URI parentId = null;
> +        if (jettyWebApp.isSetParentId()) {
> +            try {
> +                parentId = new URI(jettyWebApp.getParentId());
> +            } catch (URISyntaxException e) {
> +                throw new DeploymentException("Invalid parentId " +  
> jettyWebApp.getParentId(), e);
>              }
> -            return plan;
> -        } catch (MalformedURLException e) {
> -            return null;
> -        } catch (IOException e) {
> -            return null;
> -        } catch (XmlException e) {
> -            throw new DeploymentException(e);
>          }
> -    }
>
> -    private JettyWebAppType createDefaultPlan(JarFile module) {
> -        // load the web.xml
> -        URL webXmlUrl;
> -        try {
> -            webXmlUrl = JarUtil.createJarURL(module,  
> "WEB-INF/web.xml");
> -        } catch (DeploymentException e) {
> -            return null;
> +        URI moduleURI;
> +        if (targetPath != null) {
> +            moduleURI = URI.create(targetPath);
> +            if (targetPath.endsWith("/")) {
> +                throw new DeploymentException("targetPath must not  
> end with a '/'");
> +            }
> +            targetPath += "/";
> +        } else {
> +            targetPath = "war/";
> +            moduleURI = URI.create("");
>          }
>
> -        WebAppType webApp = null;
> -        try {
> -            webApp = (WebAppType) parseSpecDD(webXmlUrl);
> -        } catch (DeploymentException e) {
> -            return null;
> -        }
> +        WebModule module = new WebModule(name, configId, parentId,  
> moduleURI, moduleFile, targetPath, webApp, jettyWebApp, specDD);
> +        module.setContextRoot(jettyWebApp.getContextRoot());
> +        return module;
> +    }
>
> +    private JettyWebAppType createDefaultPlan(String name, WebAppType  
> webApp) {
>          String id = webApp.getId();
>          if (id == null) {
> -            // TODO this name is not necessairly the original name  
> specified on the command line which is what we want
> -            id = module.getName();
> -            if (id.endsWith("!/")) {
> -                id = id.substring(0, id.length() - 2);
> -            }
> +            id = name;
>              if (id.endsWith(".war")) {
>                  id = id.substring(0, id.length() - 4);
>              }
>              if (id.endsWith("/")) {
>                  id = id.substring(0, id.length() - 1);
>              }
> -            id = id.substring(id.lastIndexOf('/') + 1);
>          }
> -        return newJettyWebAppType(webApp, id);
> -    }
>
> -    private JettyWebAppType newJettyWebAppType(WebAppType webApp,  
> String id) {
>          JettyWebAppType jettyWebApp =  
> JettyWebAppType.Factory.newInstance();
>
>          // set the parentId, configId and context root
> @@ -199,81 +196,6 @@
>          return jettyWebApp;
>      }
>
> -    public boolean canHandlePlan(XmlObject plan) {
> -        return plan instanceof JettyWebAppType;
> -    }
> -
> -    public URI getParentId(XmlObject plan) throws DeploymentException  
> {
> -        JettyWebAppType jettyWebApp = (JettyWebAppType) plan;
> -        try {
> -            return new URI(jettyWebApp.getParentId());
> -        } catch (URISyntaxException e) {
> -            throw new DeploymentException("Invalid parentId " +  
> jettyWebApp.getParentId(), e);
> -        }
> -    }
> -
> -    public URI getConfigId(XmlObject plan) throws DeploymentException  
> {
> -        JettyWebAppType jettyWebApp = (JettyWebAppType) plan;
> -        try {
> -            return new URI(jettyWebApp.getConfigId());
> -        } catch (URISyntaxException e) {
> -            throw new DeploymentException("Invalid configId " +  
> jettyWebApp.getConfigId(), e);
> -        }
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD) throws DeploymentException {
> -        return createModule(name, moduleFile, vendorDD, "war", null);
> -    }
> -
> -    public Module createModule(String name, JarFile moduleFile,  
> XmlObject vendorDD, String targetPath, URL specDDUrl) throws  
> DeploymentException {
> -        URI moduleURI;
> -        if (targetPath != null) {
> -            moduleURI = URI.create(targetPath);
> -            if (targetPath.endsWith("/")) {
> -                throw new DeploymentException("targetPath must not  
> end with a '/'");
> -            }
> -            targetPath += "/";
> -        } else {
> -            targetPath = "war/";
> -            moduleURI = URI.create("");
> -        }
> -
> -        // load the spec dd
> -        if (specDDUrl == null) {
> -            specDDUrl = JarUtil.createJarURL(moduleFile,  
> "WEB-INF/web.xml");
> -        }
> -        String specDD;
> -        try {
> -            specDD = IOUtil.readAll(specDDUrl);
> -        } catch (IOException e) {
> -            throw new DeploymentException("Unable to read specDD: " +  
> specDDUrl.toExternalForm());
> -        }
> -        WebAppType webApp = (WebAppType) parseSpecDD(specDD);
> -
> -        if (vendorDD == null) {
> -            try {
> -                JarEntry entry =  
> moduleFile.getJarEntry("WEB-INF/geronimo-jetty.xml");
> -                if (entry != null) {
> -                    InputStream in = moduleFile.getInputStream(entry);
> -                    if (in != null) {
> -                        vendorDD = XmlBeansUtil.parse(in,  
> JettyWebAppType.type);
> -                    }
> -                }
> -            } catch (Exception e) {
> -                throw new DeploymentException("Unable to parse  
> WEB-INF/geronimo-jetty.xml", e);
> -            }
> -        }
> -        if (vendorDD == null) {
> -            vendorDD = newJettyWebAppType(webApp, name);
> -        }
> -
> -        JettyWebAppType jettyWebApp = (JettyWebAppType) vendorDD;
> -
> -        WebModule module = new WebModule(name, moduleURI, moduleFile,  
> targetPath, webApp, jettyWebApp, specDD);
> -        module.setContextRoot(jettyWebApp.getContextRoot());
> -        return module;
> -    }
> -
>      public void installModule(JarFile earFile, EARContext earContext,  
> Module module) throws DeploymentException {
>          try {
>              URI targetURI = URI.create(module.getTargetPath());
> @@ -292,10 +214,7 @@
>                      try {
>                          earContext.addFile(target, in);
>                      } finally {
> -                        try {
> -                            in.close();
> -                        } catch (IOException e) {
> -                        }
> +                        IOUtil.close(in);
>                      }
>                  }
>              }
> @@ -380,10 +299,6 @@
>              throw new DeploymentException("Unable to initialize  
> webapp GBean", e);
>          }
>          earContext.addGBean(name, gbean);
> -    }
> -
> -    public SchemaTypeLoader getSchemaTypeLoader() {
> -        return SCHEMA_TYPE_LOADER;
>      }
>
>      private ReadOnlyContext buildComponentContext(EARContext  
> earContext, WebModule webModule, WebAppType webApp, JettyWebAppType  
> jettyWebApp, UserTransaction userTransaction, ClassLoader cl) throws  
> DeploymentException {
>


Mime
View raw message