geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r399794 - in /geronimo/branches/1.1: etc/ modules/kernel/src/java/org/apache/geronimo/gbean/runtime/ modules/kernel/src/java/org/apache/geronimo/kernel/config/ modules/system/src/java/org/apache/geronimo/system/configuration/ modules/system...
Date Thu, 04 May 2006 18:04:23 GMT
Author: ammulder
Date: Thu May  4 11:04:16 2006
New Revision: 399794

URL: http://svn.apache.org/viewcvs?rev=399794&view=rev
Log:
Fix undeployment to not blow up (GERONIMO-1940)
Don't print an error message if you stop a configuration twice (once
  during stop and once during unload) (GERONIMO-1891)
Initial support for migrating settings to a newer configuration name
  (GERONIMO-1951)

Removed:
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java
Modified:
    geronimo/branches/1.1/etc/project.properties
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationOverride.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
    geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml
    geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java

Modified: geronimo/branches/1.1/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/etc/project.properties?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/etc/project.properties (original)
+++ geronimo/branches/1.1/etc/project.properties Thu May  4 11:04:16 2006
@@ -95,7 +95,7 @@
 tranql_vendors_version=1.1
 release_notes_version=1.0
 
-geronimo_packaging_plugin_version=1.1.0-7
+geronimo_packaging_plugin_version=1.1.0-8
 geronimo_assembly_plugin_version=1.1.0-11
 geronimo_deployment_plugin_version=1.1.0-2
 geronimo_dependency_plugin_version=1.1.0-3

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Thu May  4 11:04:16 2006
@@ -51,6 +51,7 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.NoSuchAttributeException;
 import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.management.StateManageable;
@@ -759,7 +760,7 @@
                 return;
             }
         }
-        String configName = abstractName.getArtifact().toString();
+        Artifact configName = abstractName.getArtifact();
         if (configName != null) {
             manageableStore.setValue(configName, abstractName, attribute.getAttributeInfo(),
value);
         } else {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
Thu May  4 11:04:16 2006
@@ -187,11 +187,11 @@
         }
     }
 
+    /**
+     * Stop this configuration and its children (if it's running) or do nothing
+     * (if it's not running).
+     */
     public LinkedHashSet stop(boolean gc) {
-        if (!started) {
-            throw new IllegalStateException(configurationId + " is not started");
-        }
-
         LinkedHashSet stopStatuses = new LinkedHashSet();
         stopInternal(stopStatuses, gc);
 
@@ -274,10 +274,11 @@
         restartList.add(this);
     }
 
+    /**
+     * Unload the configuration and all its children (if it's loaded), or do
+     * nothing (if it's not loaded).
+     */
     public LinkedHashSet unload(boolean gc) {
-        if (!loaded) {
-            throw new IllegalStateException(configurationId + " is not loaded");
-        }
 
         LinkedHashSet unloadStatuses = new LinkedHashSet();
         unloadInternal(unloadStatuses, gc);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
Thu May  4 11:04:16 2006
@@ -124,7 +124,7 @@
         }
 
         if (attributeStore != null) {
-            attributeStore.addGBean(configuration.getId().toString(), gbean);
+            attributeStore.addGBean(configuration.getId(), gbean);
         }
     }
 
@@ -148,7 +148,7 @@
 
         // Make sure it's not loaded next time the configuration is loaded
         if (attributeStore != null) {
-            attributeStore.setShouldLoad(configurationId.toString(), gbeanName, false);
+            attributeStore.setShouldLoad(configurationId, gbeanName, false);
         }
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
Thu May  4 11:04:16 2006
@@ -110,6 +110,13 @@
         return super.loadConfiguration(configurationId);
     }
 
+    protected void load(Artifact configurationId) throws NoSuchConfigException {
+        super.load(configurationId);
+        if (configurationList != null) {
+            configurationList.addConfiguration(configurationId);
+        }
+    }
+
     protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds,
Map loadedConfigurations) throws InvalidConfigException {
         Artifact configurationId = configurationData.getId();
         AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
@@ -167,14 +174,14 @@
         ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration,
kernel);
 
         if (configurationList != null && configuration.getConfigurationData().isAutoStart())
{
-            configurationList.addConfiguration(configuration.getId().toString());
+            configurationList.startConfiguration(configuration.getId());
         }
     }
 
     protected void stop(Configuration configuration) {
         stopRecursive(configuration);
         if (configurationList != null) {
-            configurationList.removeConfiguration(configuration.getId().toString());
+            configurationList.stopConfiguration(configuration.getId());
         }
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
Thu May  4 11:04:16 2006
@@ -68,7 +68,7 @@
      * @param attribute The attribute in question
      * @param value The value to save, or null if no value should be saved
      */
-    public void setValue(String configurationName, AbstractName gbean, GAttributeInfo attribute,
Object value);
+    public void setValue(Artifact configurationName, AbstractName gbean, GAttributeInfo attribute,
Object value);
 
     /**
      * Sets the pattern for a GBean reference. The reference is
@@ -82,19 +82,7 @@
      * @param reference the attribute information
      * @param patterns
      */
-    public void setReferencePatterns(String configurationName, AbstractName gbean, GReferenceInfo
reference, ReferencePatterns patterns);
-
-    /**
-     * Sets the patterns for a GBean reference. The reference is
-     * identified by the configuration name, GBean ObjectName, and reference
-     * information.
-     *
-     * @param configurationName the name of the configuration holding the GBean in question
-     * @param gbean the ObjectName of the GBean
-     * @param reference the attribute information
-     * @param patterns new object name patterns for this reference; must not be null
-     */
-//    public void setReferencePatterns(String configurationName, AbstractName gbean, GReferenceInfo
reference, Set patterns);
+    public void setReferencePatterns(Artifact configurationName, AbstractName gbean, GReferenceInfo
reference, ReferencePatterns patterns);
 
     /**
      * Sets whether a particular GBean should be loaded for this configuration.
@@ -106,7 +94,7 @@
      * @param gbean             The GBean in question
      * @param load              True if the GBean should load with the configuration
      */
-    public void setShouldLoad(String configurationName, AbstractName gbean, boolean load);
+    public void setShouldLoad(Artifact configurationName, AbstractName gbean, boolean load);
 
 
     /**
@@ -114,7 +102,7 @@
      * @param configurationName the configuration that the GBean belongs to
      * @param gbeanData the GBean to add
      */
-    public void addGBean(String configurationName, GBeanData gbeanData);
+    public void addGBean(Artifact configurationName, GBeanData gbeanData);
 
     /**
      * Saves the current values to persistent storage.  This should be called

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
Thu May  4 11:04:16 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.kernel.config;
 
+import org.apache.geronimo.kernel.repository.Artifact;
+
 import java.io.IOException;
 import java.util.List;
 
@@ -37,7 +39,55 @@
 
     List restore() throws IOException;
 
-    void addConfiguration(String configName);
-
-    void removeConfiguration(String configName);
+    /**
+     * Adds a configuration to the list, but does not mark it as started.
+     */
+    void addConfiguration(Artifact configName);
+
+    /**
+     * Indicates that the configuration should be started when the server is
+     * started.  The configuration should have been previously added with
+     * addConfiguration.
+     */
+    void startConfiguration(Artifact configName);
+
+    /**
+     * Indicates that the configuration should not be started when the
+     * server is started.  The configuration should have been previously added
+     * with addConfiguration (and presumably started with startConfiguration).
+     */
+    void stopConfiguration(Artifact configName);
+
+    /**
+     * Removes all record of the specified configuration from the configuration
+     * list.  This is somewhat unusual -- normally you want to remember the
+     * settings in case the configuration is deployed again later.
+     */
+    void removeConfiguration(Artifact configName);
+
+    /**
+     * Gets all configurations in the list matching the specified query,
+     * whether they are marked at starting or not.
+     * 
+     * @param query The artifact to search for, normally not fully resolved
+     *              so there may be multiple matches or matches that are not
+     *              exactly equal to the argument.
+     *
+     * @return The matching artifacts that have data in the config list.
+     */
+    Artifact[] getListedConfigurations(Artifact query);
+
+    /**
+     * Migrates settings from an old version of a configuration to a newer
+     * version of the configuration.  Used when an updated version is deployed
+     * with a newer version number in the name, but the settings used for the
+     * previous version should be carried forward.
+     *
+     * @param oldName        The name that the existing settings are under
+     * @param newName        The name to move the settings to
+     * @param configuration  The configuration itself, which can be used to
+     *                       verify that all the settings are still valid as
+     *                       they are migrated.
+     */
+    void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
 }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationOverride.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationOverride.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationOverride.java
Thu May  4 11:04:16 2006
@@ -18,6 +18,7 @@
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.InvalidGBeanException;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
@@ -30,17 +31,23 @@
  * @version $Rev$ $Date$
  */
 class ConfigurationOverride {
-    private final String name;
+    private final Artifact name;
     private boolean load;
     private final Map gbeans = new LinkedHashMap();
 
-    public ConfigurationOverride(String name, boolean load) {
+    public ConfigurationOverride(Artifact name, boolean load) {
         this.name = name;
         this.load = load;
     }
 
+    public ConfigurationOverride(ConfigurationOverride base, Artifact name) {
+        this.name = name;
+        this.load = base.load;
+        this.gbeans.putAll(base.gbeans);
+    }
+
     public ConfigurationOverride(Element element) throws InvalidGBeanException {
-        name = element.getAttribute("name");
+        name = Artifact.create(element.getAttribute("name"));
 
         String loadConfigString = element.getAttribute("load");
         load = !"false".equals(loadConfigString);
@@ -53,7 +60,7 @@
         }
     }
 
-    public String getName() {
+    public Artifact getName() {
         return name;
     }
 

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Thu May  4 11:04:16 2006
@@ -30,6 +30,7 @@
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
@@ -94,11 +95,10 @@
         return readOnly;
     }
 
-    public synchronized Collection applyOverrides(Artifact configurationName, Collection
gbeanDatas, ClassLoader classLoader) throws InvalidConfigException {
+    public synchronized Collection applyOverrides(Artifact configName, Collection gbeanDatas,
ClassLoader classLoader) throws InvalidConfigException {
         // clone the datas since we will be modifying this collection
         gbeanDatas = new ArrayList(gbeanDatas);
 
-        String configName = configurationName.toString();
         ConfigurationOverride configuration = serverOverride.getConfiguration(configName);
         if (configuration == null) {
             return gbeanDatas;
@@ -151,7 +151,7 @@
      * @throws org.apache.geronimo.kernel.config.InvalidConfigException
      *
      */
-    private synchronized boolean setAttributes(GBeanData data, ConfigurationOverride configuration,
String configName, ClassLoader classLoader) throws InvalidConfigException {
+    private synchronized boolean setAttributes(GBeanData data, ConfigurationOverride configuration,
Artifact configName, ClassLoader classLoader) throws InvalidConfigException {
         AbstractName gbeanName = data.getAbstractName();
         GBeanOverride gbean = configuration.getGBean(gbeanName);
         if (gbean == null) {
@@ -225,7 +225,7 @@
     }
 
 
-    private synchronized Object getValue(GAttributeInfo attribute, String value, String configurationName,
AbstractName gbeanName, ClassLoader classLoader) {
+    private synchronized Object getValue(GAttributeInfo attribute, String value, Artifact
configurationName, AbstractName gbeanName, ClassLoader classLoader) {
         if (value == null) {
             return null;
         }
@@ -245,7 +245,7 @@
         }
     }
 
-    public synchronized void setValue(String configurationName, AbstractName gbeanName, GAttributeInfo
attribute, Object value) {
+    public synchronized void setValue(Artifact configurationName, AbstractName gbeanName,
GAttributeInfo attribute, Object value) {
         if (readOnly) {
             return;
         }
@@ -268,7 +268,7 @@
         }
     }
 
-    public synchronized void setReferencePatterns(String configurationName, AbstractName
gbeanName, GReferenceInfo reference, ReferencePatterns patterns) {
+    public synchronized void setReferencePatterns(Artifact configurationName, AbstractName
gbeanName, GReferenceInfo reference, ReferencePatterns patterns) {
         if (readOnly) {
             return;
         }
@@ -286,7 +286,7 @@
         attributeChanged();
     }
 
-    public synchronized void setShouldLoad(String configurationName, AbstractName gbeanName,
boolean load) {
+    public synchronized void setShouldLoad(Artifact configurationName, AbstractName gbeanName,
boolean load) {
         if (readOnly) {
             return;
         }
@@ -307,7 +307,7 @@
         attributeChanged();
     }
 
-    public void addGBean(String configurationName, GBeanData gbeanData) {
+    public void addGBean(Artifact configurationName, GBeanData gbeanData) {
         if (readOnly) {
             return;
         }
@@ -398,32 +398,67 @@
             Map.Entry entry = (Map.Entry) iterator.next();
             ConfigurationOverride configuration = (ConfigurationOverride) entry.getValue();
             if (configuration.isLoad()) {
-                String configName = (String) entry.getKey();
-                Artifact configID = Artifact.create(configName);
+                Artifact configID = (Artifact) entry.getKey();
                 configs.add(configID);
             }
         }
         return configs;
     }
 
-    public synchronized void addConfiguration(String configurationName) {
-        ConfigurationOverride configuration = serverOverride.getConfiguration(configurationName,
true);
+    public void startConfiguration(Artifact configurationName) {
+        ConfigurationOverride configuration = serverOverride.getConfiguration(configurationName,
false);
+        if(configuration == null) {
+            throw new IllegalArgumentException("No such configuration "+configurationName);
+        }
         configuration.setLoad(true);
         attributeChanged();
     }
 
-    public synchronized void removeConfiguration(String configName) {
+    public synchronized void addConfiguration(Artifact configurationName) {
+        // Check whether we have it already
+        ConfigurationOverride configuration = serverOverride.getConfiguration(configurationName,
false);
+        // If not, initialize it
+        if(configuration == null) {
+            configuration = serverOverride.getConfiguration(configurationName, true);
+            configuration.setLoad(false);
+            attributeChanged();
+        }
+    }
+
+    public synchronized void removeConfiguration(Artifact configName) {
         ConfigurationOverride configuration = serverOverride.getConfiguration(configName);
         if (configuration == null) {
-            log.error("Trying to stop unknown configuration: " + configName);
+            throw new IllegalArgumentException("Trying to remove unknown configuration: "
+ configName);
         } else {
-            if (configuration.getGBeans().isEmpty()) {
-                serverOverride.removeConfiguration(configName);
-            } else {
-                configuration.setLoad(false);
-            }
+            serverOverride.removeConfiguration(configName);
             attributeChanged();
         }
+    }
+
+    public Artifact[] getListedConfigurations(Artifact query) {
+        return serverOverride.queryConfigurations(query);
+    }
+
+    public void stopConfiguration(Artifact configName) {
+        ConfigurationOverride configuration = serverOverride.getConfiguration(configName);
+        if (configuration == null) {
+            throw new IllegalArgumentException("Trying to stop unknown configuration: " +
configName);
+        } else {
+            configuration.setLoad(false);
+            attributeChanged();
+        }
+    }
+
+    public void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration)
{
+        ConfigurationOverride configInfo = serverOverride.getConfiguration(oldName);
+        if(configInfo == null) {
+            throw new IllegalArgumentException("Trying to migrate unknown configuration:
" + oldName);
+        }
+        serverOverride.removeConfiguration(oldName);
+        configInfo = new ConfigurationOverride(configInfo, newName);
+        //todo: check whether all the attributes are still valid for the new configuration
+        serverOverride.addConfiguration(configInfo);
+        attributeChanged();
     }
 
     //GBeanLifeCycle

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
Thu May  4 11:04:16 2006
@@ -17,16 +17,15 @@
 package org.apache.geronimo.system.configuration;
 
 import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
 
 import org.apache.geronimo.kernel.InvalidGBeanException;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /**
- * @version $Rev: 384351 $ $Date$
+ * @version $Rev$ $Date$
  */
 class ServerOverride {
     private final Map configurations = new LinkedHashMap();
@@ -43,11 +42,11 @@
         }
     }
 
-    public ConfigurationOverride getConfiguration(String configurationName) {
+    public ConfigurationOverride getConfiguration(Artifact configurationName) {
         return getConfiguration(configurationName, false);
     }
 
-    public ConfigurationOverride getConfiguration(String configurationName, boolean create)
{
+    public ConfigurationOverride getConfiguration(Artifact configurationName, boolean create)
{
         ConfigurationOverride configuration = (ConfigurationOverride) configurations.get(configurationName);
         if (create && configuration == null) {
             configuration = new ConfigurationOverride(configurationName, true);
@@ -60,12 +59,23 @@
         configurations.put(configuration.getName(), configuration);
     }
 
-    public void removeConfiguration(String configurationName) {
+    public void removeConfiguration(Artifact configurationName) {
         configurations.remove(configurationName);
     }
 
     public Map getConfigurations() {
         return configurations;
+    }
+
+    public Artifact[] queryConfigurations(Artifact query) {
+        List list = new ArrayList();
+        for (Iterator it = configurations.keySet().iterator(); it.hasNext();) {
+            Artifact test = (Artifact) it.next();
+            if(query.matches(test)) {
+                list.add(test);
+            }
+        }
+        return (Artifact[]) list.toArray(new Artifact[list.size()]);
     }
 
     public void writeXml(PrintWriter out) {

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
Thu May  4 11:04:16 2006
@@ -40,7 +40,7 @@
 import java.util.Set;
 
 /**
- * @version $Rev: 386907 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class LocalAttributeManagerTest extends TestCase {
     private static final String basedir = System.getProperties().getProperty("basedir", ".");
@@ -64,8 +64,8 @@
 
         // declare an attribute value so this configuration will exist in the store
         String attributeValue = "attribute value";
-        localAttributeManager.addConfiguration(configurationName.toString());
-        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo,
attributeValue);
+        localAttributeManager.addConfiguration(configurationName);
+        localAttributeManager.setValue(configurationName, gbeanName, attributeInfo, attributeValue);
 
         // should still load
         newDatas = new HashSet(localAttributeManager.applyOverrides(configurationName, originalDatas,
getClass().getClassLoader()));
@@ -73,7 +73,7 @@
         assertEquals(originalDatas, newDatas);
 
         // remove the configuration from the store
-        localAttributeManager.removeConfiguration(configurationName.toString());
+        localAttributeManager.removeConfiguration(configurationName);
 
         // should still get the same gbeans, config list and gbean attribute override functions
are separate interfaces.
         newDatas = new HashSet(localAttributeManager.applyOverrides(configurationName, originalDatas,
getClass().getClassLoader()));
@@ -99,8 +99,8 @@
 
         // declare an attribute value so this configuration will exist in the store
         String attributeValue = "attribute value";
-        localAttributeManager.addConfiguration(configurationName.toString());
-        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo,
attributeValue);
+        localAttributeManager.addConfiguration(configurationName);
+        localAttributeManager.setValue(configurationName, gbeanName, attributeInfo, attributeValue);
 
         // should still load
         newDatas = new HashSet(localAttributeManager.applyOverrides(configurationName, originalDatas,
getClass().getClassLoader()));
@@ -108,7 +108,7 @@
         assertEquals(originalDatas, newDatas);
 
         // set the gbean to not load
-        localAttributeManager.setShouldLoad(configurationName.toString(), gbeanName, false);
+        localAttributeManager.setShouldLoad(configurationName, gbeanName, false);
 
         // should not load
         newDatas = new HashSet(localAttributeManager.applyOverrides(configurationName, originalDatas,
getClass().getClassLoader()));
@@ -120,7 +120,7 @@
 
     public void testSetAtrribute() throws Exception {
         String attributeValue = "attribute value";
-        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo,
attributeValue);
+        localAttributeManager.setValue(configurationName, gbeanName, attributeInfo, attributeValue);
         Collection gbeanDatas = new ArrayList();
         GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
         gbeanDatas.add(gbeanData);
@@ -132,7 +132,7 @@
         ObjectName referencePatternObjectName = new ObjectName(":name=referencePattern");
         AbstractName referencePattern = new AbstractName(configurationName, referencePatternObjectName.getKeyPropertyList(),
referencePatternObjectName);
         ReferencePatterns referencePatterns = new ReferencePatterns(referencePattern);
-        localAttributeManager.setReferencePatterns(configurationName.toString(), gbeanName,
referenceInfo, referencePatterns);
+        localAttributeManager.setReferencePatterns(configurationName, gbeanName, referenceInfo,
referencePatterns);
         Collection gbeanDatas = new ArrayList();
         GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
         gbeanDatas.add(gbeanData);
@@ -146,7 +146,7 @@
         AbstractName referencePattern1 = naming.createRootName(gbeanName.getArtifact(), "name",
"referencePattern1");
         AbstractName referencePattern2 = naming.createRootName(gbeanName.getArtifact(), "name",
"referencePattern2");
         ReferencePatterns referencePatterns = new ReferencePatterns(new LinkedHashSet(Arrays.asList(new
AbstractName[] {referencePattern1, referencePattern2})));
-        localAttributeManager.setReferencePatterns(configurationName.toString(), gbeanName,
referenceInfo, referencePatterns);
+        localAttributeManager.setReferencePatterns(configurationName, gbeanName, referenceInfo,
referencePatterns);
         Collection gbeanDatas = new ArrayList();
         GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
         gbeanDatas.add(gbeanData);
@@ -161,8 +161,8 @@
         GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
         gbeanData.setAttribute(attributeInfo.getName(), attributeValue);
         gbeanData.setReferencePattern(referenceInfo.getName(), referencePattern);
-        localAttributeManager.addConfiguration(configurationName.toString());
-        localAttributeManager.addGBean(configurationName.toString(), gbeanData);
+        localAttributeManager.addConfiguration(configurationName);
+        localAttributeManager.addGBean(configurationName, gbeanData);
 
 
         Collection gbeanDatas = new ArrayList();

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
Thu May  4 11:04:16 2006
@@ -19,6 +19,7 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.kernel.repository.Artifact;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -61,7 +62,7 @@
         pizza.setReferencePatterns("oven", ovenPatterns);
         assertEquals(ovenPatterns, pizza.getReferencePatterns("oven"));
 
-        ConfigurationOverride dinnerMenu = new ConfigurationOverride("Dinner Menu", true);
+        ConfigurationOverride dinnerMenu = new ConfigurationOverride(new Artifact("test","Dinner
Menu","1.0","car"), true);
         assertTrue(dinnerMenu.isLoad());
 
         dinnerMenu.setLoad(false);
@@ -72,7 +73,7 @@
 
         ServerOverride restaurant = new ServerOverride();
         restaurant.addConfiguration(dinnerMenu);
-        assertSame(dinnerMenu, restaurant.getConfiguration("Dinner Menu"));
+        assertSame(dinnerMenu, restaurant.getConfiguration(new Artifact("test","Dinner Menu","1.0","car")));
     }
 
     private ReferencePatterns getReferencePatterns(AbstractNameQuery[] queries) {
@@ -111,7 +112,7 @@
     }
 
     public void testConfigurationXml() throws Exception {
-        ConfigurationOverride dinnerMenu = new ConfigurationOverride("Dinner Menu", true);
+        ConfigurationOverride dinnerMenu = new ConfigurationOverride(new Artifact("test","Dinner
Menu","1.0","car"), true);
         assertCopyIdentical(dinnerMenu);
 
         dinnerMenu.setLoad(false);
@@ -147,7 +148,7 @@
         ServerOverride restaurant = new ServerOverride();
         assertCopyIdentical(restaurant);
 
-        ConfigurationOverride dinnerMenu = new ConfigurationOverride("Dinner Menu", false);
+        ConfigurationOverride dinnerMenu = new ConfigurationOverride(new Artifact("test","Dinner
Menu","1.0","car"), false);
         restaurant.addConfiguration(dinnerMenu);
         GBeanOverride pizza = new GBeanOverride("Pizza", false);
         pizza.setAttribute("cheese", "mozzarella");
@@ -168,7 +169,7 @@
         dinnerMenu.addGBean(garlicCheeseBread);
         assertCopyIdentical(restaurant);
 
-        ConfigurationOverride drinkMenu = new ConfigurationOverride("Drink Menu", false);
+        ConfigurationOverride drinkMenu = new ConfigurationOverride(new Artifact("test","Drink
Menu","1.0","car"), false);
         restaurant.addConfiguration(drinkMenu);
         GBeanOverride beer = new GBeanOverride("Beer", true);
         pizza.setReferencePatterns("glass", getReferencePatterns(new AbstractNameQuery[]
{

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml Thu May  4 11:04:16
2006
@@ -22,7 +22,7 @@
     <groupId>geronimo</groupId>
     <id>geronimo-packaging-plugin</id>
     <name>Geronimo :: Maven Packaging Plugin</name>
-    <currentVersion>1.1.0-7</currentVersion>
+    <currentVersion>1.1.0-8</currentVersion>
 
     <dependencies>
         <dependency>

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java?rev=399794&r1=399793&r2=399794&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
(original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
Thu May  4 11:04:16 2006
@@ -42,16 +42,16 @@
         return datas;
     }
 
-    public void setValue(String configurationName, AbstractName gbean, GAttributeInfo attribute,
Object value) {
+    public void setValue(Artifact configurationName, AbstractName gbean, GAttributeInfo attribute,
Object value) {
     }
 
-    public void setReferencePatterns(String configurationName, AbstractName gbean, GReferenceInfo
reference, ReferencePatterns patterns) {
+    public void setReferencePatterns(Artifact configurationName, AbstractName gbean, GReferenceInfo
reference, ReferencePatterns patterns) {
     }
 
-    public void setShouldLoad(String configurationName, AbstractName gbean, boolean load)
{
+    public void setShouldLoad(Artifact configurationName, AbstractName gbean, boolean load)
{
     }
 
-    public void addGBean(String configurationName, GBeanData gbeanData) {
+    public void addGBean(Artifact configurationName, GBeanData gbeanData) {
     }
 
     public void save() throws IOException {



Mime
View raw message