geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
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 GMT
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<allModules.length; i++) {
-                if(allModules[i].getTarget().getName().equals(target) && allModules[i].getModuleID().equals(module)) {
+                if(allModules[i].getTarget().getName().equals(target) && artifact.matches(Artifact.create(allModules[i].getModuleID()))) {
                     list.add(allModules[i]);
                 }
             }
@@ -124,8 +122,14 @@
             return list;
         }
         // second pass: module matches
+        Artifact artifact = Artifact.create(name);
+        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());
+        }
         for(int i = 0; i < allModules.length; i++) {
-            if(allModules[i].getModuleID().equals(name)) {
+            if(artifact.matches(Artifact.create(allModules[i].getModuleID()))) {
                 list.add(allModules[i]);
             }
         }
@@ -137,184 +141,5 @@
                     "If you're not sure what's running, try the list-modules command.");
         }
         return list;
-    }
-
-
-    /**
-     * 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);
-        }
-    }
-
-    /**
-     * 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 = null;
-            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 = null;
-                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();
-        }
-    }
-
-    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;
-        }
     }
 }

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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006
@@ -64,5 +64,5 @@
      * @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
      */
-    DeploymentContext buildConfiguration(boolean inPlaceDeployment, Object plan, JarFile module, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException;
+    DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile module, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException;
 }

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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006
@@ -17,26 +17,6 @@
 
 package org.apache.geronimo.deployment;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
-import org.apache.geronimo.system.main.CommandLineManifest;
-
-import javax.management.ObjectName;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -53,6 +33,25 @@
 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.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
+import org.apache.geronimo.system.main.CommandLineManifest;
 
 /**
  * GBean that knows how to deploy modules (by consulting available module builders)
@@ -243,8 +242,28 @@
                         (moduleFile == null ? "" : (planFile == null ? "" : ", ")+"moduleFile=" + moduleFile.getAbsolutePath())+")");
             }
 
-            // Make sure this configuration doesn't already exist
             Artifact configID = builder.getConfigurationID(plan, module);
+            // 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);
+            }
+            // Make sure this configuration doesn't already exist
             try {
                 kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
                 throw new DeploymentException("Module "+configID+" already exists in the server.  Try to undeploy it first or use the redeploy command.");
@@ -280,7 +299,7 @@
             }
             ConfigurationStore store = (ConfigurationStore) stores.iterator().next();
             // It's our responsibility to close this context, once we're done with it...
-            DeploymentContext context = builder.buildConfiguration(inPlace, plan, module, stores, store);
+            DeploymentContext context = builder.buildConfiguration(inPlace, configID, plan, module, stores, store);
             List configurations = new ArrayList();
             configurations.add(context.getConfigurationData());
             configurations.addAll(context.getAdditionalDeployment());

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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006
@@ -335,14 +335,13 @@
         return applicationInfo.getEnvironment().getConfigId();
     }
 
-    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Object plan, JarFile earFile, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile earFile, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
         assert plan != null;
         ApplicationInfo applicationInfo = (ApplicationInfo) plan;
 
         EARContext earContext = null;
         ConfigurationModuleType applicationType = applicationInfo.getType();
-        Environment environment = applicationInfo.getEnvironment();
-        Artifact configId = environment.getConfigId();
+        applicationInfo.getEnvironment().setConfigId(configId);
         File configurationDir;
         try {
             configurationDir = targetConfigurationStore.createNewConfigurationDir(configId);

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=395121&r1=395120&r2=395121&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 Tue Apr 18 20:50:05 2006
@@ -268,7 +268,7 @@
                     naming);
 
             Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
         } finally {
             if (context != null) {
@@ -302,7 +302,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-ejb-jar.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -341,7 +341,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-war.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -380,7 +380,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-rar.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -419,7 +419,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(new File(basedir, "target/plans/test-bad-car.xml"), earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -459,7 +459,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -496,7 +496,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {
@@ -533,7 +533,7 @@
         DeploymentContext context = null;
         try {
             Object plan = configBuilder.getDeploymentPlan(null, earFile);
-            context = configBuilder.buildConfiguration(false, plan, earFile, Collections.singleton(configStore), configStore);
+            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile), plan, earFile, Collections.singleton(configStore), configStore);
             configurationData = context.getConfigurationData();
             fail("Should have thrown a DeploymentException");
         } catch (DeploymentException e) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Apr 18 20:50:05 2006
@@ -29,27 +29,79 @@
  */
 public interface ConfigurationManager {
     /**
+     * Is the specified configuration installed into the server
+     * environment?  That is, does it exist in the configuration store,
+     * regardless of whether it's loaded or running?
+     *
+     * @param configurationId the configuration identifier, which must be
+     *                        fully resolved (isResolved() == true)
+     *
+     * @return true if the configuration has been loaded; false otherwise
+     */
+    boolean isInstalled(Artifact configurationId);
+
+    /**
      * Is the specified configuration loaded into the kernel?
-     * @param configurationId the configuration identifier
+     *
+     * @param configurationId the configuration identifier, which must be
+     *                        fully resolved (isResolved() == true)
+     *
      * @return true if the configuration has been loaded; false otherwise
      */
     boolean isLoaded(Artifact configurationId);
 
     /**
      * Is the specified configuation running?
-     * @param configurationId the configuration identifier
+     *
+     * @param configurationId the configuration identifier, which must be
+     *                        fully resolved (isResolved() == true)
+     *
      * @return true if the configuration is running, false otherwise
      */
     boolean isRunning(Artifact configurationId);
 
     /**
+     * Given an artifact that's not fully resolved (e.g. some parts are
+     * missing), check whether there are any instances installed into
+     * the server environment.  That is, are there any matches in the
+     * configuration store, regardless of whether they're loaded or running?
+     *
+     * @param query The partially-complete artifact name to check for
+     *
+     * @return All matching artifacts that are loaded in the server
+     */
+    Artifact[] getInstalled(Artifact query);
+
+    /**
+     * Given an artifact that's not fully resolved (e.g. some parts are
+     * missing), check whether there are any instances loaded.
+     *
+     * @param query The partially-complete artifact name to check for
+     *
+     * @return All matching artifacts that are loaded in the server
+     */
+    Artifact[] getLoaded(Artifact query);
+
+    /**
+     * Given an artifact that's not fully resolved (e.g. some parts are
+     * missing), check whether there are any instances running.
+     *
+     * @param query The partially-complete artifact name to check for
+     *
+     * @return All matching artifacts that are loaded in the server
+     */
+    Artifact[] getRunning(Artifact query);
+
+    /**
      * Gets a List&gt;ConfigurationInfo&lt; of every of every available configuation.
-     * @return a List&gt;ConfigurationInfo&lt; of every of every available configuation
+     * This includes all configurations installed, regardless of whether they are
+     * currently loaded or running.
      */
     List listConfigurations();
 
     /**
      * Return a list of the stores this manager knows about.
+     *
      * @return a List&gt;AbstractName&lt; of the stores this manager controls
      */
     List listStores();
@@ -61,7 +113,14 @@
 
     /**
      * Gets the configuration store responsible for the specified
-     * configuration, or null if there is none.
+     * configuration, or null if there is none.  The configuration need not be
+     * loaded or running; this just checks which store holds the data for it.
+     *
+     * @param configuration The unique ID for the configuration to check for,
+     *                      which must be fully resolved (isResolved() == true)
+     *
+     * @return The ConfigurationStore for this configuration, or null if the
+     *         configuration was not found in any configuration store.
      */
     ConfigurationStore getStoreForConfiguration(Artifact configuration);
 
@@ -69,243 +128,317 @@
      * Return a list of the configurations in a specific store.
      *
      * @param store the store to list
+     *
      * @return a List&gt;ConfigurationInfo&lt; of all the configurations in the store
+     *
      * @throws NoSuchStoreException if the store could not be located
      */
     List listConfigurations(AbstractName store) throws NoSuchStoreException;
 
     /**
-     * Is the specified artifact a configuration that has been loaded in the kernel?
+     * Is the specified artifact a configuration?
      *
-     * @param artifact the artifact to check
+     * @param artifact the ID of the artifact to check, which must be fully
+     *                 resolved (isResolved() == true)
      *
-     * @return true if the artifact is a configuration and has been loaded
+     * @return true if the artifact is a configuration available in the
+     *         server (regardless of whether it has been loaded/started)
      */
     boolean isConfiguration(Artifact artifact);
 
     /**
      * Gets a loaded Configuration (does not see unloaded configurations).
      *
-     * @param configurationId the configuration to get
+     * @param configurationId the unique ID of the configuration to get, which
+     *                        must be fully resolved (isResolved() == true)
      *
      * @return the specified configuration or null if the configuration has not been loaded
      */
     Configuration getConfiguration(Artifact configurationId);
 
     /**
-     * Load the specified configuration (from a config store) and all configurations it depends on into the kernel.
-     * This causes the configuration gbean to be loaded and started, but does not load any of the gbean contained
-     * within the configuration.
+     * Load the specified configuration (from a config store) and all
+     * configurations it depends on into the kernel.  This causes the
+     * configuration gbean to be loaded and started, but does not load any of
+     * the gbeans contained within the configuration.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Load the specified configurationData and all configurations it depends on (from a config store) into
-     * the kernel. This causes the configuration gbean to be loaded and started, but does not load any of the
-     * gbean contained within the configuration.
+     * Load the specified configurationData and all configurations it depends
+     * on (from a config store) into the kernel. This causes the configuration
+     * gbean to be loaded and started, but does not load any of the gbeans
+     * contained within the configuration.
      *
      * @param configurationData the configuration to load
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Load the specified configuration (from a config store) and all configurations it depends on into the kernel.
-     * This causes the configuration gbean to be loaded and started, but does not load any of the gbean contained
-     * within the configuration.
+     * Load the specified configuration (from a config store) and all
+     * configurations it depends on into the kernel.  This causes the
+     * configuration gbean to be loaded and started, but does not load any of
+     * the gbeans contained within the configuration.
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Load the specified configurationData and all configurations it depends on (from a config store) into
-     * the kernel. This causes the configuration gbean to be loaded and started, but does not load any of the
-     * gbean contained within the configuration.
+     * Load the specified configurationData and all configurations it depends
+     * on (from a config store) into the kernel. This causes the configuration
+     * gbean to be loaded and started, but does not load any of the gbeans
+     * contained within the configuration.
      *
      * @param configurationData the configuration to load
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Stops and unloads the configuration.  This causes all contained gbeans to be stopped and unloaded, and the
-     * configuration gbean is stopped and unloaded.  This operation causes all configurations that have a class
-     * or service dependency on the specified configuration to be stopped and unloaded.
+     * Stops and unloads the configuration.  This causes all contained gbeans
+     * to be stopped and unloaded, and the configuration gbean is stopped and
+     * unloaded.  This operation causes all configurations that have a class
+     * or service dependency on the specified configuration to be stopped and
+     * unloaded.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults unloadConfiguration(Artifact configurationId) throws NoSuchConfigException;
 
     /**
-     * Stops and unloads the configuration.  This causes all contained gbeans to be stopped and unloaded, and the
-     * configuration gbean is stopped and unloaded.  This operation causes all configurations that have a class
-     * or service dependency on the specified configuration to be stopped and unloaded.
+     * Stops and unloads the configuration.  This causes all contained gbeans
+     * to be stopped and unloaded, and the configuration gbean is stopped and
+     * unloaded.  This operation causes all configurations that have a class
+     * or service dependency on the specified configuration to be stopped and
+     * unloaded.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
+     * @param monitor         the monitor that should receive events as the
+     *                        operation is carried out
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
-     * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults unloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException;
 
     /**
-     * Loads and starts all of the gbeans contained within the configuration.  If any of the gbeans fails to fully
-     * start, all gbeans will be unloaded and an exception will be thrown.  This operation causes all configurations
-     * that the specified configuration has a service dependency on to be started.
+     * Loads and starts all of the gbeans contained within the configuration.
+     * If any of the gbeans fails to fully start, all gbeans will be unloaded
+     * and an exception will be thrown.  This operation causes all
+     * configurations that the specified configuration has a service dependency
+     * on to be started.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults startConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Loads and starts all of the gbeans contained within the configuration.  If any of the gbeans fails to fully
-     * start, all gbeans will be unloaded and an exception will be thrown.  This operation causes all configurations
-     * that the specified configuration has a service dependency on to be started.
+     * Loads and starts all of the gbeans contained within the configuration.
+     * If any of the gbeans fails to fully start, all gbeans will be unloaded
+     * and an exception will be thrown.  This operation causes all
+     * configurations that the specified configuration has a service dependency
+     * on to be started.
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults startConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Stop the gbeans contained within the configuration.  This operation causes all configurations that have a
-     * service dependency on the specified configuration to be stopped.
+     * Stop the gbeans contained within the configuration.  This operation
+     * causes all configurations that have a service dependency on the
+     * specified configuration to be stopped.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults stopConfiguration(Artifact configurationId) throws NoSuchConfigException;
 
     /**
-     * Stop the gbeans contained within the configuration.  This operation causes all configurations that have a
-     * service dependency on the specified configuration to be stopped.
+     * Stop the gbeans contained within the configuration.  This operation
+     * causes all configurations that have a service dependency on the
+     * specified configuration to be stopped.
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      */
     LifecycleResults stopConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException;
 
     /**
-     * Restarts the specified configuration and all configurations that have a service dependency on the
-     * specified configuration
+     * Restarts the specified configuration and all configurations that have a
+     * service dependency on the specified configuration
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults restartConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Restarts the specified configuration and all configurations that have a service dependency on the
-     * specified configuration
+     * Restarts the specified configuration and all configurations that have a
+     * service dependency on the specified configuration
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults restartConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the specified configuration
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      *
-     * @param configurationId the configuration identifier
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the specified configuration
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the* specified configuration
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param version new version to load from the config store
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(Artifact configurationId, Version version) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the specified configuration
      *
-     * @param configurationId the configuration identifier
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
      * @param monitor the monitor that should receive events as the operation is carried out
      * @param version new version to load from the config store
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(Artifact configurationId, Version version, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the specified configuration
      *
      * @param configurationData the configuration to load
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Reloads the specified configuration and all configurations that have a dependency on the
-     * specified configuration
+     * Reloads the specified configuration and all configurations that have a
+     * dependency on the specified configuration
      *
      * @param configurationData the configuration to load
      * @param monitor the monitor that should receive events as the operation is carried out
+     *
      * @return the results of the operation
+     *
      * @throws NoSuchConfigException if the configuration is not loaded
      * @throws LifecycleException if there is a problem loading the configuration
      */
     LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
     /**
-     * Unstalls the specified configuration from the server.   This operation can not be reversed.
-     * @param configurationId the configuration identifier
+     * Unstalls the specified configuration from the server.   This operation
+     * can not be reversed.
+     *
+     * @param configurationId the configuration identifier, which must be fully
+     *                        resolved (isResolved() == true)
+     * 
      * @throws IOException if there was a problem removing the configuration
      * @throws NoSuchConfigException if the configuration is not loaded
      */

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java Tue Apr 18 20:50:05 2006
@@ -21,6 +21,8 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.geronimo.kernel.repository.Artifact;
 
@@ -76,12 +78,38 @@
         return false;
     }
 
+    public Artifact[] getLoaded(Artifact query) {
+        List results = new ArrayList();
+        for (Iterator it = configurations.entrySet().iterator(); it.hasNext();) {
+            Map.Entry entry = (Map.Entry) it.next();
+            Artifact test = (Artifact) entry.getKey();
+            ConfigurationStatus status = (ConfigurationStatus) entry.getValue();
+            if(query.matches(test) && status.isLoaded()) {
+                results.add(test);
+            }
+        }
+        return (Artifact[]) results.toArray(new Artifact[results.size()]);
+    }
+
     public boolean isStarted(Artifact configurationId) {
         ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
         if (configurationStatus != null) {
             return configurationStatus.isStarted();
         }
         return false;
+    }
+
+    public Artifact[] getStarted(Artifact query) {
+        List results = new ArrayList();
+        for (Iterator it = configurations.entrySet().iterator(); it.hasNext();) {
+            Map.Entry entry = (Map.Entry) it.next();
+            Artifact test = (Artifact) entry.getKey();
+            ConfigurationStatus status = (ConfigurationStatus) entry.getValue();
+            if(query.matches(test) && status.isStarted()) {
+                results.add(test);
+            }
+        }
+        return (Artifact[]) results.toArray(new Artifact[results.size()]);
     }
 
     public LinkedHashSet load(Artifact configurationId) throws NoSuchConfigException {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Tue Apr 18 20:50:05 2006
@@ -39,10 +39,13 @@
      * means that the configuration store only stores some meta-data and the 
      * actual content of the configuration is rooted somewhere else.
      * 
-     * @param configId the unique ID of the configuration
+     * @param configId the unique ID of the configuration, which must be fully
+     *                 resolved (isResolved() == true)
+     *
      * @return true if the identified configuration is an in-place one.
+     *
      * @throws NoSuchConfigException if the configuration is not contained in
-     * the store
+     *                               the store
      * @throws IOException If the store cannot be read.
      */
     boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException;
@@ -58,7 +61,10 @@
 
     /**
      * Removes a configuration from the store
-     * @param configId the id of the configuration to remove
+     *
+     * @param configId the id of the configuration to remove, which must be
+     *                 fully resolved (isResolved() == true)
+     *
      * @throws NoSuchConfigException if the configuration is not contained in the store
      * @throws IOException if a problem occurs during the removal
      */
@@ -66,8 +72,12 @@
 
     /**
      * Loads the specified configuration into the kernel
-     * @param configId the id of the configuration to load
+     *
+     * @param configId the id of the configuration to load, which must be fully
+     *                 resolved (isResolved() == true)
+     *
      * @return the the configuration object
+     *
      * @throws NoSuchConfigException if the configuration is not contained in the kernel
      * @throws IOException if a problem occurs loading the configuration from the store
      * @throws InvalidConfigException if the configuration is corrupt
@@ -75,9 +85,13 @@
     ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException;
 
     /**
-     * Determines if the store contains a configuration with the spedified ID.
+     * Determines if the store contains a configuration with the specified ID.
+     * The configuration need not be loaded or running, this just checks
+     * whether the configuration store has the data for it.
+     *
+     * @param configId the unique ID of the configuration, which must be fully
+     *                 resolved (isResolved() == true)
      *
-     * @param configId the unique ID of the configuration
      * @return true if the store contains the configuration
      */
     boolean containsConfiguration(Artifact configId);
@@ -99,14 +113,16 @@
     /**
      * Return the configurations in the store
      *
-     * @return a List ConfigurationInfo objects
+     * @return a List (with entries of type ConfigurationInfo) of all the
+     *         configurations contained in this configuration store
      */
     List listConfigurations();
 
     /**
-     * Creates an empty diretory for a new configuration with the specified configId
+     * Creates an empty directory for a new configuration with the specified configId
      *
-     * @param configId the unique ID of the configuration
+     * @param configId the unique ID of the configuration, which must be fully
+     *                 resolved (isResolved() == true)
      *
      * @return the location of the new directory
      * 
@@ -115,19 +131,26 @@
     File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException;
 
     /**
-     * Locate the physical locations which match the supplied path in the given artifact/module.  The path may be and
-     * ant style pattern.
-     * @param configId the artifact to search
-     * @param moduleName the module name or null
-     * @param path the pattern to search for with the artifact/module
-     * @return as Set&gt;URL&lt; of the matching locations
+     * Locate the physical locations which match the supplied path in the given
+     * artifact/module.  The path may be an Ant-style pattern.
+     *
+     * @param configId    the artifact to search, which must be fully resolved
+     *                    (isResolved() == true)
+     * @param moduleName  the module name or null to search in the top-level
+     *                    artifact location
+     * @param path        the pattern to search for within the artifact/module,
+     *                    which may also be null to identify the artifact or
+     *                    module base path
+     *
+     * @return a Set (with entries of type URL) of the matching locations
      */
     Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException;
 
     /**
-     * Exports a configuration as a ZIP file
+     * Exports a configuration as a ZIP file.
      *
-     * @param configId  The configuration to export
+     * @param configId  The unique ID of the configuration to export, which
+     *                  must be fully resolved (isResolved() == true)
      * @param output    The stream to write the ZIP content to
      */
     void exportConfiguration(Artifact configId, OutputStream output) throws IOException, NoSuchConfigException;



Mime
View raw message