geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r406550 - in /geronimo/branches/1.1/modules: deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/ deploy-tool/src/java/org/apache/geronimo/deployment/cli/ deployment...
Date Mon, 15 May 2006 06:19:41 GMT
Author: ammulder
Date: Sun May 14 23:19:38 2006
New Revision: 406550

URL: http://svn.apache.org/viewcvs?rev=406550&view=rev
Log:
Don't blow up when operating on modules with a deployment plan that have
  an environment with no moduleId (GERONIMO-1905)

Modified:
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
    geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java?rev=406550&r1=406549&r2=406550&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
(original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java
Sun May 14 23:19:38 2006
@@ -87,7 +87,14 @@
             }
             if(target.canRead()) {
                 Reader in = new BufferedReader(new FileReader(target));
-                return extractModuleIdFromPlan(in);
+                String name = extractModuleIdFromPlan(in);
+                if(name != null) {
+                    Artifact artifact = Artifact.create(name);
+                    if(artifact.getArtifactId() == null) {
+                        name = new Artifact(artifact.getGroupId(), module.getName(), artifact.getVersion(),
artifact.getType()).toString();
+                    }
+                }
+                return name;
             }
         } else {
             if(!isJarFile(module)) {
@@ -114,7 +121,14 @@
                 }
                 if(entry != null) {
                     Reader in = new BufferedReader(new InputStreamReader(input.getInputStream(entry)));
-                    return extractModuleIdFromPlan(in);
+                    String name = extractModuleIdFromPlan(in);
+                    if(name != null) {
+                        Artifact artifact = Artifact.create(name);
+                        if(artifact.getArtifactId() == null) {
+                            name = new Artifact(artifact.getGroupId(), module.getName(),
artifact.getVersion(), artifact.getType()).toString();
+                        }
+                    }
+                    return name;
                 }
             } finally {
                 input.close();
@@ -289,6 +303,9 @@
         public void endDocument() throws SAXException {
             if(!formatIs10) {
                 configId = groupId+"/"+artifactId+"/"+version+"/"+type;
+            }
+            if(configId.equals("///")) {
+                configId = null;
             }
         }
     }

Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=406550&r1=406549&r2=406550&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
(original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
Sun May 14 23:19:38 2006
@@ -73,10 +73,9 @@
             Artifact configID = null;
             if(deploymentPlan != null) {
                 String extracted = ConfigIDExtractor.extractModuleIdFromPlan(deploymentPlan);
-                if(extracted == null) {
-                    throw new IllegalStateException("Unable to find a module ID in the deployment
plan -- is it valid??");
+                if(extracted != null) {
+                    configID = Artifact.create(extracted);
                 }
-                configID = Artifact.create(extracted);
             } else {
                 String extracted = ConfigIDExtractor.extractModuleIdFromArchive(moduleArchive);
                 if(extracted != null) {

Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java?rev=406550&r1=406549&r2=406550&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
(original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
Sun May 14 23:19:38 2006
@@ -113,6 +113,13 @@
             try {
                 if(plan != null) {
                     moduleId = DeployUtils.extractModuleIdFromPlan(plan);
+                    if(moduleId == null) { // plan just doesn't have a config ID
+                        String fileName = module == null ? plan.getName() : module.getName();
+                        int pos = fileName.lastIndexOf('.');
+                        String artifactId = pos > -1 ? module.getName().substring(0, pos)
: module.getName();
+                        moduleId = Artifact.DEFAULT_GROUP_ID+"/"+artifactId+"//";
+                        emit("Unable to locate Geronimo deployment plan in archive.  Calculating
default ModuleID from archive name.");
+                    }
                 } else if(module != null) {
                     moduleId = DeployUtils.extractModuleIdFromArchive(module);
                     if(moduleId == null) {

Modified: 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=406550&r1=406549&r2=406550&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
(original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleIDBuilder.java
Sun May 14 23:19:38 2006
@@ -73,13 +73,13 @@
         if(argument.isResolved()) {
             return argument;
         }
-        if(argument.getArtifactId() == null) {
+        if(argument.getArtifactId() == null || argument.getArtifactId().equals("")) {
             throw new IllegalArgumentException("Incoming Artifact must have an ArtifactID
(not "+argument+")");
         }
-        return new Artifact(argument.getGroupId() == null ? defaultGroup : argument.getGroupId(),
+        return new Artifact(argument.getGroupId() == null || argument.getGroupId().equals("")
? defaultGroup : argument.getGroupId(),
                 argument.getArtifactId(),
                 argument.getVersion() == null ? defaultVersion : argument.getVersion(),
-                argument.getType() == null ? defaultType : argument.getType());
+                argument.getType() == null || argument.getType().equals("") ? defaultType
: argument.getType());
     }
 
     /**

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=406550&r1=406549&r2=406550&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
Sun May 14 23:19:38 2006
@@ -227,14 +227,12 @@
 
         EnvironmentType environmentType = jettyWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        if (standAlone && environment.getConfigId() == null) {
-            if (contextRoot.startsWith("/")) {
-                contextRoot = contextRoot.substring(1);
-            }
-            idBuilder.resolve(environment, contextRoot, "war");
-        } else {
-            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "war");
+        // Note: logic elsewhere depends on the default artifact ID being the file name less
extension (ConfigIDExtractor)
+        String warName = new File(moduleFile.getName()).getName();
+        if(warName.lastIndexOf('.') > -1) {
+            warName = warName.substring(0, warName.lastIndexOf('.'));
         }
+        idBuilder.resolve(environment, warName, "war");
         boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
         if (jettyWebApp.isSetContextPriorityClassloader()) {
             contextPriorityClassLoader = jettyWebApp.getContextPriorityClassloader();

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=406550&r1=406549&r2=406550&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
Sun May 14 23:19:38 2006
@@ -173,14 +173,12 @@
 
         EnvironmentType environmentType = tomcatWebApp.getEnvironment();
         Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
-        if (standAlone && environment.getConfigId() == null) {
-            if (contextRoot.startsWith("/")) {
-                    contextRoot = contextRoot.substring(1);
-            }
-            idBuilder.resolve(environment, contextRoot, "war");
-        } else {
-            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "war");
+        // Note: logic elsewhere depends on the default artifact ID being the file name less
extension (ConfigIDExtractor)
+        String warName = new File(moduleFile.getName()).getName();
+        if(warName.lastIndexOf('.') > -1) {
+            warName = warName.substring(0, warName.lastIndexOf('.'));
         }
+        idBuilder.resolve(environment, warName, "war");
         boolean contextPriorityClassLoader = defaultContextPriorityClassloader;
         if (tomcatWebApp.isSetContextPriorityClassloader()) {
             contextPriorityClassLoader = tomcatWebApp.getContextPriorityClassloader();



Mime
View raw message