geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1440511 - /geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java
Date Wed, 30 Jan 2013 16:43:10 GMT
Author: gawor
Date: Wed Jan 30 16:43:10 2013
New Revision: 1440511

URL: http://svn.apache.org/viewvc?rev=1440511&view=rev
Log:
GERONIMO-6319: A fix for 'The resources have not been resolved' error when resolving fragment
bundles

Modified:
    geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java

Modified: geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java?rev=1440511&r1=1440510&r2=1440511&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java
(original)
+++ geronimo/server/branches/3.0/plugins/aries/geronimo-aries-resolver/src/main/java/org/apache/geronimo/aries/resolver/obr/OBRAriesResolver.java
Wed Jan 30 16:43:10 2013
@@ -149,27 +149,32 @@ public class OBRAriesResolver implements
         obrResolver.add(createApplicationResource(helper, appName, appVersion, appContent));
         
         boolean resolved = obrResolver.resolve();
-        Set<BundleInfo> fragments = new HashSet<BundleInfo>();
+        Set<Resource> requiredFragments = new HashSet<Resource>();
+        Set<Resource> optionalFragments = new HashSet<Resource>();
         
         if (resolved && resolveFragments) {
             for (Resource resource : obrResolver.getRequiredResources()) {
                 Resource fragmentResource = findFragmentResource(resource);
                 if (fragmentResource != null) {
-                    obrResolver.add(fragmentResource);
-                    fragments.add(toBundleInfo(fragmentResource, false));
+                    requiredFragments.add(fragmentResource);
                 }
             }
             if (returnOptionalResources) {
                 for (Resource resource : obrResolver.getOptionalResources()) {
                     Resource fragmentResource = findFragmentResource(resource);
                     if (fragmentResource != null) {
-                        obrResolver.add(fragmentResource);
-                        fragments.add(toBundleInfo(fragmentResource, true));
+                        optionalFragments.add(fragmentResource);
                     }
                 }
             }
             
-            if (!fragments.isEmpty()) {
+            if (!requiredFragments.isEmpty() || !optionalFragments.isEmpty()) {
+                for (Resource fragment : requiredFragments) {
+                    obrResolver.add(fragment);
+                }
+                for (Resource fragment : optionalFragments) {
+                    obrResolver.add(fragment);
+                }
                 resolved = obrResolver.resolve();
             }
         }
@@ -186,7 +191,14 @@ public class OBRAriesResolver implements
                     result.add(bundleInfo);
                 }
             }
-            result.addAll(fragments);
+            for (Resource fragment : requiredFragments) {
+                BundleInfo bundleInfo = toBundleInfo(fragment, false);
+                result.add(bundleInfo);
+            }
+            for (Resource fragment : optionalFragments) {
+                BundleInfo bundleInfo = toBundleInfo(fragment, true);
+                result.add(bundleInfo);
+            }            
             return result;
         } else {
             Reason[] reasons = obrResolver.getUnsatisfiedRequirements();



Mime
View raw message