geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1185215 - in /geronimo/server/trunk: framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/ framework/modules/geronimo-kernel/src/...
Date Mon, 17 Oct 2011 14:37:06 GMT
Author: xuhaihong
Date: Mon Oct 17 14:37:06 2011
New Revision: 1185215

URL: http://svn.apache.org/viewvc?rev=1185215&view=rev
Log:
GERONIMO-6194 Sort gbeans while stopping the configuration

Added:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/CircularReferencesException.java
      - copied, changed from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/CircularReferencesException.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IllegalNodeConfigException.java
      - copied, changed from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/IllegalConfigurationException.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/SortUtils.java
      - copied, changed from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtils.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/util/SortUtilsTest.java
      - copied, changed from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtilsTest.java
Removed:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/CircularReferencesException.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtils.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/IllegalConfigurationException.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtilsTest.java
Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=1185215&r1=1185214&r2=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
Mon Oct 17 14:37:06 2011
@@ -36,8 +36,6 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -56,7 +54,13 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Maven2Repository;
+import org.apache.geronimo.kernel.util.CircularReferencesException;
+import org.apache.geronimo.kernel.util.IllegalNodeConfigException;
+import org.apache.geronimo.kernel.util.SortUtils;
+import org.apache.geronimo.kernel.util.SortUtils.Visitor;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev:386276 $ $Date$
@@ -523,4 +527,82 @@ public final class ConfigurationUtil {
             throw new InvalidConfigException("Unknown start exception", e);
         }
     }
+
+    public static List<GBeanData> sortGBeanDataByDependency(final Collection<GBeanData>
gbeanDatas) throws IllegalNodeConfigException, CircularReferencesException {
+
+        return SortUtils.sort(gbeanDatas, new Visitor<GBeanData>() {
+
+            @Override
+            public String getName(GBeanData t) {
+                return t.getAbstractName().toString();
+            }
+
+            @Override
+            public List<String> getAfterNames(GBeanData t) {
+                List<String> afterNames = new ArrayList<String>();
+                for (GBeanData gbeanData : gbeanDatas) {
+                    if (gbeanData == t) {
+                        continue;
+                    }
+                    if (isDependent(gbeanData, t)) {
+                        afterNames.add(gbeanData.getAbstractName().toString());
+                    }
+                }
+                return afterNames;
+            }
+
+            @Override
+            public List<String> getBeforeNames(GBeanData t) {
+                return Collections.<String>emptyList();
+            }
+
+            @Override
+            public boolean afterOthers(GBeanData t) {
+                return false;
+            }
+
+            @Override
+            public boolean beforeOthers(GBeanData t) {
+                return false;
+            }
+
+            /**
+            *
+            * @param o1
+            * @param o2
+            * @return true if o1 is dependent on o2
+            */
+           private boolean isDependent(GBeanData o1, GBeanData o2) {
+               for (ReferencePatterns referencePatterns : o1.getDependencies()) {
+                   if (match(referencePatterns, o2)) {
+                       return true;
+                   }
+               }
+               for (Map.Entry<String, ReferencePatterns> entry : o1.getReferences().entrySet())
{
+                   if (o1.getGBeanInfo().getReference(entry.getKey()).getProxyType().equals(Collection.class.getName()))
{
+                       continue;
+                   }
+                   if (match(entry.getValue(), o2)) {
+                       return true;
+                   }
+               }
+               return false;
+           }
+
+           private boolean match(ReferencePatterns referencePatterns, GBeanData targetGBeanData)
{
+               AbstractName targetAbstractName = targetGBeanData.getAbstractName();
+               if (referencePatterns.isResolved()) {
+                   return referencePatterns.getAbstractName().equals(targetAbstractName);
+               } else if (referencePatterns.getPatterns() != null) {
+                   for (AbstractNameQuery abstractNameQuery : referencePatterns.getPatterns())
{
+                       if (abstractNameQuery.matches(targetAbstractName, targetGBeanData.getGBeanInfo().getInterfaces()))
{
+                           return true;
+                       }
+                   }
+               }
+               return false;
+           }
+        });
+
+    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=1185215&r1=1185214&r2=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
Mon Oct 17 14:37:06 2011
@@ -22,21 +22,20 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.OsgiService;
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
@@ -48,8 +47,8 @@ import org.apache.geronimo.kernel.reposi
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.osgi.framework.Bundle;
+import org.apache.geronimo.kernel.util.CircularReferencesException;
+import org.apache.geronimo.kernel.util.IllegalNodeConfigException;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -252,12 +251,19 @@ public class KernelConfigurationManager 
             Configuration childConfiguration = (Configuration) iterator.next();
             stopRecursive(childConfiguration);
         }
-
-        Collection gbeans = configuration.getGBeans().values();
-
+        Collection<GBeanData> gbeans;
+        try {
+            List<GBeanData> sortedGBeans = ConfigurationUtil.sortGBeanDataByDependency(configuration.getGBeans().values());
+            Collections.reverse(sortedGBeans);
+            gbeans = sortedGBeans;
+        } catch (IllegalNodeConfigException e) {
+            gbeans = configuration.getGBeans().values();
+        } catch (CircularReferencesException e) {
+            gbeans = configuration.getGBeans().values();
+        }
         // stop the gbeans
-        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-            GBeanData gbeanData = (GBeanData) iterator.next();
+        for (Iterator<GBeanData> iterator = gbeans.iterator(); iterator.hasNext();)
{
+            GBeanData gbeanData = iterator.next();
             AbstractName gbeanName = gbeanData.getAbstractName();
             try {
                 kernel.stopGBean(gbeanName);
@@ -269,8 +275,8 @@ public class KernelConfigurationManager 
         }
 
         // unload the gbeans
-        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-            GBeanData gbeanData = (GBeanData) iterator.next();
+        for (Iterator<GBeanData> iterator = gbeans.iterator(); iterator.hasNext();)
{
+            GBeanData gbeanData = iterator.next();
             AbstractName gbeanName = gbeanData.getAbstractName();
             try {
                 kernel.unloadGBean(gbeanName);

Copied: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/CircularReferencesException.java
(from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/CircularReferencesException.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/CircularReferencesException.java?p2=geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/CircularReferencesException.java&p1=geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/CircularReferencesException.java&r1=1183210&r2=1185215&rev=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/CircularReferencesException.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/CircularReferencesException.java
Mon Oct 17 14:37:06 2011
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.j2ee.deployment.util;
+package org.apache.geronimo.kernel.util;
 
 import java.util.List;
 

Copied: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IllegalNodeConfigException.java
(from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/IllegalConfigurationException.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IllegalNodeConfigException.java?p2=geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IllegalNodeConfigException.java&p1=geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/IllegalConfigurationException.java&r1=1183210&r2=1185215&rev=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/IllegalConfigurationException.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/IllegalNodeConfigException.java
Mon Oct 17 14:37:06 2011
@@ -15,23 +15,23 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.j2ee.deployment.util;
+package org.apache.geronimo.kernel.util;
 
 /**
  * @version $Rev$ $Date$
  */
-public class IllegalConfigurationException extends Exception {
+public class IllegalNodeConfigException extends Exception {
 
     private static final long serialVersionUID = -6131258240075237969L;
 
     private String nodeName;
 
-    public IllegalConfigurationException(String nodeName, String message) {
+    public IllegalNodeConfigException(String nodeName, String message) {
         super(message);
         this.nodeName = nodeName;
     }
 
-    public IllegalConfigurationException(String message) {
+    public IllegalNodeConfigException(String message) {
         super(message);
     }
 

Copied: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/SortUtils.java
(from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtils.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/SortUtils.java?p2=geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/SortUtils.java&p1=geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtils.java&r1=1183210&r2=1185215&rev=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtils.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/SortUtils.java
Mon Oct 17 14:37:06 2011
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.j2ee.deployment.util;
+package org.apache.geronimo.kernel.util;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -28,12 +28,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geronimo.kernel.util.JoinUtils;
-
 /**
  * @version $Rev$ $Date$
  */
-public class FragmentSortUtils {
+public class SortUtils {
 
     public static interface Visitor<T> {
 
@@ -48,7 +46,7 @@ public class FragmentSortUtils {
         boolean beforeOthers(T t);
     }
 
-    public static <T> List<T> sort(Collection<T> objects, Visitor<T>
visitor) throws IllegalConfigurationException, CircularReferencesException {
+    public static <T> List<T> sort(Collection<T> objects, Visitor<T>
visitor) throws IllegalNodeConfigException, CircularReferencesException {
 
         if (objects.size() == 0) {
             return Collections.emptyList();
@@ -61,7 +59,7 @@ public class FragmentSortUtils {
             String name = visitor.getName(obj);
             Node<T> node = new Node<T>(name, obj, visitor.afterOthers(obj), visitor.beforeOthers(obj),
visitor.getAfterNames(obj), visitor.getBeforeNames(obj));
             if (node.beforeOthers && node.afterOthers) {
-                throw new IllegalConfigurationException(name, "Before others and after others
could not be configured at the sametime ");
+                throw new IllegalNodeConfigException(name, "Before others and after others
could not be configured at the sametime ");
             }
             nodes.put(name, node);
         }
@@ -70,7 +68,7 @@ public class FragmentSortUtils {
         for (Node<T> node : nodes.values()) {
             //Convert all the before and after configurations to dependOns
             if (node.after.contains(node.name)) {
-                throw new IllegalConfigurationException(node.name, "The fragment could not
be configured to after itself");
+                throw new IllegalNodeConfigException(node.name, "The fragment could not be
configured to after itself");
             }
             for (String afterNodeName : node.after) {
                 Node<T> afterNode = nodes.get(afterNodeName);
@@ -79,7 +77,7 @@ public class FragmentSortUtils {
                 }
             }
             if (node.before.contains(node.name)) {
-                throw new IllegalConfigurationException(node.name, "The fragment could not
be configured to before itself");
+                throw new IllegalNodeConfigException(node.name, "The fragment could not be
configured to before itself");
             }
             for (String beforeNodeName : node.before) {
                 Node<T> beforeNode = nodes.get(beforeNodeName);

Copied: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/util/SortUtilsTest.java
(from r1183210, geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtilsTest.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/util/SortUtilsTest.java?p2=geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/util/SortUtilsTest.java&p1=geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtilsTest.java&r1=1183210&r2=1185215&rev=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/util/FragmentSortUtilsTest.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/util/SortUtilsTest.java
Mon Oct 17 14:37:06 2011
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.j2ee.deployment.util;
+package org.apache.geronimo.kernel.util;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -24,13 +24,16 @@ import java.util.List;
 
 import junit.framework.Assert;
 
-import org.apache.geronimo.j2ee.deployment.util.FragmentSortUtils.Visitor;
+import org.apache.geronimo.kernel.util.CircularReferencesException;
+import org.apache.geronimo.kernel.util.IllegalNodeConfigException;
+import org.apache.geronimo.kernel.util.SortUtils;
+import org.apache.geronimo.kernel.util.SortUtils.Visitor;
 import org.junit.Test;
 
 /**
  * @version $Rev$ $Date$
  */
-public class FragmentSortUtilsTest {
+public class SortUtilsTest {
 
     @Test
     public void testFragmentSortA() throws Exception {
@@ -38,7 +41,7 @@ public class FragmentSortUtilsTest {
         for (int i = 0; i < 6; i++) {
             fragmentList.add(String.valueOf((char) ('A' + i)));
         }
-        List<String> sortedList = FragmentSortUtils.sort(fragmentList, new Visitor<String>()
{
+        List<String> sortedList = SortUtils.sort(fragmentList, new Visitor<String>()
{
 
             @Override
             public boolean afterOthers(String t) {
@@ -87,7 +90,7 @@ public class FragmentSortUtilsTest {
         for (int i = 0; i < 6; i++) {
             fragmentList.add(String.valueOf((char) ('A' + i)));
         }
-        List<String> sortedList = FragmentSortUtils.sort(fragmentList, new Visitor<String>()
{
+        List<String> sortedList = SortUtils.sort(fragmentList, new Visitor<String>()
{
 
             @Override
             public boolean afterOthers(String t) {
@@ -133,7 +136,7 @@ public class FragmentSortUtilsTest {
         for (int i = 0; i < 4; i++) {
             fragmentList.add(String.valueOf((char) ('A' + i)));
         }
-        List<String> sortedList = FragmentSortUtils.sort(fragmentList, new Visitor<String>()
{
+        List<String> sortedList = SortUtils.sort(fragmentList, new Visitor<String>()
{
 
             @Override
             public boolean afterOthers(String t) {
@@ -172,7 +175,7 @@ public class FragmentSortUtilsTest {
         }
         Exception actualException = null;
         try {
-            FragmentSortUtils.sort(fragmentList, new Visitor<String>() {
+            SortUtils.sort(fragmentList, new Visitor<String>() {
 
                 @Override
                 public boolean afterOthers(String t) {
@@ -200,12 +203,12 @@ public class FragmentSortUtilsTest {
                 }
 
             });
-        } catch (IllegalConfigurationException e) {
+        } catch (IllegalNodeConfigException e) {
             actualException = e;
         } catch (CircularReferencesException e) {
             Assert.fail("Should not get CircularReference Exception here");
         }
-        Assert.assertNotNull("Should get an IllegalConfigurationException", actualException);
+        Assert.assertNotNull("Should get an IllegalNodeConfigException", actualException);
     }
 
     @Test
@@ -214,9 +217,9 @@ public class FragmentSortUtilsTest {
         for (int i = 0; i < 2; i++) {
             fragmentList.add(String.valueOf((char) ('A' + i)));
         }
-        IllegalConfigurationException actualException = null;
+        IllegalNodeConfigException actualException = null;
         try {
-            FragmentSortUtils.sort(fragmentList, new Visitor<String>() {
+            SortUtils.sort(fragmentList, new Visitor<String>() {
 
                 @Override
                 public boolean afterOthers(String t) {
@@ -248,13 +251,13 @@ public class FragmentSortUtilsTest {
                 }
 
             });
-        } catch (IllegalConfigurationException e) {
+        } catch (IllegalNodeConfigException e) {
             actualException = e;
 
         } catch (CircularReferencesException e) {
             Assert.fail("Should not get CircularReferencesException here");
         }
-        Assert.assertNotNull("Should get an IllegalConfigurationException", actualException);
+        Assert.assertNotNull("Should get an IllegalNodeConfigException", actualException);
     }
 
     @Test
@@ -265,7 +268,7 @@ public class FragmentSortUtilsTest {
         }
         CircularReferencesException actualException = null;
         try {
-            FragmentSortUtils.sort(fragmentList, new Visitor<String>() {
+            SortUtils.sort(fragmentList, new Visitor<String>() {
 
                 @Override
                 public boolean afterOthers(String t) {
@@ -301,8 +304,8 @@ public class FragmentSortUtilsTest {
                 }
 
             });
-        } catch (IllegalConfigurationException e) {
-            Assert.fail("Should not get IllegalConfigurationException here");
+        } catch (IllegalNodeConfigException e) {
+            Assert.fail("Should not get IllegalNodeConfigException here");
         } catch (CircularReferencesException e) {
             actualException = e;
         }
@@ -317,7 +320,7 @@ public class FragmentSortUtilsTest {
         }
         Exception actualException = null;
         try {
-            FragmentSortUtils.sort(fragmentList, new Visitor<String>() {
+            SortUtils.sort(fragmentList, new Visitor<String>() {
 
                 @Override
                 public boolean afterOthers(String t) {
@@ -352,8 +355,8 @@ public class FragmentSortUtilsTest {
                 }
 
             });
-        } catch (IllegalConfigurationException e) {
-            Assert.fail("Should not get IllegalConfigurationException here");
+        } catch (IllegalNodeConfigException e) {
+            Assert.fail("Should not get IllegalNodeConfigException here");
         } catch (CircularReferencesException e) {
             actualException = e;
         }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java?rev=1185215&r1=1185214&r2=1185215&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
Mon Oct 17 14:37:06 2011
@@ -47,13 +47,13 @@ import javax.xml.parsers.ParserConfigura
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.util.CircularReferencesException;
-import org.apache.geronimo.j2ee.deployment.util.FragmentSortUtils;
-import org.apache.geronimo.j2ee.deployment.util.FragmentSortUtils.Visitor;
-import org.apache.geronimo.j2ee.deployment.util.IllegalConfigurationException;
+import org.apache.geronimo.kernel.util.CircularReferencesException;
 import org.apache.geronimo.kernel.util.IOUtils;
+import org.apache.geronimo.kernel.util.IllegalNodeConfigException;
 import org.apache.geronimo.kernel.util.JoinUtils;
 import org.apache.geronimo.kernel.util.JoinUtils.NameCallback;
+import org.apache.geronimo.kernel.util.SortUtils;
+import org.apache.geronimo.kernel.util.SortUtils.Visitor;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.web25.deployment.merge.annotation.AnnotationMergeHandler;
 import org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnotationMergeHandler;
@@ -422,7 +422,7 @@ public class MergeHelper {
     public static WebFragmentEntry[] relativeOrderWebFragments(EARContext earContext, Module
module, Bundle bundle, WebApp webApp, Map<String, WebFragmentEntry> webFragmentEntryMap)
             throws DeploymentException {
         try {
-            WebFragmentEntry[] webFragments = FragmentSortUtils.sort(webFragmentEntryMap.values(),
new Visitor<WebFragmentEntry>() {
+            WebFragmentEntry[] webFragments = SortUtils.sort(webFragmentEntryMap.values(),
new Visitor<WebFragmentEntry>() {
 
                 @Override
                 public boolean afterOthers(WebFragmentEntry entry) {
@@ -480,7 +480,7 @@ public class MergeHelper {
             }).toArray(new WebFragmentEntry[webFragmentEntryMap.values().size()]);
             saveOrderedLibAttribute(earContext, module, webFragments);
             return webFragments;
-        } catch (IllegalConfigurationException e) {
+        } catch (IllegalNodeConfigException e) {
             throw new DeploymentException("Jar file " + webFragmentEntryMap.get(e.getNodeName()).getJarURL()
+ " is not configured correctly for " + e.getMessage(), e);
         } catch (CircularReferencesException e) {
             StringBuilder circularReferenceInfo = new StringBuilder();



Mime
View raw message