felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r905551 - in /felix/trunk/karaf/deployer: blueprint/ blueprint/src/main/resources/OSGI-INF/blueprint/ features/ features/src/main/java/org/apache/felix/karaf/deployer/features/ features/src/main/resources/OSGI-INF/blueprint/ spring/ spring/...
Date Tue, 02 Feb 2010 09:32:50 GMT
Author: gnodet
Date: Tue Feb  2 09:32:49 2010
New Revision: 905551

URL: http://svn.apache.org/viewvc?rev=905551&view=rev
Log:
FELIX-2027: Custom deployers leveraging url handlers must not be registered before the url
handler is actually registered in the osgi framework

Modified:
    felix/trunk/karaf/deployer/blueprint/pom.xml
    felix/trunk/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
    felix/trunk/karaf/deployer/features/pom.xml
    felix/trunk/karaf/deployer/features/src/main/java/org/apache/felix/karaf/deployer/features/FeatureDeploymentListener.java
    felix/trunk/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
    felix/trunk/karaf/deployer/spring/pom.xml
    felix/trunk/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml

Modified: felix/trunk/karaf/deployer/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/blueprint/pom.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/blueprint/pom.xml (original)
+++ felix/trunk/karaf/deployer/blueprint/pom.xml Tue Feb  2 09:32:49 2010
@@ -69,7 +69,9 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <!-- Set the blueprint.graceperiod flag to false to allow the
bundle to start
+                             See the blueprint config file -->
+                        <Bundle-SymbolicName>${pom.artifactId};blueprint.graceperiod:=false</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>!${pom.artifactId}*,*</Import-Package>
                         <Private-Package>org.apache.felix.karaf.deployer.blueprint</Private-Package>

Modified: felix/trunk/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
(original)
+++ felix/trunk/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
Tue Feb  2 09:32:49 2010
@@ -19,15 +19,22 @@
 -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
-    <service auto-export="interfaces" depends-on="blueprintUrlHandler">
-        <bean class="org.apache.felix.karaf.deployer.blueprint.BlueprintDeploymentListener"
/>
-    </service>
-
     <service id="blueprintUrlHandler" interface="org.osgi.service.url.URLStreamHandlerService">
-    	<service-properties>
+        <service-properties>
             <entry key="url.handler.protocol" value="blueprint"/>
         </service-properties>
         <bean class="org.apache.felix.karaf.deployer.blueprint.BlueprintURLHandler"/>
     </service>
 
+    <bean id="blueprintDeploymentListener" class="org.apache.felix.karaf.deployer.blueprint.BlueprintDeploymentListener"/>
+
+    <!-- Force a reference to the url handler above from the osgi registry to (try to)
make sure
+         the url handler is registered inside the framework.  Else we can run into timing
issues
+         where fileinstall will use the featureDeploymentListener before the url can be actually
+         used.  In order to not block the bundle, the blueprint.graceperiod=false flag must
be
+         set on the SymbolicName osgi header -->
+    <reference id="blueprintUrlHandlerRef" interface="org.osgi.service.url.URLStreamHandlerService"
filter="url.handler.protocol=blueprint" />
+
+    <service ref="blueprintDeploymentListener" auto-export="interfaces" depends-on="blueprintDeploymentListener"
/>
+
 </blueprint>

Modified: felix/trunk/karaf/deployer/features/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/features/pom.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/features/pom.xml (original)
+++ felix/trunk/karaf/deployer/features/pom.xml Tue Feb  2 09:32:49 2010
@@ -73,7 +73,9 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <!-- Set the blueprint.graceperiod flag to false to allow the
bundle to start
+                             See the blueprint config file -->
+                        <Bundle-SymbolicName>${pom.artifactId};blueprint.graceperiod:=false</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>!${pom.artifactId}*,*</Import-Package>
                         <Private-Package>org.apache.felix.karaf.deployer.features</Private-Package>

Modified: felix/trunk/karaf/deployer/features/src/main/java/org/apache/felix/karaf/deployer/features/FeatureDeploymentListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/features/src/main/java/org/apache/felix/karaf/deployer/features/FeatureDeploymentListener.java?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/features/src/main/java/org/apache/felix/karaf/deployer/features/FeatureDeploymentListener.java
(original)
+++ felix/trunk/karaf/deployer/features/src/main/java/org/apache/felix/karaf/deployer/features/FeatureDeploymentListener.java
Tue Feb  2 09:32:49 2010
@@ -39,7 +39,7 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
-import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.BundleListener;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
@@ -47,7 +47,7 @@
 /**
  * A deployment listener able to hot deploy a feature descriptor
  */
-public class FeatureDeploymentListener implements ArtifactUrlTransformer, SynchronousBundleListener
{
+public class FeatureDeploymentListener implements ArtifactUrlTransformer, BundleListener
{
 
     public static final String FEATURE_PATH = "org.apache.felix.karaf.shell.features";
 
@@ -76,7 +76,9 @@
     public void init() throws Exception {
         bundleContext.addBundleListener(this);
         for (Bundle bundle : bundleContext.getBundles()) {
-            bundleChanged(new BundleEvent(BundleEvent.INSTALLED, bundle));
+            if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING
+                    || bundle.getState() == Bundle.ACTIVE)
+            bundleChanged(new BundleEvent(BundleEvent.RESOLVED, bundle));
         }
     }
 

Modified: felix/trunk/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
(original)
+++ felix/trunk/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
Tue Feb  2 09:32:49 2010
@@ -20,7 +20,12 @@
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            default-activation="lazy">
 
-    <service ref="featureDeploymentListener" auto-export="interfaces" depends-on="featureUrlHandler"/>
+    <service id="featureUrlHandler" interface="org.osgi.service.url.URLStreamHandlerService">
+    	<service-properties>
+            <entry key="url.handler.protocol" value="feature"/>
+        </service-properties>
+        <bean class="org.apache.felix.karaf.deployer.features.FeatureURLHandler"/>
+    </service>
 
     <bean id="featureDeploymentListener" class="org.apache.felix.karaf.deployer.features.FeatureDeploymentListener"
           init-method="init" destroy-method="destroy" activation="lazy">
@@ -30,11 +35,13 @@
         </property>
     </bean>
 
-    <service id="featureUrlHandler" interface="org.osgi.service.url.URLStreamHandlerService">
-    	<service-properties>
-            <entry key="url.handler.protocol" value="feature"/>
-        </service-properties>
-        <bean class="org.apache.felix.karaf.deployer.features.FeatureURLHandler"/>
-    </service>
+    <!-- Force a reference to the url handler above from the osgi registry to (try to)
make sure
+         the url handler is registered inside the framework.  Else we can run into timing
issues
+         where fileinstall will use the featureDeploymentListener before the url can be actually
+         used.  In order to not block the bundle, the blueprint.graceperiod=false flag must
be
+         set on the SymbolicName osgi header -->
+    <reference id="featureUrlHandlerRef" interface="org.osgi.service.url.URLStreamHandlerService"
filter="url.handler.protocol=feature" />
+
+    <service ref="featureDeploymentListener" auto-export="interfaces" depends-on="featureUrlHandlerRef"/>
 
 </blueprint>

Modified: felix/trunk/karaf/deployer/spring/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/spring/pom.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/spring/pom.xml (original)
+++ felix/trunk/karaf/deployer/spring/pom.xml Tue Feb  2 09:32:49 2010
@@ -69,7 +69,9 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <!-- Set the blueprint.graceperiod flag to false to allow the
bundle to start
+                             See the blueprint config file -->
+                        <Bundle-SymbolicName>${pom.artifactId};blueprint.graceperiod:=false</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>!${pom.artifactId}*,*</Import-Package>
                         <Private-Package>org.apache.felix.karaf.deployer.spring</Private-Package>

Modified: felix/trunk/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml?rev=905551&r1=905550&r2=905551&view=diff
==============================================================================
--- felix/trunk/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
(original)
+++ felix/trunk/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
Tue Feb  2 09:32:49 2010
@@ -19,10 +19,6 @@
 -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
-    <service auto-export="interfaces" depends-on="springUrlHandler">
-        <bean class="org.apache.felix.karaf.deployer.spring.SpringDeploymentListener"/>
-    </service>
-
     <service id="springUrlHandler" interface="org.osgi.service.url.URLStreamHandlerService">
     	<service-properties>
             <entry key="url.handler.protocol" value="spring"/>
@@ -30,4 +26,15 @@
         <bean class="org.apache.felix.karaf.deployer.spring.SpringURLHandler"/>
     </service>
 
+    <bean id="springDeploymentListener" class="org.apache.felix.karaf.deployer.spring.SpringDeploymentListener"/>
+
+    <!-- Force a reference to the url handler above from the osgi registry to (try to)
make sure
+         the url handler is registered inside the framework.  Else we can run into timing
issues
+         where fileinstall will use the featureDeploymentListener before the url can be actually
+         used.  In order to not block the bundle, the blueprint.graceperiod=false flag must
be
+         set on the SymbolicName osgi header -->
+    <reference id="springUrlHandlerRef" interface="org.osgi.service.url.URLStreamHandlerService"
filter="url.handler.protocol=spring" />
+
+    <service ref="springDeploymentListener" auto-export="interfaces" depends-on="springDeploymentListener"
/>
+
 </blueprint>



Mime
View raw message