Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 73992 invoked from network); 19 Apr 2006 03:50:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Apr 2006 03:50:37 -0000 Received: (qmail 58212 invoked by uid 500); 19 Apr 2006 03:50:37 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 58065 invoked by uid 500); 19 Apr 2006 03:50:36 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 58054 invoked by uid 99); 19 Apr 2006 03:50:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Apr 2006 20:50:36 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 18 Apr 2006 20:50:33 -0700 Received: (qmail 73844 invoked by uid 65534); 19 Apr 2006 03:50:12 -0000 Message-ID: <20060419035012.73843.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r395121 [1/2] - 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/ deploy-t... Date: Wed, 19 Apr 2006 03:50:08 -0000 To: scm@geronimo.apache.org From: ammulder@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ammulder Date: Tue Apr 18 20:50:05 2006 New Revision: 395121 URL: http://svn.apache.org/viewcvs?rev=395121&view=rev Log: Work toward being able to redeploy things with no version in the Config ID, and also using the new Config ID reload code (sadly, it doesn't work yet) Add documentation and exceptions controlling when Artifacts need to be fully resolved. Added: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java (with props) Modified: 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/PluginBootstrap.java geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployUtils.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/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java Added: 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=395121&view=auto ============================================================================== --- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java (added) +++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java Tue Apr 18 20:50:05 2006 @@ -0,0 +1,224 @@ +/** + * + * 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.plugin; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.InputStreamReader; +import java.io.DataInputStream; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.util.jar.JarFile; +import java.util.jar.JarEntry; +import java.util.Stack; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.ParserConfigurationException; +import org.apache.geronimo.common.DeploymentException; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.DefaultHandler; + +/** + * Knows how to suck a Config ID out of a module and/or plan + * + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $ + */ +public class ConfigIDExtractor { + + /** + * Attempt to calculate the Geronimo ModuleID for a J2EE application + * module. + * + * Given a File representing an archive (which may be a JAR file or a + * directory laid out like a JAR file), identify it's J2EE module type + * based on which (if any) deployment descriptor is present, and then look + * for a Geronimo deployment plan in the usual place, and if one is found, + * retrieve the configId from the Geronimo deployment plan. + * + * todo: Handle Spring and other weird deployment types? + * + * @param module A Jar file or directory representing a J2EE module + * @return The configId in the Geronimo deployment plan for this module, + * or null if no Geronimo deployment plan was identified. + */ + public static String extractModuleIdFromArchive(File module) throws IOException, DeploymentException { + if(!module.canRead()) { + throw new DeploymentException("Not a readable file ("+module.getAbsolutePath()+")"); + } + if(module.isDirectory()) { + File target; + if(new File(module, "WEB-INF/web.xml").canRead()) { + target = new File(module, "WEB-INF/geronimo-web.xml"); + } else if(new File(module, "META-INF/application.xml").canRead()) { + target = new File(module, "META-INF/geronimo-application.xml"); + } else if(new File(module, "META-INF/ejb-jar.xml").canRead()) { + target = new File(module, "META-INF/openejb-jar.xml"); + } else if(new File(module, "META-INF/ra.xml").canRead()) { + target = new File(module, "META-INF/geronimo-ra.xml"); + } else if(new File(module, "META-INF/application-client.xml").canRead()) { + target = new File(module, "META-INF/geronimo-application-client.xml"); + } else { + target = new File(module, "META-INF/geronimo-service.xml"); + } + if(target.canRead()) { + Reader in = new BufferedReader(new FileReader(target)); + return extractModuleIdFromPlan(in); + } + } else { + if(!isJarFile(module)) { + throw new DeploymentException(module.getAbsolutePath()+" is neither a JAR file nor a directory!"); + } + JarFile input = new JarFile(module); + //todo: instead of looking for specific file names here, do something generic. + // Perhaps load a DConfigBeanRoot and look for a configId property on the first child, + // though that would probably be a little heavyweight. + try { + JarEntry entry; + if(input.getJarEntry("WEB-INF/web.xml") != null) { + entry = input.getJarEntry("WEB-INF/geronimo-web.xml"); + } else if(input.getJarEntry("META-INF/application.xml") != null) { + entry = input.getJarEntry("META-INF/geronimo-application.xml"); + } else if(input.getJarEntry("META-INF/ejb-jar.xml") != null) { + entry = input.getJarEntry("META-INF/openejb-jar.xml"); + } else if(input.getJarEntry("META-INF/ra.xml") != null) { + entry = input.getJarEntry("META-INF/geronimo-ra.xml"); + } else if(input.getJarEntry("META-INF/application-client.xml") != null) { + entry = input.getJarEntry("META-INF/geronimo-application-client.xml"); + } else { + entry = input.getJarEntry("META-INF/geronimo-service.xml"); + } + if(entry != null) { + Reader in = new BufferedReader(new InputStreamReader(input.getInputStream(entry))); + return extractModuleIdFromPlan(in); + } + } finally { + input.close(); + } + } + return null; + } + + /** + * Attempt to calculate the Geronimo ModuleID for a Geronimo deployment + * plan. + * + * @param plan A Geronimo deployment plan (which must be an XML file). + * @return The configId in the Geronimo deployment plan for this module. + */ + public static String extractModuleIdFromPlan(File plan) throws IOException { + if(plan.isDirectory() || !plan.canRead()) { + throw new IllegalArgumentException(plan.getAbsolutePath()+" is not a readable XML file!"); + } + Reader in = new BufferedReader(new FileReader(plan)); + return extractModuleIdFromPlan(in); + } + + private static String extractModuleIdFromPlan(Reader plan) throws IOException { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setValidating(false); + try { + SAXParser parser = factory.newSAXParser(); + ConfigIdHandler handler = new ConfigIdHandler(); + parser.parse(new InputSource(plan), handler); + return handler.configId; + } catch (ParserConfigurationException e) { + throw new IOException("Unable to read plan: "+e.getMessage()); + } catch (SAXException e) { + throw new IOException("Unable to read plan: "+e.getMessage()); + } finally { + plan.close(); + } + } + + /** + * Try to determine whether a file is a JAR File (or, at least, a ZIP file). + */ + public static boolean isJarFile(File file) throws DeploymentException { + if(file.isDirectory()) { + return false; + } + if(!file.canRead()) { + throw new DeploymentException("Cannot read file "+file.getAbsolutePath()); + } + if(file.length() < 4) { + return false; + } + try { + DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); + int test = in.readInt(); + in.close(); + return test == 0x504b0304; + } catch(IOException e) { + throw new DeploymentException("Cannot read from file "+file.getAbsolutePath(), e); + } + } + + private static class ConfigIdHandler extends DefaultHandler { + private String configId; + private boolean inConfigId; + private String groupId = "", artifactId = "", version = "", type = ""; + private String inElement = null; + private Stack parent = new Stack(); + + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + if(inConfigId) { + if(localName.equals("groupId") || localName.equals("artifactId") || localName.equals("version") || localName.equals("type")) { + inElement = localName; + } + } else { + if(parent.size() == 2 && localName.equals("configId")) { + inConfigId = true; // only document/environment/configId, not e.g. configId in nested plan in EAR + } + } + parent.push(localName); + } + + public void characters(char ch[], int start, int length) throws SAXException { + if(inElement != null) { + if(inElement.equals("groupId")) groupId += new String(ch, start, length); + else if(inElement.equals("artifactId")) artifactId += new String(ch, start, length); + else if(inElement.equals("version")) version += new String(ch, start, length); + else if(inElement.equals("type")) type += new String(ch, start, length); + } + } + + public void endElement(String uri, String localName, String qName) throws SAXException { + inElement = null; + if(inConfigId && localName.equals("configId")) { + inConfigId = false; + } + if(parent.peek().equals(localName)) { + parent.pop(); + } else { + throw new IllegalStateException("End of "+localName+" but expecting "+parent.peek()); + } + } + + public void endDocument() throws SAXException { + if(type.equals("")) { + type = "car"; + } + configId = groupId+"/"+artifactId+"/"+version+"/"+type; + } + } +} Propchange: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/ConfigIDExtractor.java ------------------------------------------------------------------------------ svn:eol-style = native 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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006 @@ -16,21 +16,24 @@ */ package org.apache.geronimo.deployment.plugin.local; +import java.io.File; +import java.io.InputStream; +import java.util.Iterator; +import javax.enterprise.deploy.shared.CommandType; +import javax.enterprise.deploy.spi.Target; +import javax.enterprise.deploy.spi.TargetModuleID; +import org.apache.geronimo.deployment.plugin.ConfigIDExtractor; import org.apache.geronimo.deployment.plugin.TargetImpl; import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl; import org.apache.geronimo.deployment.util.DeploymentUtil; +import org.apache.geronimo.gbean.AbstractName; import org.apache.geronimo.kernel.InternalKernelException; import org.apache.geronimo.kernel.Kernel; -import org.apache.geronimo.kernel.repository.Artifact; import org.apache.geronimo.kernel.config.ConfigurationManager; import org.apache.geronimo.kernel.config.ConfigurationUtil; +import org.apache.geronimo.kernel.config.LifecycleResults; import org.apache.geronimo.kernel.config.NoSuchConfigException; -import org.apache.geronimo.gbean.AbstractName; - -import javax.enterprise.deploy.shared.CommandType; -import javax.enterprise.deploy.spi.TargetModuleID; -import java.io.File; -import java.io.InputStream; +import org.apache.geronimo.kernel.repository.Artifact; /** * @version $Rev$ $Date$ @@ -38,8 +41,7 @@ public class RedeployCommand extends AbstractDeployCommand { private static final String[] IS_IN_PLACE_CONFIGURATION_SIG = {Artifact.class.getName()}; private static final String IS_IN_PLACE_CONFIGURATION_METH = "isInPlaceConfiguration"; - - private static final String[] UNINSTALL_SIG = {Artifact.class.getName()}; + private final TargetModuleID[] modules; public RedeployCommand(Kernel kernel, TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) { @@ -68,55 +70,32 @@ copyTo(deploymentPlan, deploymentStream); } } + Artifact configID; + if(deploymentPlan != null) { + configID = Artifact.create(ConfigIDExtractor.extractModuleIdFromPlan(deploymentPlan)); + } else { + configID = Artifact.create(ConfigIDExtractor.extractModuleIdFromArchive(moduleArchive)); + } + if(configID.getGroupId() == null || configID.getType() == null) { + configID = new Artifact(configID.getGroupId() == null ? Artifact.DEFAULT_GROUP_ID : configID.getGroupId(), + configID.getArtifactId(), configID.getVersion(), + configID.getType() == null ? "car" : configID.getType()); + } ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel); try { for (int i = 0; i < modules.length; i++) { TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i]; - - Artifact configID = Artifact.create(module.getModuleID()); - try { - configurationManager.stopConfiguration(configID); - updateStatus("Stopped "+configID); - } catch (InternalKernelException e) { - Exception cause = (Exception)e.getCause(); - if(cause instanceof NoSuchConfigException) { - // The modules isn't loaded -- that's OK - } else { - throw cause; - } - } - try { - configurationManager.unloadConfiguration(configID); - updateStatus("Unloaded "+configID); - } catch(InternalKernelException e) { - Exception cause = (Exception)e.getCause(); - if(cause instanceof NoSuchConfigException) { - // The modules isn't loaded -- that's OK + Artifact artifact = Artifact.create(module.getModuleID()); + if(configID.isResolved()) { + if(configID.equals(artifact)) { + redeploySameConfiguration(configurationManager, artifact, module.getTarget()); } else { - throw cause; + redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget()); } - } catch (NoSuchConfigException e) { - // The modules isn't loaded -- that's OK + } else { + redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget()); } - - TargetImpl target = (TargetImpl) module.getTarget(); - AbstractName storeName = target.getAbstractName(); - - // if the configuration is an in-place one, then redeploys - // in in-place mode. - Boolean inPlaceConfiguration = (Boolean) kernel.invoke(storeName, IS_IN_PLACE_CONFIGURATION_METH, new Object[]{configID}, IS_IN_PLACE_CONFIGURATION_SIG); - commandContext.setInPlace(inPlaceConfiguration.booleanValue()); - - kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG); - updateStatus("Uninstalled "+configID); - - doDeploy(module.getTarget(), false); - updateStatus("Deployed "+configID); - - configurationManager.loadConfiguration(configID); - configurationManager.startConfiguration(configID); - updateStatus("Started " + configID); } } finally { ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager); @@ -135,5 +114,106 @@ } } } + } + + private void redeployUpdatedConfiguration(ConfigurationManager manager, Artifact previous, Target target) throws Exception, NoSuchConfigException { + // Send the new configuration to the server + + // if the configuration is an in-place one, then redeploys + // in in-place mode. + TargetImpl impl = (TargetImpl) target; + AbstractName storeName = impl.getAbstractName(); + Boolean inPlaceConfiguration = (Boolean) kernel.invoke(storeName, IS_IN_PLACE_CONFIGURATION_METH, new Object[]{previous}, IS_IN_PLACE_CONFIGURATION_SIG); + commandContext.setInPlace(inPlaceConfiguration.booleanValue()); + doDeploy(target, false); + Artifact configID = Artifact.create(getResultTargetModuleIDs()[0].getModuleID()); + LifecycleResults results = manager.reloadConfiguration(previous, configID.getVersion()); + + // Activate it + //todo: make this asynchronous + for (Iterator it = results.getStopped().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Stopped "+name); + } + for (Iterator it = results.getUnloaded().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Unloaded "+name); + } + for (Iterator it = results.getReloaded().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Reloaded "+name); + } + for (Iterator it = results.getLoaded().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Loaded "+name); + } + for (Iterator it = results.getRestarted().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Restarted "+name); + } + for (Iterator it = results.getStarted().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Started "+name); + } + for (Iterator it = results.getFailed().keySet().iterator(); it.hasNext();) { + Artifact name = (Artifact) it.next(); + updateStatus("Failed on "+name+": "+results.getFailedCause(name).getMessage()); + doFail((Exception)results.getFailedCause(name)); + } + } + + private void redeploySameConfiguration(ConfigurationManager configurationManager, Artifact configID, Target target) throws Exception { + try { + configurationManager.stopConfiguration(configID); + updateStatus("Stopped "+configID); + } catch (InternalKernelException e) { + Exception cause = (Exception)e.getCause(); + if(cause instanceof NoSuchConfigException) { + // The modules isn't loaded -- that's OK + } else { + throw cause; + } + } + try { + configurationManager.unloadConfiguration(configID); + updateStatus("Unloaded "+configID); + } catch(InternalKernelException e) { + Exception cause = (Exception)e.getCause(); + if(cause instanceof NoSuchConfigException) { + // The modules isn't loaded -- that's OK + } else { + throw cause; + } + } catch (NoSuchConfigException e) { + // The modules isn't loaded -- that's OK + } + + // if the configuration is an in-place one, then redeploys + // in in-place mode. + TargetImpl impl = (TargetImpl) target; + AbstractName storeName = impl.getAbstractName(); + Boolean inPlaceConfiguration = (Boolean) kernel.invoke(storeName, IS_IN_PLACE_CONFIGURATION_METH, new Object[]{configID}, IS_IN_PLACE_CONFIGURATION_SIG); + commandContext.setInPlace(inPlaceConfiguration.booleanValue()); + + try { + configurationManager.uninstallConfiguration(configID); + updateStatus("Uninstalled "+configID); + } catch(InternalKernelException e) { + Exception cause = (Exception)e.getCause(); + if(cause instanceof NoSuchConfigException) { + throw new IllegalStateException("Module "+configID+" is not installed!"); + } else { + throw cause; + } + } catch (NoSuchConfigException e) { + throw new IllegalStateException("Module "+configID+" is not installed!"); + } + + doDeploy(target, false); + updateStatus("Deployed "+configID); + + configurationManager.loadConfiguration(configID); + configurationManager.startConfiguration(configID); + updateStatus("Started " + configID); } } 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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006 @@ -73,7 +73,7 @@ } }; - DeploymentContext context = builder.buildConfiguration(false, config, null, Collections.singleton(targetConfigurationStore), targetConfigurationStore); + DeploymentContext context = builder.buildConfiguration(false, builder.getConfigurationID(config, null), config, null, Collections.singleton(targetConfigurationStore), targetConfigurationStore); ConfigurationData configurationData = context.getConfigurationData(); JarOutputStream out = new JarOutputStream(new FileOutputStream(carFile)); Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java?rev=395121&r1=395120&r2=395121&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java (original) +++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java Tue Apr 18 20:50:05 2006 @@ -17,31 +17,23 @@ package org.apache.geronimo.deployment.cli; -import java.io.*; -import java.util.jar.JarFile; -import java.util.jar.JarEntry; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; import java.util.Collection; -import java.util.List; import java.util.LinkedList; -import java.util.Stack; - -import org.apache.geronimo.common.DeploymentException; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.DefaultHandler; - -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.ParserConfigurationException; +import java.util.List; import javax.enterprise.deploy.spi.TargetModuleID; +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.deployment.plugin.ConfigIDExtractor; +import org.apache.geronimo.kernel.repository.Artifact; /** * Various helpers for deployment. * * @version $Rev$ $Date$ */ -public class DeployUtils { +public class DeployUtils extends ConfigIDExtractor { /** * Split up an output line so it indents at beginning and end (to fit in a * typical terminal) and doesn't break in the middle of a word. @@ -113,9 +105,15 @@ if((pos = name.indexOf('|')) > -1) { String target = name.substring(0, pos); String module = name.substring(pos+1); + Artifact artifact = Artifact.create(module); + if(artifact.getGroupId() == null || artifact.getType() == null) { + artifact = new Artifact(artifact.getGroupId() == null ? Artifact.DEFAULT_GROUP_ID : artifact.getGroupId(), + artifact.getArtifactId(), artifact.getVersion(), + artifact.getType() == null ? "car" : artifact.getType()); + } // First pass: exact match for(int i=0; i