You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/19 05:50:08 UTC

svn commit: r395121 [2/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...

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Tue Apr 18 20:50:05 2006
@@ -60,6 +60,48 @@
         this.repositories = repositories;
     }
 
+
+    public synchronized boolean isInstalled(Artifact configId) {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
+        List storeSnapshot = getStoreList();
+        for (int i = 0; i < storeSnapshot.size(); i++) {
+            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
+            if(store.containsConfiguration(configId)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public synchronized boolean isLoaded(Artifact configId) {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
+        return configurationModel.isLoaded(configId);
+    }
+
+    public synchronized boolean isRunning(Artifact configId) {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
+        return configurationModel.isStarted(configId);
+    }
+
+    public Artifact[] getInstalled(Artifact query) {
+        return artifactResolver.queryArtifacts(query);
+    }
+
+    public Artifact[] getLoaded(Artifact query) {
+        return configurationModel.getLoaded(query);
+    }
+
+    public Artifact[] getRunning(Artifact query) {
+        return configurationModel.getStarted(query);
+    }
+
+
     public List listStores() {
         List storeSnapshot = getStoreList();
         List result = new ArrayList(storeSnapshot.size());
@@ -86,11 +128,14 @@
         return list;
     }
 
-    public ConfigurationStore getStoreForConfiguration(Artifact configuration) {
+    public ConfigurationStore getStoreForConfiguration(Artifact configId) {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         List storeSnapshot = getStoreList();
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if(store.containsConfiguration(configuration)) {
+            if(store.containsConfiguration(configId)) {
                 return store;
             }
         }
@@ -132,6 +177,9 @@
     }
 
     public boolean isConfiguration(Artifact artifact) {
+        if(!artifact.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
+        }
         synchronized (this) {
             // if it is loaded, it is definitely a configuration
             if (configurations.containsKey(artifact)) {
@@ -151,16 +199,10 @@
     }
 
     public synchronized Configuration getConfiguration(Artifact configurationId) {
-        Configuration configuration = (Configuration) configurations.get(configurationId);
-        return configuration;
-    }
-
-    public synchronized boolean isLoaded(Artifact configurationId) {
-        return configurationModel.isLoaded(configurationId);
-    }
-
-    public synchronized boolean isRunning(Artifact configurationId) {
-        return configurationModel.isStarted(configurationId);
+        if(!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        }
+        return (Configuration) configurations.get(configurationId);
     }
 
     public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
@@ -168,6 +210,9 @@
     }
 
     public synchronized LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        if(!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        }
         if (configurationModel.isLoaded(configurationId)) {
             // already loaded, so just mark the configuration as user loaded
             configurationModel.load(configurationId);
@@ -202,9 +247,9 @@
         LifecycleResults results = new LifecycleResults();
         if (!configurationModel.isLoaded(id)) {
             // recursively load configurations from the new child to the parents
-            LinkedHashMap unloadedConfigurations = new LinkedHashMap();
+            LinkedHashMap configurationsToLoad = new LinkedHashMap();
             try {
-                loadDepthFirst(configurationData, unloadedConfigurations, monitor);
+                loadDepthFirst(configurationData, configurationsToLoad, monitor);
             } catch (Exception e) {
                 results.addFailed(id, e);
                 monitor.finished();
@@ -212,10 +257,10 @@
             }
 
             // load and start the unloaded the gbean for each configuration (depth first)
-            Map actuallyLoaded = new LinkedHashMap(unloadedConfigurations.size());
+            Map actuallyLoaded = new LinkedHashMap(configurationsToLoad.size());
             Artifact configurationId = null;
             try {
-                for (Iterator iterator = unloadedConfigurations.entrySet().iterator(); iterator.hasNext();) {
+                for (Iterator iterator = configurationsToLoad.entrySet().iterator(); iterator.hasNext();) {
                     Map.Entry entry = (Map.Entry) iterator.next();
                     configurationId = (Artifact) entry.getKey();
                     UnloadedConfiguration unloadedConfiguration = (UnloadedConfiguration) entry.getValue();
@@ -332,10 +377,10 @@
         return configurationIds;
     }
 
-    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap unloadedConfigurations, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException, MissingDependencyException {
+    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap configurationsToLoad, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException, MissingDependencyException {
         // if this parent hasn't already been processed, iterate into the parent
         Artifact configurationId = configurationData.getId();
-        if (!unloadedConfigurations.containsKey(configurationId)) {
+        if (!configurationsToLoad.containsKey(configurationId)) {
             LinkedHashSet resolvedParentIds = resolveParentIds(configurationData);
 
             for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
@@ -343,12 +388,12 @@
                 // if this parent id hasn't already been loaded and is actually a configuration
                 if (!configurations.containsKey(parentId) && isConfiguration(parentId)) {
                     ConfigurationData parentConfigurationData = loadConfigurationData(parentId, monitor);
-                    loadDepthFirst(parentConfigurationData, unloadedConfigurations, monitor);
+                    loadDepthFirst(parentConfigurationData, configurationsToLoad, monitor);
                 }
             }
 
             // depth first - all unloaded parents have been added, now add this configuration
-            unloadedConfigurations.put(configurationId, new UnloadedConfiguration(configurationData, resolvedParentIds));
+            configurationsToLoad.put(configurationId, new UnloadedConfiguration(configurationData, resolvedParentIds));
         }
     }
 
@@ -423,6 +468,9 @@
     }
 
     public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws  NoSuchConfigException, LifecycleException {
+        if(!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        }
         LinkedHashSet unstartedConfigurations = configurationModel.start(id);
 
         addConfigurationsToMonitor(monitor, unstartedConfigurations);
@@ -469,6 +517,9 @@
     }
 
     public synchronized LifecycleResults stopConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        if(!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        }
         LinkedHashSet stopList = configurationModel.stop(id);
 
         addConfigurationsToMonitor(monitor, stopList);
@@ -499,6 +550,9 @@
     }
 
     public synchronized LifecycleResults restartConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        if(!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        }
         // get a sorted list of configurations to restart
         LinkedHashSet restartList = configurationModel.restart(id);
 
@@ -575,6 +629,9 @@
     }
 
     public synchronized LifecycleResults unloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        if(!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        }
         Set started = configurationModel.getStarted();
         LinkedHashSet unloadList = configurationModel.unload(id);
 
@@ -627,10 +684,13 @@
     }
 
     public synchronized LifecycleResults reloadConfiguration(Artifact id, Version version) throws NoSuchConfigException, LifecycleException {
-        return reloadConfiguration(id, id.getVersion(), NullLifecycleMonitor.INSTANCE);
+        return reloadConfiguration(id, version, NullLifecycleMonitor.INSTANCE);
     }
 
     public synchronized LifecycleResults reloadConfiguration(Artifact id, Version version, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        if(!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        }
         Configuration configuration = getConfiguration(id);
         if (configuration == null) {
             throw new NoSuchConfigException(id);
@@ -846,6 +906,9 @@
     }
 
     public synchronized void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
+        if(!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        }
         if (configurations.containsKey(configurationId)) {
             stopConfiguration(configurationId);
             unloadConfiguration(configurationId);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ListableRepository.java Tue Apr 18 20:50:05 2006
@@ -33,8 +33,8 @@
 
     /**
      * Gets a list of all the available items matching the specified artifact,
-     * which is normally incomplete (so the results all match whatever fields
-     * are specified on the argument Artifact).
+     * which is normally not fully resolved (so the results all match whatever
+     * fields are specified on the argument Artifact).
      */
     public SortedSet list(Artifact query);
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Repository.java Tue Apr 18 20:50:05 2006
@@ -24,8 +24,7 @@
 import java.util.LinkedHashSet;
 
 /**
- * Provides access to things like JARs via a standard API.  Generally
- * these may be local (file: URLs) or remote (http: URLs).  This is
+ * Provides access to things like JARs via a standard API.  This is
  * a fairly limited read-only type repository.  There are additional
  * interfaces that a Repository may implement to indicate additional
  * capabilities.
@@ -33,9 +32,34 @@
  * @version $Rev$ $Date$
  */
 public interface Repository {
+    /**
+     * Checks whether this repository contains an entry for the specified
+     * artifact.  The artifact must be fully resolved (isResolved() == true).
+     */
     boolean contains(Artifact artifact);
 
+    /**
+     * Gets the location on disk where the specified artifact is stored.
+     * The artifact must be fully resolved (isResolved() == true).
+     *
+     * @return The location of the artifact, or null if it is not in this
+     *         repository.
+     */
     File getLocation(Artifact artifact);
 
+    /**
+     * Loads any dependencies for this artifact declared in
+     * META-INF/geronimo-service.xml within the configuration archive.  This
+     * does not do anything special if the artifact is a configuration (which
+     * means it doesn't see dependencies in the ConfigurationData, etc.) so
+     * it's mainly useful for JAR-type artifacts.
+     *
+     * @param artifact A fully-resolved artifact representing the repository
+     *                 entry you're interested in.
+     *
+     * @return a LinkedHashSet (with elements of type Artifact) listing any
+     *         dependencies declared in META-INF/geronimo-service.xml for the
+     *         specified artifact.
+     */
     LinkedHashSet getDependencies(Artifact artifact);
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/WriteableRepository.java Tue Apr 18 20:50:05 2006
@@ -33,6 +33,12 @@
      * to upload the file to the server's filesystem, even if the
      * the server is just going to turn around and upload it to some
      * other remote location.
+     *
+     * @param source       A file representing the data for the new repository
+     *                     entry
+     * @param destination  A fully-resolved artifact that tells the repository
+     *                     where it should save the data to
+     * @param monitor      Tracks the progress of the installation
      */
     public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException;
 
@@ -42,6 +48,12 @@
      * to upload the content to the server's JVM, even if the the server
      * is just going to turn around and upload it to some other remote
      * location.  The source will be closed when the write completes.
+     *
+     * @param source       A stream representing the data for the new
+     *                     repository entry
+     * @param destination  A fully-resolved artifact that tells the repository
+     *                     where it should save the data to
+     * @param monitor      Tracks the progress of the installation
      */
     public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException;
 }

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Tue Apr 18 20:50:05 2006
@@ -44,6 +44,7 @@
 import org.apache.geronimo.deployment.xbeans.ReferenceType;
 import org.apache.geronimo.deployment.xbeans.ReferencesType;
 import org.apache.geronimo.deployment.xbeans.XmlAttributeType;
+import org.apache.geronimo.deployment.xbeans.ArtifactType;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
@@ -174,16 +175,19 @@
         return environment.getConfigId();
     }
 
-    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Object plan, JarFile jar, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile jar, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
         ConfigurationType configType = (ConfigurationType) plan;
 
-        return buildConfiguration(inPlaceDeployment, configType, jar, configurationStores, targetConfigurationStore);
+        return buildConfiguration(inPlaceDeployment, configId, configType, jar, configurationStores, targetConfigurationStore);
     }
 
-    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, ConfigurationType configurationType, JarFile jar, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
-
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, ConfigurationType configurationType, JarFile jar, Collection configurationStores, ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
+        ArtifactType type = configurationType.getEnvironment().isSetConfigId() ? configurationType.getEnvironment().getConfigId() : configurationType.getEnvironment().addNewConfigId();
+        type.setArtifactId(configId.getArtifactId());
+        type.setGroupId(configId.getGroupId());
+        type.setType(configId.getType());
+        type.setVersion(configId.getVersion().toString());
         Environment environment = EnvironmentBuilder.buildEnvironment(configurationType.getEnvironment(), defaultEnvironment);
-        Artifact configId = environment.getConfigId();
         File outfile;
         try {
             outfile = targetConfigurationStore.createNewConfigurationDir(configId);

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java Tue Apr 18 20:50:05 2006
@@ -623,6 +623,9 @@
             if(list.isEmpty()) {
                 throw new MissingDependencyException("Unable to download dependency "+artifact);
             }
+            if(monitor != null) {
+                monitor.setTotalBytes(-1); // Just to be sure
+            }
             URL repository = (URL) list.removeFirst();
             URL url = artifact == null ? repository : getURL(artifact, repository);
             log.debug("Attempting to download "+artifact+" from "+url);

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Tue Apr 18 20:50:05 2006
@@ -83,6 +83,9 @@
     }
 
     public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File location = repository.getLocation(configId);
 
         if (!location.exists() && !location.canRead()) {
@@ -135,6 +138,9 @@
     }
 
     public boolean containsConfiguration(Artifact configId) {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File location = repository.getLocation(configId);
         if (location.isDirectory()) {
             location = new File(location, "META-INF");
@@ -155,6 +161,9 @@
     }
 
     public File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File location = repository.getLocation(configId);
         if (location.exists()) {
             throw new ConfigurationAlreadyExistsException("Configuration already exists: " + configId);
@@ -167,6 +176,9 @@
     }
 
     public Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File location = repository.getLocation(configId);
         if (location.isDirectory()) {
             File inPlaceLocation = null;
@@ -196,6 +208,9 @@
     }
 
     public void exportConfiguration(Artifact configId, OutputStream output) throws IOException, NoSuchConfigException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File dir = repository.getLocation(configId);
         if (dir == null) {
             throw new NoSuchConfigException(configId);
@@ -252,6 +267,9 @@
     }
 
     public boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         File location = repository.getLocation(configId);
         if (location.isDirectory()) {
             return inPlaceConfUtil.isInPlaceConfiguration(location);
@@ -298,6 +316,9 @@
     }
 
     public void uninstall(Artifact configId) throws NoSuchConfigException, IOException {
+        if(!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        }
         ConfigurationInfo configurationInfo = null;
         try {
             configurationInfo = loadConfigurationInfo(configId);

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java Tue Apr 18 20:50:05 2006
@@ -98,12 +98,18 @@
     }
 
     public boolean contains(Artifact artifact) {
+        if(!artifact.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
+        }
         File location = getLocation(artifact);
         return location.canRead() && (location.isFile() || new File(location, "META-INF").isDirectory());
     }
 
     private static final String NAMESPACE = "http://geronimo.apache.org/xml/ns/deployment-1.1";
     public LinkedHashSet getDependencies(Artifact artifact) {
+        if(!artifact.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
+        }
         LinkedHashSet dependencies = new LinkedHashSet();
         URL url;
         try {
@@ -161,6 +167,9 @@
     }
 
     public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+        if(!destination.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");
+        }
         if (!source.exists() || !source.canRead() || source.isDirectory()) {
             throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
         }
@@ -168,6 +177,9 @@
     }
 
     public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+        if(!destination.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");
+        }
         // is this a writable repository
         if (!rootFile.canWrite()) {
             throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")");

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java Tue Apr 18 20:50:05 2006
@@ -43,6 +43,9 @@
     }
 
     public File getLocation(Artifact artifact) {
+        if(!artifact.isResolved()) {
+            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
+        }
         File path = new File(rootFile, artifact.getGroupId().replace('.', File.separatorChar));
         path = new File(path, artifact.getArtifactId());
         path = new File(path, artifact.getVersion().toString());
@@ -55,24 +58,6 @@
         return listInternal(null, null, null);
     }
 
-    private SortedSet listInternal(String artifactMatch, String typeMatch, String versionMatch) {
-        SortedSet artifacts = new TreeSet();
-        File[] groupIds = rootFile.listFiles();
-        for (int i = 0; i < groupIds.length; i++) {
-            File groupId = groupIds[i];
-            if (groupId.canRead() && groupId.isDirectory()) {
-                File[] versionDirs = groupId.listFiles();
-                for (int j = 0; j < versionDirs.length; j++) {
-                    File versionDir = versionDirs[j];
-                    if (versionDir.canRead() && versionDir.isDirectory()) {
-                        artifacts.addAll(getArtifacts(null, versionDir, artifactMatch, typeMatch, versionMatch));
-                    }
-                }
-            }
-        }
-        return artifacts;
-    }
-
     public SortedSet list(Artifact query) {
         if(query.getGroupId() != null) { // todo: see if more logic can be shared with the other case
             File path = new File(rootFile, query.getGroupId().replace('.', File.separatorChar));
@@ -116,6 +101,24 @@
         }
     }
 
+    private SortedSet listInternal(String artifactMatch, String typeMatch, String versionMatch) {
+        SortedSet artifacts = new TreeSet();
+        File[] groupIds = rootFile.listFiles();
+        for (int i = 0; i < groupIds.length; i++) {
+            File groupId = groupIds[i];
+            if (groupId.canRead() && groupId.isDirectory()) {
+                File[] versionDirs = groupId.listFiles();
+                for (int j = 0; j < versionDirs.length; j++) {
+                    File versionDir = versionDirs[j];
+                    if (versionDir.canRead() && versionDir.isDirectory()) {
+                        artifacts.addAll(getArtifacts(null, versionDir, artifactMatch, typeMatch, versionMatch));
+                    }
+                }
+            }
+        }
+        return artifacts;
+    }
+
     private List getArtifacts(String groupId, File versionDir, String artifactMatch, String typeMatch, String versionMatch) {
         // org/apache/xbean/xbean-classpath/2.2-SNAPSHOT/xbean-classpath-2.2-SNAPSHOT.jar
         List artifacts = new ArrayList();
@@ -199,15 +202,10 @@
 
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Maven2Repository.class, "Repository");
-
         infoFactory.addAttribute("root", URI.class, true);
-
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
-
         infoFactory.addInterface(Maven2Repository.class);
-
         infoFactory.setConstructor(new String[]{"root", "ServerInfo"});
-
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java?rev=395121&r1=395120&r2=395121&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java (original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java Tue Apr 18 20:50:05 2006
@@ -120,6 +120,22 @@
     }
 
     private static class MockConfigManager implements ConfigurationManager {
+        public boolean isInstalled(Artifact configurationId) {
+            return false;
+        }
+
+        public Artifact[] getInstalled(Artifact query) {
+            return new Artifact[0];
+        }
+
+        public Artifact[] getLoaded(Artifact query) {
+            return new Artifact[0];
+        }
+
+        public Artifact[] getRunning(Artifact query) {
+            return new Artifact[0];
+        }
+
         public boolean isLoaded(Artifact configID) {
             return false;
         }