You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2009/06/12 14:31:58 UTC

svn commit: r784096 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java

Author: gnodet
Date: Fri Jun 12 12:31:58 2009
New Revision: 784096

URL: http://svn.apache.org/viewvc?rev=784096&view=rev
Log:
Check lazy bundles when the extender is started

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java?rev=784096&r1=784095&r2=784096&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintExtender.java Fri Jun 12 12:31:58 2009
@@ -37,6 +37,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.Constants;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.blueprint.container.BlueprintEvent;
 import org.slf4j.Logger;
@@ -71,9 +72,15 @@
 
         Bundle[] bundles = context.getBundles();
         for (Bundle b : bundles) {
-            // TODO: need to check lazy bundles in STARTING state
+            // If the bundle is active, check it
             if (b.getState() == Bundle.ACTIVE) {
                 checkBundle(b);
+            // Also check bundles in the starting state with a lazy activation policy
+            } else if (b.getState() == Bundle.STARTING) {
+                String activationPolicyHeader = (String) b.getHeaders().get(Constants.BUNDLE_ACTIVATIONPOLICY);
+                if (activationPolicyHeader != null && activationPolicyHeader.startsWith(Constants.ACTIVATION_LAZY)) {
+                    checkBundle(b);
+                }
             }
         }
         LOGGER.debug("Blueprint extender started");
@@ -123,8 +130,7 @@
         LOGGER.debug("Scanning bundle {} for blueprint application", bundle.getSymbolicName());
         try {
             List<URL> urls = new ArrayList<URL>();
-            Dictionary headers = bundle.getHeaders();
-            String blueprintHeader = (String) headers.get(BlueprintConstants.BUNDLE_BLUEPRINT_HEADER);
+            String blueprintHeader = (String) bundle.getHeaders().get(BlueprintConstants.BUNDLE_BLUEPRINT_HEADER);
             if (blueprintHeader == null) {
                 blueprintHeader = "OSGI-INF/blueprint/";
             }