geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r398051 - in /geronimo/branches/1.1/modules: client-builder/src/java/org/apache/geronimo/client/builder/ connector-builder/src/java/org/apache/geronimo/connector/deployment/ connector-builder/src/test/org/apache/geronimo/connector/deploymen...
Date Sat, 29 Apr 2006 01:13:17 GMT
Author: ammulder
Date: Fri Apr 28 18:13:14 2006
New Revision: 398051

URL: http://svn.apache.org/viewcvs?rev=398051&view=rev
Log:
Fix deployment so a ConfigID/ModuleID is set as soon as possible.
  Important when it's not fully populated to begin with, so all
  GBeans get the final name and references work and so on
  (GERONIMO-1935)
Fix MDBs so space is trimmed from ActivationSpec config properties
  and the property names are validated (GERONIMO-1684)

Added:
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java   (with props)
Modified:
    geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
    geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
    geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -20,6 +20,7 @@
 import org.apache.geronimo.client.StaticJndiContextPlugin;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
@@ -177,15 +178,15 @@
         return (ServiceReferenceBuilder) serviceReferenceBuilder.getElement();
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, "app-client", null, null, null, naming);
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, "app-client", null, null, null, naming, idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming);
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming, idBuilder);
     }
 
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming) throws DeploymentException {
+    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -222,11 +223,23 @@
 
         EnvironmentType clientEnvironmentType = gerAppClient.getClientEnvironment();
         Environment clientEnvironment = EnvironmentBuilder.buildEnvironment(clientEnvironmentType, defaultClientEnvironment);
+        if(standAlone) {
+            String name = new File(moduleFile.getName()).getName();
+            idBuilder.resolve(clientEnvironment, name+"_"+name, "jar");
+        } else {
+            Artifact earConfigId = earEnvironment.getConfigId();
+            idBuilder.resolve(clientEnvironment, earConfigId.getArtifactId() + "_" + new File(moduleFile.getName()).getName(), "jar");
+        }
         EnvironmentType serverEnvironmentType = gerAppClient.getServerEnvironment();
         Environment serverEnvironment = EnvironmentBuilder.buildEnvironment(serverEnvironmentType, defaultServerEnvironment);
-        if (earEnvironment != null) {
+        if (!standAlone) {
             EnvironmentBuilder.mergeEnvironments(earEnvironment, serverEnvironment);
             serverEnvironment = earEnvironment;
+            if(!serverEnvironment.getConfigId().isResolved()) {
+                throw new IllegalStateException("Server environment module ID should be fully resolved (not "+serverEnvironment.getConfigId()+")");
+            }
+        } else {
+            idBuilder.resolve(serverEnvironment, new File(moduleFile.getName()).getName(), "jar");
         }
 
         AbstractName moduleName;
@@ -414,6 +427,11 @@
 
         EARContext appClientDeploymentContext = appClientModule.getEarContext();
 //        ConfigurationData appClientConfigurationData = null;
+
+        // Create a Module ID Builder defaulting to similar settings to use for any children we create
+        ModuleIDBuilder idBuilder = new ModuleIDBuilder();
+        idBuilder.setDefaultGroup(appClientModule.getClientEnvironment().getConfigId().getGroupId());
+        idBuilder.setDefaultVersion(appClientModule.getClientEnvironment().getConfigId().getVersion());
         try {
             try {
 
@@ -476,7 +494,7 @@
                                 }
                             }
                             XmlObject connectorPlan = resource.getConnector();
-                            Module connectorModule = getConnectorModuleBuilder().createModule(connectorPlan, connectorFile, path, null, appClientModule.getClientEnvironment(), null, appClientDeploymentContext.getModuleName(), earContext.getNaming());
+                            Module connectorModule = getConnectorModuleBuilder().createModule(connectorPlan, connectorFile, path, null, appClientModule.getClientEnvironment(), null, appClientDeploymentContext.getModuleName(), earContext.getNaming(), idBuilder);
                             resourceModules.add(connectorModule);
                             //TODO configStore == null is fishy, consider moving these stages for connectors into the corresponding stages for this module.
                             getConnectorModuleBuilder().installModule(connectorFile, appClientDeploymentContext, connectorModule, null, null, repositories);

Modified: geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -16,6 +16,27 @@
  */
 package org.apache.geronimo.connector.deployment;
 
+import java.beans.Introspector;
+import java.beans.PropertyEditor;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import javax.naming.Reference;
+import javax.xml.namespace.QName;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.UnresolvedReferenceException;
 import org.apache.geronimo.common.propertyeditor.PropertyEditors;
@@ -38,6 +59,7 @@
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionLog;
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.XATransactions;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
@@ -64,6 +86,10 @@
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.management.JCAConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.JCAResourceAdapter;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.reference.ResourceReference;
 import org.apache.geronimo.schema.SchemaConversionUtils;
@@ -86,38 +112,10 @@
 import org.apache.geronimo.xbeans.j2ee.ConnectorType;
 import org.apache.geronimo.xbeans.j2ee.MessagelistenerType;
 import org.apache.geronimo.xbeans.j2ee.ResourceadapterType;
-import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
-import org.apache.geronimo.management.geronimo.JCAResourceAdapter;
-import org.apache.geronimo.management.geronimo.JCAAdminObject;
-import org.apache.geronimo.management.JCAConnectionFactory;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 
-import javax.naming.Reference;
-import javax.xml.namespace.QName;
-
-import java.beans.Introspector;
-import java.beans.PropertyEditor;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
 /**
  * @version $Rev:385659 $ $Date$
  */
@@ -150,15 +148,15 @@
         this.defaultXAThreadCaching = defaultXAThreadCaching;
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, "rar", null, null, null, naming);
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, "rar", null, null, null, naming, idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming);
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming, idBuilder);
     }
 
-    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming) throws DeploymentException {
+    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -237,6 +235,11 @@
         if (earEnvironment != null) {
             EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
             environment = earEnvironment;
+            if(!environment.getConfigId().isResolved()) {
+                throw new IllegalStateException("Connector module ID should be fully resolved (not "+environment.getConfigId()+")");
+            }
+        } else {
+            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "rar");
         }
 
         AbstractName moduleName;

Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Fri Apr 28 18:13:14 2006
@@ -40,6 +40,7 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -170,8 +171,9 @@
             ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
             try {
                 File planFile = new File(basedir, "src/test-data/data/external-application-plan.xml");
-                Object plan = configBuilder.getDeploymentPlan(planFile, rarFile);
-                context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, rarFile), plan, rarFile, Collections.singleton(configurationStore), artifactResolver, configurationStore);
+                ModuleIDBuilder idBuilder = new ModuleIDBuilder();
+                Object plan = configBuilder.getDeploymentPlan(planFile, rarFile, idBuilder);
+                context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, rarFile, idBuilder), plan, rarFile, Collections.singleton(configurationStore), artifactResolver, configurationStore);
                 configData = context.getConfigurationData();
             } finally {
                 if (context != null) {
@@ -341,7 +343,7 @@
             JarFile rarJarFile = DeploymentUtil.createJarFile(rarFile);
             AbstractName earName = null;
             String moduleName = "geronimo/test-ear/1.0/car";
-            Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile, moduleName, action.getSpecDD(), null, null, earName, naming);
+            Module module = moduleBuilder.createModule(action.getVendorDD(), rarJarFile, moduleName, action.getSpecDD(), null, null, earName, naming, new ModuleIDBuilder());
             if (module == null) {
                 throw new DeploymentException("Was not a connector module");
             }

Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java (original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java Fri Apr 28 18:13:14 2006
@@ -79,7 +79,7 @@
 
         ArtifactManager artifactManager = new DefaultArtifactManager();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.singleton(repository), null);
-        DeploymentContext context = builder.buildConfiguration(false, builder.getConfigurationID(config, null), config, null, Collections.singleton(targetConfigurationStore), artifactResolver, targetConfigurationStore);
+        DeploymentContext context = builder.buildConfiguration(false, builder.getConfigurationID(config, null, new ModuleIDBuilder()), config, null, Collections.singleton(targetConfigurationStore), artifactResolver, targetConfigurationStore);
         ConfigurationData configurationData = context.getConfigurationData();
 
         JarOutputStream out = new JarOutputStream(new FileOutputStream(carFile));

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java Fri Apr 28 18:13:14 2006
@@ -41,7 +41,7 @@
      * @return the deployment plan, or null if this builder can not handle the module
      * @throws org.apache.geronimo.common.DeploymentException if there was a problem with the configuration
      */
-    Object getDeploymentPlan(File planFile, JarFile module) throws DeploymentException;
+    Object getDeploymentPlan(File planFile, JarFile module, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     /**
      * Checks what configuration URL will be used for the provided module.
@@ -51,7 +51,7 @@
      * @throws IOException if there was a problem reading or writing the files
      * @throws org.apache.geronimo.common.DeploymentException if there was a problem with the configuration
      */
-    Artifact getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException;
+    Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException;
 
     /**
      * Build a configuration from a local file

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java Fri Apr 28 18:13:14 2006
@@ -24,27 +24,23 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Hashtable;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
-
 import javax.management.ObjectName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
@@ -55,7 +51,6 @@
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.main.CommandLineManifest;
 
@@ -219,12 +214,13 @@
         }
 
 //        File configurationDir = null;
+        ModuleIDBuilder idBuilder = new ModuleIDBuilder();
         try {
             Object plan = null;
             ConfigurationBuilder builder = null;
             for (Iterator i = builders.iterator(); i.hasNext();) {
                 ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
-                plan = candidate.getDeploymentPlan(planFile, module);
+                plan = candidate.getDeploymentPlan(planFile, module, idBuilder);
                 if (plan != null) {
                     builder = candidate;
                     break;
@@ -236,26 +232,10 @@
                         (moduleFile == null ? "" : (planFile == null ? "" : ", ") + "moduleFile=" + moduleFile.getAbsolutePath()) + ")");
             }
 
-            Artifact configID = builder.getConfigurationID(plan, module);
+            Artifact configID = builder.getConfigurationID(plan, module, idBuilder);
             // If the Config ID isn't fully resolved, populate it with defaults
             if (!configID.isResolved()) {
-                String group = configID.getGroupId();
-                if (group == null) {
-                    group = Artifact.DEFAULT_GROUP_ID;
-                }
-                String artifactId = configID.getArtifactId();
-                if (artifactId == null) {
-                    throw new DeploymentException("Every configuration to deploy must have a ConfigID with an ArtifactID (not " + configID + ")");
-                }
-                Version version = configID.getVersion();
-                if (version == null) {
-                    version = new Version(Long.toString(System.currentTimeMillis()));
-                }
-                String type = configID.getType();
-                if (type == null) {
-                    type = "car";
-                }
-                configID = new Artifact(group, artifactId, version, type);
+                configID = idBuilder.resolve(configID, "car");
             }
             // Make sure this configuration doesn't already exist
             try {

Added: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java?rev=398051&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java (added)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java Fri Apr 28 18:13:14 2006
@@ -0,0 +1,115 @@
+/**
+ *
+ * Copyright 2005 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.deployment;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.kernel.repository.Environment;
+
+/**
+ * A utility class to flesh out any incomplete Module IDs (formerly known as
+ * config IDs) encountered during the course of a deployment.  For example,
+ * an EAR may have a module ID with only an artifactId, and contain a web
+ * app with no Geronimo plan and an EJB JAR with a module ID with no version.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ModuleIDBuilder {
+    private Version defaultVersion;
+    private String defaultGroup;
+
+    public ModuleIDBuilder() {
+        defaultVersion = new Version(Long.toString(System.currentTimeMillis()));
+        defaultGroup = Artifact.DEFAULT_GROUP_ID;
+    }
+
+    /**
+     * If an EAR is going to pass this module ID builder to its children, it
+     * can use this to set the default groupId to be its own.
+     */
+    public void setDefaultGroup(String defaultGroup) {
+        this.defaultGroup = defaultGroup;
+    }
+
+
+    /**
+     * If an EAR is going to pass this module ID builder to its children, it
+     * can use this to set the default version to be its own.
+     */
+    public void setDefaultVersion(Version defaultVersion) {
+        this.defaultVersion = defaultVersion;
+    }
+
+    /**
+     * Translates the argument Artifact to a fully-resolved Artifact, which is
+     * returned.  If the argument was fully-resolved to begin with it is
+     * returned as is.  Otherwise, a new Artifact is returned with any missing
+     * values populated.
+     *
+     * @param argument     The artifact to review
+     * @param defaultType  The type to use if the artifact to review has no
+     *                     type specified
+     *
+     * @return A fully resolved Artifact
+     *
+     * @throws IllegalArgumentException Occurs when the argument artifact does
+     *                                  not have an artifactId
+     */
+    public Artifact resolve(Artifact argument, String defaultType) {
+        if(argument.isResolved()) {
+            return argument;
+        }
+        if(argument.getArtifactId() == null) {
+            throw new IllegalArgumentException("Incoming Artifact must have an ArtifactID (not "+argument+")");
+        }
+        return new Artifact(argument.getGroupId() == null ? defaultGroup : argument.getGroupId(),
+                argument.getArtifactId(),
+                argument.getVersion() == null ? defaultVersion : argument.getVersion(),
+                argument.getType() == null ? defaultType : argument.getType());
+    }
+
+    /**
+     * Creates a new artifact using entirely default values.
+     *
+     * @param defaultArtifact  The artifactId to use for the new Artifact
+     * @param defaultType      The type to use for the new Artifact
+     */
+    public Artifact createDefaultArtifact(String defaultArtifact, String defaultType) {
+        return new Artifact(defaultGroup, defaultArtifact, defaultVersion, defaultType);
+    }
+
+    /**
+     * Guarantees that the argument Environment will have a present and fully
+     * qualified module ID when this method returns. If the Environment is
+     * missing a module ID, or has a partial module ID (isResolved() == false)
+     * then this method will fill in any missing values.  If the module ID is
+     * present and resolved, then this method does nothing.
+     *
+     * @param environment        The Environment to check and populate
+     * @param defaultArtifactId  The artifactId to use if the Envrionment does
+     *                           not have a module ID at all
+     * @param defaultType        The type to use if the Environment is lacking
+     *                           a module ID or the module ID is lacking a type
+     */
+    public void resolve(Environment environment, String defaultArtifactId, String defaultType) {
+        if(environment.getConfigId() == null) {
+            environment.setConfigId(resolve(new Artifact(null, defaultArtifactId, (Version)null, defaultType), defaultType));
+        } else if(!environment.getConfigId().isResolved()) {
+            environment.setConfigId(resolve(environment.getConfigId(), defaultType));
+        }
+    }
+}

Propchange: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/SingleFileHotDeployer.java Fri Apr 28 18:13:14 2006
@@ -103,6 +103,8 @@
             }
         }
 
+        ModuleIDBuilder idBuilder = new ModuleIDBuilder();
+
         JarFile module = null;
         try {
             module = DeploymentUtil.createJarFile(dir);
@@ -116,7 +118,7 @@
             ConfigurationBuilder builder = null;
             for (Iterator i = builders.iterator(); i.hasNext();) {
                 ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
-                plan = candidate.getDeploymentPlan(null, module);
+                plan = candidate.getDeploymentPlan(null, module, idBuilder);
                 if (plan != null) {
                     builder = candidate;
                     break;
@@ -127,7 +129,7 @@
             }
 
             // determine the new configuration id
-            Artifact configurationId = builder.getConfigurationID(plan, module);
+            Artifact configurationId = builder.getConfigurationID(plan, module, idBuilder);
 
             // if the new configuration id isn't fully resolved, populate it with defaults
             if (!configurationId.isResolved()) {

Modified: geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java Fri Apr 28 18:13:14 2006
@@ -245,11 +245,11 @@
     }
 
     private class MockConfigurationBuilder implements ConfigurationBuilder {
-        public Object getDeploymentPlan(File planFile, JarFile module) throws DeploymentException {
+        public Object getDeploymentPlan(File planFile, JarFile module, ModuleIDBuilder idBuilder) throws DeploymentException {
             return new Object();
         }
 
-        public Artifact getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException {
+        public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
             return NEW_ID;
         }
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Fri Apr 28 18:13:14 2006
@@ -38,6 +38,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
@@ -86,7 +87,6 @@
 public class EARConfigBuilder implements ConfigurationBuilder {
 
     private final static QName APPLICATION_QNAME = GerApplicationDocument.type.getDocumentElementName();
-    private static final String DEFAULT_GROUPID = "defaultGroupId";
 
     private final Collection repositories;
     private final SingleElementCollection ejbConfigBuilder;
@@ -237,11 +237,11 @@
         return (ServiceReferenceBuilder) serviceReferenceBuilder.getElement();
     }
 
-    public Object getDeploymentPlan(File planFile, JarFile jarFile) throws DeploymentException {
+    public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder) throws DeploymentException {
         if (planFile == null && jarFile == null) {
             return null;
         }
-        ApplicationInfo plan = getEarPlan(planFile, jarFile);
+        ApplicationInfo plan = getEarPlan(planFile, jarFile, idBuilder);
         if (plan != null) {
             return plan;
         }
@@ -253,16 +253,16 @@
         // get the modules either the application plan or for a stand alone module from the specific deployer
         Module module = null;
         if (getWebConfigBuilder() != null) {
-            module = getWebConfigBuilder().createModule(planFile, jarFile, naming);
+            module = getWebConfigBuilder().createModule(planFile, jarFile, naming, idBuilder);
         }
         if (module == null && getEjbConfigBuilder() != null) {
-            module = getEjbConfigBuilder().createModule(planFile, jarFile, naming);
+            module = getEjbConfigBuilder().createModule(planFile, jarFile, naming, idBuilder);
         }
         if (module == null && getConnectorConfigBuilder() != null) {
-            module = getConnectorConfigBuilder().createModule(planFile, jarFile, naming);
+            module = getConnectorConfigBuilder().createModule(planFile, jarFile, naming, idBuilder);
         }
         if (module == null && getAppClientConfigBuilder() != null) {
-            module = getAppClientConfigBuilder().createModule(planFile, jarFile, naming);
+            module = getAppClientConfigBuilder().createModule(planFile, jarFile, naming, idBuilder);
         }
         if (module == null) {
             return null;
@@ -278,7 +278,7 @@
                 null);
     }
 
-    private ApplicationInfo getEarPlan(File planFile, JarFile earFile) throws DeploymentException {
+    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
         String specDD;
         ApplicationType application = null;
         if (earFile != null) {
@@ -328,6 +328,10 @@
 
         EnvironmentType environmentType = gerApplication.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
+        // Make this EAR's settings the default for child modules
+        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
+        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());
 
         Artifact artifact = environment.getConfigId();
         AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);
@@ -338,7 +342,7 @@
         Set moduleLocations = new HashSet();
         LinkedHashSet modules = new LinkedHashSet();
         try {
-            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName);
+            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
         } catch (Throwable e) {
             // close all the modules
             for (Iterator iterator = modules.iterator(); iterator.hasNext();) {
@@ -373,7 +377,7 @@
         EnvironmentType environmentType = gerApplication.addNewEnvironment();
         ArtifactType artifactType = environmentType.addNewConfigId();
 
-        artifactType.setGroupId(DEFAULT_GROUPID);
+        artifactType.setGroupId(Artifact.DEFAULT_GROUP_ID);
 
         // set the configId
         String id = application.getId();
@@ -394,9 +398,13 @@
         return gerApplication;
     }
 
-    public Artifact getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException {
+    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
         ApplicationInfo applicationInfo = (ApplicationInfo) plan;
-        return applicationInfo.getEnvironment().getConfigId();
+        Artifact test = applicationInfo.getEnvironment().getConfigId();
+        if(!test.isResolved()) {
+            throw new IllegalStateException("Module ID should be fully resolved by now (not "+test+")");
+        }
+        return test;
     }
 
     public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile earFile, Collection configurationStores, ArtifactResolver artifactResolver, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
@@ -577,7 +585,7 @@
         return filter;
     }
 
-    private void addModules(JarFile earFile, ApplicationType application, GerApplicationType gerApplication, Set moduleLocations, LinkedHashSet modules, Environment environment, AbstractName earName) throws DeploymentException {
+    private void addModules(JarFile earFile, ApplicationType application, GerApplicationType gerApplication, Set moduleLocations, LinkedHashSet modules, Environment environment, AbstractName earName, ModuleIDBuilder idBuilder) throws DeploymentException {
         Map altVendorDDs = new HashMap();
         try {
             if (earFile != null) {
@@ -699,7 +707,7 @@
                             environment,
                             moduleContextInfo,
                             earName,
-                            naming);
+                            naming, idBuilder);
 
                     if (module == null) {
                         throw new DeploymentException("Module was not " + moduleTypeName + ": " + modulePath);
@@ -808,7 +816,7 @@
                         environment,
                         moduleContextInfo,
                         earName,
-                        naming);
+                        naming, idBuilder);
 
                 if (module == null) {
                     throw new DeploymentException("Module was not " + moduleTypeName + ": " + moduleName);

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -26,14 +26,15 @@
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 
 /**
  * @version $Rev:386276 $ $Date$
  */
 public interface ModuleBuilder {
-    Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException;
+    Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
-    Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException;
+    Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException;
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/SwitchingModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -18,6 +18,7 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.ReferenceCollection;
@@ -81,7 +82,7 @@
         this.defaultNamespace = defaultNamespace;
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         String namespace;
         if (plan == null) {
             namespace = defaultNamespace;
@@ -90,7 +91,7 @@
         }
         ModuleBuilder builder = getBuilderFromNamespace(namespace);
         if (builder != null) {
-            return builder.createModule(plan, moduleFile, naming);
+            return builder.createModule(plan, moduleFile, naming, idBuilder);
         } else {
             return null;
         }
@@ -133,11 +134,11 @@
         return builder;
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         String namespace = getNamespaceFromPlan(plan);
         ModuleBuilder builder = getBuilderFromNamespace(namespace);
         if (builder != null) {
-            return builder.createModule(plan, moduleFile, targetPath, specDDUrl, environment, moduleContextInfo, earName, naming);
+            return builder.createModule(plan, moduleFile, targetPath, specDDUrl, environment, moduleContextInfo, earName, naming, idBuilder);
         } else {
             return null;
         }

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/UnavailableModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -13,18 +13,19 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 
 /**
  * @version $Rev: 356097 $ $Date: 2005-12-11 17:29:03 -0800 (Sun, 11 Dec 2005) $
  */
 public class UnavailableModuleBuilder implements ModuleBuilder {
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
-    		return null; 
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+            return null;
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
-    		return null;
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+            return null;
     }
 
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
@@ -42,15 +43,15 @@
     public String getSchemaNamespace() {
         return null;
     }
-    
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(UnavailableModuleBuilder.class, NameFactory.MODULE_BUILDER);
         infoBuilder.addInterface(ModuleBuilder.class);
-	    GBEAN_INFO = infoBuilder.getBeanInfo();
+        GBEAN_INFO = infoBuilder.getBeanInfo();
     }
-    
+
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java Fri Apr 28 18:13:14 2006
@@ -37,6 +37,7 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -72,6 +73,7 @@
     private static MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder();
     private static ResourceReferenceBuilder resourceReferenceBuilder = connectorConfigBuilder;
     private static ModuleBuilder appClientConfigBuilder = null;
+    private final static ModuleIDBuilder idBuilder = new ModuleIDBuilder();
     private static ServiceReferenceBuilder serviceReferenceBuilder = new ServiceReferenceBuilder() {
 
         //it could return a Service or a Reference, we don't care
@@ -273,8 +275,8 @@
                     serviceReferenceBuilder,
                     naming);
 
-            Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
         } finally {
             if (context != null) {
@@ -307,8 +309,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-ejb-jar.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-ejb-jar.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -346,8 +348,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-war.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-war.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -385,8 +387,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-rar.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-rar.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -424,8 +426,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-car.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-car.xml"), earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -464,8 +466,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -501,8 +503,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -538,8 +540,8 @@
         ConfigurationData configurationData = null;
         DeploymentContext context = null;
         try {
-            Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
+            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Fri Apr 28 18:13:14 2006
@@ -27,6 +27,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 
 import javax.management.ObjectName;
 import javax.naming.Reference;
@@ -43,13 +44,13 @@
     private ClassLoader cl;
     public Module connectorModule;
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "rar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
         AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
         return new ConnectorModule(true, moduleName, null, moduleFile, "connector", null, null, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
         return new ConnectorModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
     }

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Fri Apr 28 18:13:14 2006
@@ -26,6 +26,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 
 import javax.naming.Reference;
 import java.io.File;
@@ -43,13 +44,13 @@
     private ClassLoader cl;
     public EJBModule ejbModule;
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName earName = naming.createRootName(new Artifact("test", "test-ejb-jar", "", "jar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
         AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE);
         return new EJBModule(true, moduleName, null, moduleFile, "ejb.jar", null, null, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE);
         return new EJBModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
     }

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java Fri Apr 28 18:13:14 2006
@@ -24,6 +24,7 @@
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 
 import java.io.File;
 import java.net.URL;
@@ -42,13 +43,13 @@
     public WebModule webModule;
     public String contextRoot;
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "war"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
         AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE);
         return new WebModule(true, moduleName, null, moduleFile, "war", null, null, null, contextRoot, portMap, namespace);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE);
         return new WebModule(false, moduleName, null, moduleFile, targetPath, null, null, null, contextRoot, portMap, namespace);
     }

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -52,6 +52,7 @@
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -178,7 +179,7 @@
         return kernel.getGBeanData(templateName);
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -225,8 +226,9 @@
             if (contextRoot.startsWith("/")) {
                 contextRoot = contextRoot.substring(1);
             }
-            Artifact configID = new Artifact(Artifact.DEFAULT_GROUP_ID, contextRoot, "1", "car");
-            environment.setConfigId(configID);
+            idBuilder.resolve(environment, contextRoot, "war");
+        } else {
+            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "war");
         }
         boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
         if (jettyWebApp.isSetContextPriorityClassloader()) {

Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Fri Apr 28 18:13:14 2006
@@ -37,6 +37,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
 import org.apache.geronimo.gbean.AbstractName;
@@ -109,7 +110,7 @@
         new File(outputPath, "war").mkdir();
         File path = new File(basedir, "src/test-resources/deployables/war4");
         UnpackedJarFile jarFile = new UnpackedJarFile(path);
-        Module module = builder.createModule(null, jarFile, kernel.getNaming());
+        Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
         Repository repository = null;
 
         AbstractName moduleName = module.getModuleName();

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java Fri Apr 28 18:13:14 2006
@@ -54,7 +54,7 @@
         Environment environment = new Environment();
         if (environmentType != null) {
             if (environmentType.isSetConfigId()) {
-                environment.setConfigId(toArtifact(environmentType.getConfigId(), "car"));
+                environment.setConfigId(toArtifact(environmentType.getConfigId(), null));
             }
 
             if (environmentType.isSetDependencies()) {

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Fri Apr 28 18:13:14 2006
@@ -34,6 +34,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.xbeans.AttributeType;
 import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
@@ -118,7 +119,7 @@
         }
     }
 
-    public Object getDeploymentPlan(File planFile, JarFile jarFile) throws DeploymentException {
+    public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder) throws DeploymentException {
         if (planFile == null && jarFile == null) {
             return null;
         }
@@ -160,6 +161,23 @@
             if (!configurationDoc.validate(XmlBeansUtil.createXmlOptions(errors))) {
                 throw new DeploymentException("Invalid deployment descriptor: " + errors + "\nDescriptor: " + configurationDoc.toString());
             }
+            // If there's no artifact ID and we won't be able to figure one out later, use the plan file name.  Bit of a hack.
+            if(jarFile == null && (configurationDoc.getConfiguration().getEnvironment() == null ||
+                        configurationDoc.getConfiguration().getEnvironment().getConfigId() == null ||
+                        configurationDoc.getConfiguration().getEnvironment().getConfigId().getArtifactId() == null)) {
+                if(configurationDoc.getConfiguration().getEnvironment() == null) {
+                    configurationDoc.getConfiguration().addNewEnvironment();
+                }
+                if(configurationDoc.getConfiguration().getEnvironment().getConfigId() == null) {
+                    configurationDoc.getConfiguration().getEnvironment().addNewConfigId();
+                }
+                String name = planFile.getName();
+                int pos = name.lastIndexOf('.');
+                if(pos > -1) {
+                    name = name.substring(0, pos);
+                }
+                configurationDoc.getConfiguration().getEnvironment().getConfigId().setArtifactId(name);
+            }
             return configurationDoc.getConfiguration();
         } catch (XmlException e) {
             throw new DeploymentException("Could not parse xml in plan", e);
@@ -168,11 +186,14 @@
         }
     }
 
-    public Artifact getConfigurationID(Object plan, JarFile module) throws IOException, DeploymentException {
+    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
         ConfigurationType configType = (ConfigurationType) plan;
         EnvironmentType environmentType = configType.getEnvironment();
-        //TODO default id based on name?
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+        idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(), "car");
+        if(!environment.getConfigId().isResolved()) {
+            throw new IllegalStateException("Service Module ID is not fully populated ("+environment.getConfigId()+")");
+        }
         return environment.getConfigId();
     }
 
@@ -189,6 +210,9 @@
         type.setType(configId.getType());
         type.setVersion(configId.getVersion().toString());
         Environment environment = EnvironmentBuilder.buildEnvironment(configurationType.getEnvironment(), defaultEnvironment);
+        if(!environment.getConfigId().isResolved()) {
+            throw new IllegalStateException("Module ID should be fully resolved by now (not "+environment.getConfigId()+")");
+        }
         File outfile;
         try {
             outfile = targetConfigurationStore.createNewConfigurationDir(configId);

Modified: geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java Fri Apr 28 18:13:14 2006
@@ -19,6 +19,7 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.FooBarBean;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
 import org.apache.geronimo.deployment.xbeans.ConfigurationType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
@@ -61,7 +62,7 @@
         JarFile jar = new JarFile(file);
         assertTrue(file.exists());
         ServiceConfigBuilder builder = new ServiceConfigBuilder(parentEnvironment, null, null, null, new Jsr77Naming());
-        assertNull(builder.getDeploymentPlan(null, jar));
+        assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
         jar.close();
     }
 

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -45,6 +45,7 @@
 import org.apache.geronimo.deployment.xbeans.EnvironmentType;
 import org.apache.geronimo.deployment.xbeans.GbeanType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -123,7 +124,7 @@
         return (WebServiceBuilder) webServiceBuilder.getElement();
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -171,8 +172,9 @@
             if (contextRoot.startsWith("/")) {
                     contextRoot = contextRoot.substring(1);
             }
-            Artifact configID = new Artifact(Artifact.DEFAULT_GROUP_ID, contextRoot, "1", "car");
-            environment.setConfigId(configID);
+            idBuilder.resolve(environment, contextRoot, "war");
+        } else {
+            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "war");
         }
         boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
         if (tomcatWebApp.isSetContextPriorityClassloader()) {

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Fri Apr 28 18:13:14 2006
@@ -39,6 +39,7 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
 import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -127,7 +128,7 @@
         File dest = new File(basedir, "target/test-resources/deployables/" + warName + "/war");
         recursiveCopy(path, dest);
         UnpackedJarFile jarFile = new UnpackedJarFile(path);
-        Module module = builder.createModule(null, jarFile, kernel.getNaming());
+        Module module = builder.createModule(null, jarFile, kernel.getNaming(), new ModuleIDBuilder());
         Repository repository = null;
 
         AbstractName moduleName = module.getModuleName();

Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=398051&r1=398050&r2=398051&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Fri Apr 28 18:13:14 2006
@@ -41,6 +41,7 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.EARContext;
@@ -103,15 +104,15 @@
         return dependencies;
     }
 
-    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, ".", null, true, null, null, naming);
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, ".", null, true, null, null, naming, idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
-        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo, earName, naming);
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo, earName, naming, idBuilder);
     }
 
-    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming) throws DeploymentException;
+    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
 
     /**
      * Some servlets will have multiple url patterns.  However, webservice servlets



Mime
View raw message