You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2006/12/13 20:45:11 UTC

svn commit: r486815 - in /geronimo/server: branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ branches/1.2/modules/geronimo-kernel/src/main/java/org/apa...

Author: vamsic007
Date: Wed Dec 13 11:45:10 2006
New Revision: 486815

URL: http://svn.apache.org/viewvc?view=rev&rev=486815
Log:
GERONIMO-2437 Empty dirs and config.xml entries left behind after undeploy
  o Remove config.xml entry only if it is empty

Modified:
    geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
    geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/branches/1.2/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
    geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/branches/2.0-M1/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
    geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java

Modified: geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java (original)
+++ geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java Wed Dec 13 11:45:10 2006
@@ -90,4 +90,12 @@
      *                       they are migrated.
      */
     void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
+
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    boolean hasGBeanAttributes(Artifact configName);
 }

Modified: geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Wed Dec 13 11:45:10 2006
@@ -568,6 +568,17 @@
         attributeChanged();
     }
 
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    public boolean hasGBeanAttributes(Artifact configName) {
+        ConfigurationOverride configInfo = serverOverride.getConfiguration(configName);
+        return configInfo != null && !configInfo.getGBeans().isEmpty();
+    }
+
     //GBeanLifeCycle
     public synchronized void doStart() throws Exception {
         load();

Modified: geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/server/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Wed Dec 13 11:45:10 2006
@@ -366,7 +366,7 @@
         try {
             // Is this the right way to get hold of PersistentConfigurationList?
             PersistentConfigurationList configList = (PersistentConfigurationList) kernel.getGBean(PersistentConfigurationList.class);
-            configList.removeConfiguration(configId);
+            if(!configList.hasGBeanAttributes(configId)) configList.removeConfiguration(configId);
         } catch (Exception e) {
             log.warn("Unable to remove configuration from persistent configurations. id = "+configId, e);
         }

Modified: geronimo/server/branches/1.2/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java (original)
+++ geronimo/server/branches/1.2/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java Wed Dec 13 11:45:10 2006
@@ -90,4 +90,12 @@
      *                       they are migrated.
      */
     void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
+
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    boolean hasGBeanAttributes(Artifact configName);
 }

Modified: geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Wed Dec 13 11:45:10 2006
@@ -599,6 +599,17 @@
         attributeChanged();
     }
 
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    public boolean hasGBeanAttributes(Artifact configName) {
+        ConfigurationOverride configInfo = serverOverride.getConfiguration(configName);
+        return configInfo != null && !configInfo.getGBeans().isEmpty();
+    }
+
     //GBeanLifeCycle
     public synchronized void doStart() throws Exception {
         load();

Modified: geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Wed Dec 13 11:45:10 2006
@@ -360,7 +360,7 @@
         try {
             // Is this the right way to get hold of PersistentConfigurationList?
             PersistentConfigurationList configList = (PersistentConfigurationList) kernel.getGBean(PersistentConfigurationList.class);
-            configList.removeConfiguration(configId);
+            if(!configList.hasGBeanAttributes(configId)) configList.removeConfiguration(configId);
         } catch (Exception e) {
             log.warn("Unable to remove configuration from persistent configurations. id = "+configId, e);
         }

Modified: geronimo/server/branches/2.0-M1/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0-M1/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/2.0-M1/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java (original)
+++ geronimo/server/branches/2.0-M1/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java Wed Dec 13 11:45:10 2006
@@ -90,4 +90,12 @@
      *                       they are migrated.
      */
     void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
+
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    boolean hasGBeanAttributes(Artifact configName);
 }

Modified: geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Wed Dec 13 11:45:10 2006
@@ -599,6 +599,17 @@
         attributeChanged();
     }
 
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    public boolean hasGBeanAttributes(Artifact configName) {
+        ConfigurationOverride configInfo = serverOverride.getConfiguration(configName);
+        return configInfo != null && !configInfo.getGBeans().isEmpty();
+    }
+
     //GBeanLifeCycle
     public synchronized void doStart() throws Exception {
         load();

Modified: geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/server/branches/2.0-M1/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Wed Dec 13 11:45:10 2006
@@ -341,7 +341,6 @@
         // For now assume the repo is a Maven2Repository.  This should not cause any harm even if it is an
         // Maven1Repository, for it would be deleting the 'repository' directory if it happens to be empty.
         boolean m2repo = true;
-
         if(m2repo) {
             // Check version, artifact and group directories, i.e. 3 levels up
             dirDepth = 3;
@@ -361,7 +360,7 @@
         try {
             // Is this the right way to get hold of PersistentConfigurationList?
             PersistentConfigurationList configList = (PersistentConfigurationList) kernel.getGBean(PersistentConfigurationList.class);
-            configList.removeConfiguration(configId);
+            if(!configList.hasGBeanAttributes(configId)) configList.removeConfiguration(configId);
         } catch (Exception e) {
             log.warn("Unable to remove configuration from persistent configurations. id = "+configId, e);
         }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java Wed Dec 13 11:45:10 2006
@@ -90,4 +90,12 @@
      *                       they are migrated.
      */
     void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
+
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    boolean hasGBeanAttributes(Artifact configName);
 }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Wed Dec 13 11:45:10 2006
@@ -599,6 +599,17 @@
         attributeChanged();
     }
 
+    /**
+     * This method checks if there are any custom gbean attributes in the configuration.
+     *
+     * @param configName Name of the configuration
+     * @return true if the configuration contains any custom gbean attributes
+     */
+    public boolean hasGBeanAttributes(Artifact configName) {
+        ConfigurationOverride configInfo = serverOverride.getConfiguration(configName);
+        return configInfo != null && !configInfo.getGBeans().isEmpty();
+    }
+
     //GBeanLifeCycle
     public synchronized void doStart() throws Exception {
         load();

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?view=diff&rev=486815&r1=486814&r2=486815
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Wed Dec 13 11:45:10 2006
@@ -341,7 +341,6 @@
         // For now assume the repo is a Maven2Repository.  This should not cause any harm even if it is an
         // Maven1Repository, for it would be deleting the 'repository' directory if it happens to be empty.
         boolean m2repo = true;
-
         if(m2repo) {
             // Check version, artifact and group directories, i.e. 3 levels up
             dirDepth = 3;
@@ -361,7 +360,7 @@
         try {
             // Is this the right way to get hold of PersistentConfigurationList?
             PersistentConfigurationList configList = (PersistentConfigurationList) kernel.getGBean(PersistentConfigurationList.class);
-            configList.removeConfiguration(configId);
+            if(!configList.hasGBeanAttributes(configId)) configList.removeConfiguration(configId);
         } catch (Exception e) {
             log.warn("Unable to remove configuration from persistent configurations. id = "+configId, e);
         }



Re: svn commit: r486815 - in /geronimo/server: branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ branches/1.2/modules/geronimo-kernel/src/main/java/org/apa...

Posted by Matt Hogstrom <ma...@hogstrom.org>.
Wow...Javadoc...I had to look twice...nice work Vamsi ;-0

And there is code in there too.

On Dec 13, 2006, at 2:45 PM, vamsic007@apache.org wrote:

> Author: vamsic007
> Date: Wed Dec 13 11:45:10 2006
> New Revision: 486815
>
> Modified: geronimo/server/branches/1.1/modules/kernel/src/java/org/ 
> apache/geronimo/kernel/config/PersistentConfigurationList.java
> URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.1/ 
> modules/kernel/src/java/org/apache/geronimo/kernel/config/ 
> PersistentConfigurationList.java? 
> view=diff&rev=486815&r1=486814&r2=486815
> ====================================================================== 
> ========
> --- geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/ 
> geronimo/kernel/config/PersistentConfigurationList.java (original)
> +++ geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/ 
> geronimo/kernel/config/PersistentConfigurationList.java Wed Dec 13  
> 11:45:10 2006
> @@ -90,4 +90,12 @@
>       *                       they are migrated.
>       */
>      void migrateConfiguration(Artifact oldName, Artifact newName,  
> Configuration configuration);
> +
> +    /**
> +     * This method checks if there are any custom gbean attributes  
> in the configuration.
> +     *
> +     * @param configName Name of the configuration
> +     * @return true if the configuration contains any custom gbean  
> attributes
> +     */
> +    boolean hasGBeanAttributes(Artifact configName);
>  }

Matt Hogstrom
matt@hogstrom.org