[jboss-osgi-commits] JBoss-OSGI SVN: r95375 - in projects/jboss-osgi: projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy and 16 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Thu Oct 22 02:01:10 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-22 02:01:08 -0400 (Thu, 22 Oct 2009)
New Revision: 95375

Added:
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/OSGiBootstrapTestCase.java
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/services/
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentServices.java
Removed:
   projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServicesActivator.java
   projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/scanner/
Modified:
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerActivator.java
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
   projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/ScannerThread.java
   projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxIntegration.java
   projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
   projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
   projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java
   projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/OSGiBootstrapTestCase.java
   projects/jboss-osgi/projects/runtime/felix/trunk/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
   projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
Log:
Add notion of system services to framework bootstrap

Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml	2009-10-22 06:01:08 UTC (rev 95375)
@@ -91,13 +91,15 @@
           <instructions>
             <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
             <Bundle-Activator>org.jboss.osgi.hotdeploy.internal.DeploymentScannerActivator</Bundle-Activator>
+            <Export-Package>
+              org.jboss.osgi.hotdeploy;version=${version}
+            </Export-Package>
             <Private-Package>org.jboss.osgi.hotdeploy.internal</Private-Package>
             <Import-Package>
                javax.management, 
                org.jboss.osgi.common.log;version=1.0,
                org.jboss.osgi.deployment.common,
                org.jboss.osgi.deployment.deployer,
-               org.jboss.osgi.deployment.scanner,
                org.jboss.osgi.spi.service;version=1.0,
                org.jboss.osgi.spi.util;version=1.0,
                org.osgi.framework,

Copied: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java (from rev 95358, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/scanner/DeploymentScannerService.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.hotdeploy;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.osgi.deployment.common.Deployment;
+
+
+/**
+ * A service that scans a directory location for new/removed bundles.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 27-May-2009
+ */
+public interface DeploymentScannerService
+{
+   /**
+    * The property that names the scan location: org.jboss.osgi.hotdeploy.scandir
+    */
+   String PROPERTY_SCAN_LOCATION = "org.jboss.osgi.hotdeploy.scandir";
+   
+   /**
+    * The property to defines the scan interval: org.jboss.osgi.hotdeploy.interval
+    */
+   String PROPERTY_SCAN_INTERVAL = "org.jboss.osgi.hotdeploy.interval";
+   
+   /**
+    * Get the scan location URL.
+    *  
+    * This is can be specified by setting the {@link #PROPERTY_SCAN_LOCATION} property. 
+    */
+   URL getScanLocation();
+   
+   /**
+    * The number of scans since the service started 
+    */
+   long getScanCount();
+   
+   /**
+    * The number of milliseconds between scans
+    * Defaults to 2000ms 
+    */
+   long getScanInterval();
+   
+   /**
+    * The timestamp of the last change
+    */
+   long getLastChange();
+   
+   /**
+    * Run a directory scan
+    */
+   void scan();
+   
+   /**
+    * Returns the array of bundles currently known to the deployemtn scanner. 
+    */
+   Deployment[] getBundleDeployments();
+}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerActivator.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerActivator.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -23,7 +23,7 @@
 
 //$Id$
 
-import org.jboss.osgi.deployment.scanner.DeploymentScannerService;
+import org.jboss.osgi.hotdeploy.DeploymentScannerService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 

Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -36,7 +36,7 @@
 
 import org.jboss.osgi.deployment.common.Deployment;
 import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.scanner.DeploymentScannerService;
+import org.jboss.osgi.hotdeploy.DeploymentScannerService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -72,6 +72,9 @@
 
       // Get the DeployerService
       ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
+      if (sref == null)
+         throw new IllegalStateException("Cannot obtain deployer service");
+      
       deployer = (DeployerService)context.getService(sref);
 
       initScanner(context);

Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/ScannerThread.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/ScannerThread.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/ScannerThread.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.deployment.scanner.DeploymentScannerService;
+import org.jboss.osgi.hotdeploy.DeploymentScannerService;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 

Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml	2009-10-22 06:01:08 UTC (rev 95375)
@@ -39,6 +39,7 @@
   <!-- Properties -->
   <properties>
     <version.eclipse.equinox>3.5</version.eclipse.equinox>
+    <version.jboss.osgi.deployment>0.0.1-SNAPSHOT</version.jboss.osgi.deployment>
     <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
   </properties>
   
@@ -50,6 +51,12 @@
       <version>${version.jboss.osgi.spi}</version>
     </dependency>
     <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-deployment</artifactId>
+      <version>${version.jboss.osgi.deployment}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.eclipse.equinox</groupId>
       <artifactId>org.eclipse.osgi</artifactId>
       <version>${version.eclipse.equinox}</version>

Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -23,7 +23,9 @@
 
 //$Id$
 
+import org.jboss.osgi.deployment.DeploymentServices;
 import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+import org.osgi.framework.BundleContext;
 
 /**
  * A bootstrap provider for Equinox.
@@ -33,4 +35,19 @@
  */
 public class EquinoxBootstrapProvider extends PropertiesBootstrapProvider
 {
+   private DeploymentServices deploymentServices;
+   
+   @Override
+   protected void registerSystemServices(BundleContext context)
+   {
+      deploymentServices = new DeploymentServices();
+      deploymentServices.start(context);
+   }
+
+   @Override
+   protected void unregisterSystemServices(BundleContext context)
+   {
+      if (deploymentServices != null)
+         deploymentServices.stop(context);
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxIntegration.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxIntegration.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -25,11 +25,12 @@
 
 import java.util.Map;
 
-import org.jboss.logging.Logger;
 import org.jboss.osgi.spi.framework.FrameworkIntegration;
 import org.jboss.osgi.spi.util.ServiceLoader;
 import org.osgi.framework.launch.Framework;
 import org.osgi.framework.launch.FrameworkFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Equinox specific OSGi Framework integration.
@@ -40,7 +41,7 @@
 public class EquinoxIntegration extends FrameworkIntegration
 {
    // Provide logging
-   final Logger log = Logger.getLogger(EquinoxIntegration.class);
+   final Logger log = LoggerFactory.getLogger(EquinoxIntegration.class);
 
    @Override
    protected Framework createFramework(Map<String, Object> properties)

Added: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/OSGiBootstrapTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/OSGiBootstrapTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/OSGiBootstrapTestCase.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.equinox;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * Test OSGi System bundle access
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 27-Jul-2009
+ */
+public class OSGiBootstrapTestCase 
+{
+   @Test
+   public void testFrameworkLaunch() throws Exception
+   {
+      OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+      Framework framework = bootProvider.getFramework();
+      
+      assertEquals("BundleId == 0", 0, framework.getBundleId());
+      assertEquals("SymbolicName", "org.eclipse.osgi", framework.getSymbolicName());
+      
+      framework.start();
+      try
+      {
+         BundleContext context = framework.getBundleContext();
+         ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
+         assertNotNull("DeployerService not null", sref);
+      }
+      finally
+      {
+         framework.stop();
+         framework.waitForStop(1000);
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/java/org/jboss/test/osgi/equinox/OSGiBootstrapTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-10-22 06:01:08 UTC (rev 95375)
@@ -0,0 +1 @@
+org.jboss.osgi.equinox.EquinoxBootstrapProvider                 # The Equinox bootstrap provider  

Added: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/jboss-osgi-framework.properties	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/jboss-osgi-framework.properties	2009-10-22 06:01:08 UTC (rev 95375)
@@ -0,0 +1,21 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+# 
+# $Id$
+#
+
+# Properties to configure the Framework
+# org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+# org.osgi.framework.system.packages.extra=\
+
+# Bundles that need to be installed with the Framework automatically 
+# org.jboss.osgi.spi.framework.autoInstall=\
+
+# Bundles that need to be started automatically 
+# org.jboss.osgi.spi.framework.autoStart=\
+	


Property changes on: projects/jboss-osgi/projects/runtime/equinox/trunk/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml	2009-10-22 06:01:08 UTC (rev 95375)
@@ -54,6 +54,7 @@
       <artifactId>jboss-osgi-deployment</artifactId>
       <version>${version.jboss.osgi.deployment}</version>
     </dependency>
+    
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -23,8 +23,9 @@
 
 //$Id$
 
+import org.jboss.osgi.deployment.DeploymentServices;
 import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
-import org.osgi.framework.launch.Framework;
+import org.osgi.framework.BundleContext;
 
 /**
  * A bootstrap provider for Felix.
@@ -34,16 +35,19 @@
  */
 public class FelixBootstrapProvider extends PropertiesBootstrapProvider
 {
-   private Framework frameworkWrapper;
+   private DeploymentServices deploymentServices;
    
    @Override
-   public Framework getFramework()
+   protected void registerSystemServices(BundleContext context)
    {
-      if (frameworkWrapper == null)
-      {
-         Framework framework = super.getFramework();
-         frameworkWrapper = new FelixFrameworkWrapper(framework);
-      }
-      return frameworkWrapper;
+      deploymentServices = new DeploymentServices();
+      deploymentServices.start(context);
    }
+
+   @Override
+   protected void unregisterSystemServices(BundleContext context)
+   {
+      if (deploymentServices != null)
+         deploymentServices.stop(context);
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -23,17 +23,14 @@
 
 //$Id$
 
-import org.jboss.osgi.deployment.internal.DeploymentServicesActivator;
 import org.jboss.osgi.spi.framework.FrameworkWrapper;
-import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
 import org.osgi.framework.launch.Framework;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The FelixFrameworkWrapper wrapps the Framework provided by the Felix implemenation.
+ * Wraps the Framework provided by the Felix implementation.
  * 
  * @author thomas.diesler at jboss.com
  * @since 15-Oct-2009
@@ -42,71 +39,16 @@
 {
    // Provide logging
    final Logger log = LoggerFactory.getLogger(FelixFrameworkWrapper.class);
-   
-   private BundleActivator deploymentServices;
-   
+
    FelixFrameworkWrapper(Framework framework)
    {
       super(framework);
    }
 
    @Override
-   public void start() throws BundleException
-   {
-      super.start();
-      
-      // Start the deployment services
-      try
-      {
-         BundleContext context = framework.getBundleContext();
-         deploymentServices = new DeploymentServicesActivator();
-         deploymentServices.start(context);
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (BundleException ex)
-      {
-         throw ex;
-      }
-      catch (Exception ex)
-      {
-         throw new BundleException("Cannot start deployment services", ex); 
-      }
-   }
-
-   @Override
-   public void stop() throws BundleException
-   {
-      // Stop the deployment services
-      if (deploymentServices != null)
-      {
-         try
-         {
-            BundleContext context = framework.getBundleContext();
-            deploymentServices.stop(context);
-         }
-         catch (RuntimeException rte)
-         {
-            throw rte;
-         }
-         catch (BundleException ex)
-         {
-            throw ex;
-         }
-         catch (Exception ex)
-         {
-            throw new BundleException("Cannot start deployment services", ex); 
-         }
-      }
-      super.stop();
-   }
-
-   @Override
    public BundleContext getBundleContext()
    {
-      BundleContext context = framework.getBundleContext();
+      BundleContext context = super.getBundleContext();
       return new FelixBundleContextWrapper(context);
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/OSGiBootstrapTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/OSGiBootstrapTestCase.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/test/java/org/jboss/test/osgi/felix/OSGiBootstrapTestCase.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -27,7 +27,6 @@
 import static org.junit.Assert.assertNotNull;
 
 import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.felix.FelixBundleContextWrapper;
 import org.jboss.osgi.spi.framework.OSGiBootstrap;
 import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
 import org.junit.Test;
@@ -56,8 +55,6 @@
       try
       {
          BundleContext context = framework.getBundleContext();
-         assertEquals(FelixBundleContextWrapper.class.getName(), context.getClass().getName());
-         
          ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
          assertNotNull("DeployerService not null", sref);
       }

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/test/resources/jboss-osgi-framework.properties	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/test/resources/jboss-osgi-framework.properties	2009-10-22 06:01:08 UTC (rev 95375)
@@ -4,9 +4,6 @@
 # $Id$
 #
 
-# The OSGiFramework implementation 
-org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
-
 # Properties to configure the Framework
 # org.osgi.framework.storage.clean=onFirstInit
 

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -57,6 +57,7 @@
    {
       if (framework == null)
          throw new IllegalArgumentException("Null framework");
+      
       this.framework = framework;
    }
 

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -29,7 +29,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -46,9 +45,6 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
 import org.osgi.framework.launch.Framework;
 import org.osgi.framework.launch.FrameworkFactory;
 import org.slf4j.Logger;
@@ -130,7 +126,7 @@
       // Load the framework instance
       FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
       final Framework frameworkImpl = factory.newFramework(props);
-      framework = new FrameworkDelegate(frameworkImpl)
+      framework = new FrameworkWrapper(frameworkImpl)
       {
          @Override
          public void start() throws BundleException
@@ -138,7 +134,7 @@
             super.start();
 
             // Get system bundle context
-            BundleContext context = framework.getBundleContext();
+            BundleContext context = getBundleContext();
             if (context == null)
                throw new FrameworkException("Cannot obtain system context");
 
@@ -160,6 +156,9 @@
                autoInstall.add(bundleURL);
             }
 
+            // Register system services
+            registerSystemServices(context);
+            
             // Install autoInstall bundles
             for (URL bundleURL : autoInstall)
             {
@@ -181,11 +180,36 @@
                }
             }
          }
+
+         @Override
+         public void stop() throws BundleException
+         {
+            // Unregister system services
+            unregisterSystemServices(getBundleContext());
+            
+            super.stop();
+         }
       };
 
       configured = true;
    }
 
+   /**
+    * Overwrite to register system services before bundles get installed.
+    */
+   protected void registerSystemServices(BundleContext context)
+   {
+      // no default system services
+   }
+   
+   /**
+    * Overwrite to unregister system services before bundles get installed.
+    */
+   protected void unregisterSystemServices(BundleContext context)
+   {
+      // no default system services
+   }
+   
    private List<URL> getBundleURLs(Map<String, Object> props, String key)
    {
       String bundleList = (String)props.get(key);
@@ -321,162 +345,4 @@
 
       return propMap;
    }
-
-   class FrameworkDelegate implements Framework
-   {
-      private Framework framework;
-
-      FrameworkDelegate(Framework framework)
-      {
-         this.framework = framework;
-      }
-
-      @SuppressWarnings("unchecked")
-      public Enumeration findEntries(String path, String filePattern, boolean recurse)
-      {
-         return framework.findEntries(path, filePattern, recurse);
-      }
-
-      public BundleContext getBundleContext()
-      {
-         return framework.getBundleContext();
-      }
-
-      public long getBundleId()
-      {
-         return framework.getBundleId();
-      }
-
-      public URL getEntry(String path)
-      {
-         return framework.getEntry(path);
-      }
-
-      @SuppressWarnings("unchecked")
-      public Enumeration getEntryPaths(String path)
-      {
-         return framework.getEntryPaths(path);
-      }
-
-      @SuppressWarnings("unchecked")
-      public Dictionary getHeaders()
-      {
-         return framework.getHeaders();
-      }
-
-      @SuppressWarnings("unchecked")
-      public Dictionary getHeaders(String locale)
-      {
-         return framework.getHeaders(locale);
-      }
-
-      public long getLastModified()
-      {
-         return framework.getLastModified();
-      }
-
-      public String getLocation()
-      {
-         return framework.getLocation();
-      }
-
-      public ServiceReference[] getRegisteredServices()
-      {
-         return framework.getRegisteredServices();
-      }
-
-      public URL getResource(String name)
-      {
-         return framework.getResource(name);
-      }
-
-      @SuppressWarnings("unchecked")
-      public Enumeration getResources(String name) throws IOException
-      {
-         return framework.getResources(name);
-      }
-
-      public ServiceReference[] getServicesInUse()
-      {
-         return framework.getServicesInUse();
-      }
-
-      @SuppressWarnings("unchecked")
-      public Map getSignerCertificates(int signersType)
-      {
-         return framework.getSignerCertificates(signersType);
-      }
-
-      public int getState()
-      {
-         return framework.getState();
-      }
-
-      public String getSymbolicName()
-      {
-         return framework.getSymbolicName();
-      }
-
-      public Version getVersion()
-      {
-         return framework.getVersion();
-      }
-
-      public boolean hasPermission(Object permission)
-      {
-         return framework.hasPermission(permission);
-      }
-
-      public void init() throws BundleException
-      {
-         framework.init();
-      }
-
-      @SuppressWarnings("unchecked")
-      public Class loadClass(String name) throws ClassNotFoundException
-      {
-         return framework.loadClass(name);
-      }
-
-      public void start() throws BundleException
-      {
-         framework.start();
-      }
-
-      public void start(int options) throws BundleException
-      {
-         framework.start(options);
-      }
-
-      public void stop() throws BundleException
-      {
-         framework.stop();
-      }
-
-      public void stop(int options) throws BundleException
-      {
-         framework.stop(options);
-      }
-
-      public void uninstall() throws BundleException
-      {
-         framework.uninstall();
-      }
-
-      public void update() throws BundleException
-      {
-         framework.update();
-      }
-
-      public void update(InputStream in) throws BundleException
-      {
-         framework.update(in);
-      }
-
-      public FrameworkEvent waitForStop(long timeout) throws InterruptedException
-      {
-         return framework.waitForStop(timeout);
-      }
-
-   }
 }

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties	2009-10-22 06:01:08 UTC (rev 95375)
@@ -97,5 +97,4 @@
 org.jboss.osgi.spi.framework.autoStart=\
    file://${osgi.home}/server/minimal/deploy/org.apache.felix.log.jar \
    file://${osgi.home}/server/minimal/deploy/jboss-osgi-common.jar \
-   file://${osgi.home}/server/minimal/deploy/jboss-osgi-deployment.jar \
    file://${osgi.home}/server/minimal/deploy/jboss-osgi-hotdeploy.jar 
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentServices.java (from rev 95358, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServicesActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentServices.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentServices.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.deployment;
+
+//$Id$
+
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
+import org.jboss.osgi.deployment.internal.LifecycleInterceptorServiceImpl;
+import org.jboss.osgi.deployment.internal.SystemDeployerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The deployers activator
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 15-Oct-2009
+ */
+public class DeploymentServices
+{
+   public void start(BundleContext context)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null BundleContext");
+      
+      // Register the DeploymentRegistryService
+      DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
+      context.registerService(DeploymentRegistryService.class.getName(), registry, null);
+
+      // Register the SystemDeployerService
+      Properties props = new Properties();
+      props.put("provider", "system");
+      final SystemDeployerService deployerService = new SystemDeployerService(context);
+      context.registerService(DeployerService.class.getName(), deployerService, props);
+      
+      // Register the lifecycle interceptor related services
+      LifecycleInterceptorService service = new LifecycleInterceptorServiceImpl(context);
+      context.registerService(LifecycleInterceptorService.class.getName(), service, null);
+
+      // Track other DeployerService implementations and register as MBean
+      ServiceTracker serviceTracker = new ServiceTracker(context, DeployerService.class.getName(), null)
+      {
+         @Override
+         public Object addingService(ServiceReference reference)
+         {
+            DeployerService service = (DeployerService)super.addingService(reference);
+            ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+            if (sref != null)
+            {
+               MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
+               deployerService.registerDeployerServiceMBean(context, mbeanServer);
+            }
+            return service;
+         }
+
+         @Override
+         public void removedService(ServiceReference reference, Object service)
+         {
+            ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+            if (sref != null)
+            {
+               MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
+               deployerService.unregisterDeployerServiceMBean(mbeanServer);
+            }
+            super.removedService(reference, service);
+         }
+      };
+      serviceTracker.open();
+   }
+
+   public void stop(BundleContext context)
+   {
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServicesActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServicesActivator.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServicesActivator.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.deployment.internal;
-
-//$Id$
-
-import java.util.Properties;
-
-import javax.management.MBeanServer;
-
-import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * The deployers activator
- * 
- * @author thomas.diesler at jboss.com
- * @since 15-Oct-2009
- */
-public class DeploymentServicesActivator implements BundleActivator
-{
-   public void start(BundleContext context) throws Exception
-   {
-      // Register the deployer related services
-      registerDeployerService(context);
-
-      // Register the lifecycle interceptor related services
-      LifecycleInterceptorService service = new LifecycleInterceptorServiceImpl(context);
-      context.registerService(LifecycleInterceptorService.class.getName(), service, null);
-   }
-
-   public void stop(BundleContext context) throws Exception
-   {
-   }
-
-   protected void registerDeployerService(BundleContext context)
-   {
-      // Register the DeploymentRegistryService
-      DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
-      context.registerService(DeploymentRegistryService.class.getName(), registry, null);
-
-      // Register the SystemDeployerService
-      Properties props = new Properties();
-      props.put("provider", "system");
-      final SystemDeployerService deployerService = new SystemDeployerService(context);
-      context.registerService(DeployerService.class.getName(), deployerService, props);
-
-      // Track other DeployerService implementations and register as MBean
-      ServiceTracker serviceTracker = new ServiceTracker(context, DeployerService.class.getName(), null)
-      {
-         @Override
-         public Object addingService(ServiceReference reference)
-         {
-            DeployerService service = (DeployerService)super.addingService(reference);
-            ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
-            if (sref != null)
-            {
-               MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
-               deployerService.registerDeployerServiceMBean(context, mbeanServer);
-            }
-            return service;
-         }
-
-         @Override
-         public void removedService(ServiceReference reference, Object service)
-         {
-            ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
-            if (sref != null)
-            {
-               MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
-               deployerService.unregisterDeployerServiceMBean(mbeanServer);
-            }
-            super.removedService(reference, service);
-         }
-      };
-      serviceTracker.open();
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -281,7 +281,7 @@
       return (StartLevel)startLevelTracker.getService();
    }
 
-   void registerDeployerServiceMBean(BundleContext context, MBeanServer mbeanServer)
+   public void registerDeployerServiceMBean(BundleContext context, MBeanServer mbeanServer)
    {
       try
       {
@@ -305,7 +305,7 @@
       }
    }
 
-   void unregisterDeployerServiceMBean(MBeanServer mbeanServer)
+   public void unregisterDeployerServiceMBean(MBeanServer mbeanServer)
    {
       try
       {

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java	2009-10-22 05:52:07 UTC (rev 95374)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java	2009-10-22 06:01:08 UTC (rev 95375)
@@ -88,8 +88,8 @@
          allPackages.add("org.jboss.osgi.deployment.common");
          allPackages.add("org.jboss.osgi.deployment.deployer");
          allPackages.add("org.jboss.osgi.deployment.interceptor");
-         allPackages.add("org.jboss.osgi.deployment.scanner");
          allPackages.add("org.jboss.osgi.microcontainer");
+
          allPackages.add("org.jboss.virtual");
          
          allPackages.add("org.w3c.dom");



More information about the jboss-osgi-commits mailing list