[jboss-cvs] JBossAS SVN: r95857 - in projects/jboss-osgi: projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 30 12:56:04 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-30 12:56:03 -0400 (Fri, 30 Oct 2009)
New Revision: 95857

Removed:
   projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
   projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java
Modified:
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
   projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
   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/FelixLogger.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
   projects/jboss-osgi/trunk/reactor/jta/pom.xml
Log:
Fix Felix runtime logging

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml	2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml	2009-10-30 16:56:03 UTC (rev 95857)
@@ -42,7 +42,7 @@
     <version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
     <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
     <version.jboss.osgi.runtime.deployers>1.0.2</version.jboss.osgi.runtime.deployers>
-    <version.jboss.osgi.deployment>0.0.1-SNAPSHOT</version.jboss.osgi.deployment>
+    <version.jboss.osgi.deployment>1.0.0-SNAPSHOT</version.jboss.osgi.deployment>
     <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.osgi.xml.binding>2.0.1.SP1</version.jboss.osgi.xml.binding>
     <version.osgi>4.2.0</version.osgi>
@@ -137,7 +137,6 @@
               org.jboss.joinpoint.*, 
               org.jboss.logging, 
               org.jboss.osgi.common.log;version=1.0,
-              org.jboss.osgi.deployment.common,
               org.jboss.osgi.deployment.deployer,
               org.jboss.osgi.jbossxb;version=2.0,
               org.jboss.osgi.spi;version=1.0,

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-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -23,11 +23,14 @@
 
 //$Id$
 
-import java.net.URL;
+import java.util.Map;
 
 import org.jboss.osgi.deployment.DeploymentActivator;
 import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+import org.jboss.osgi.spi.util.ServiceLoader;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,14 +48,17 @@
    private DeploymentActivator deploymentActivator;
    
    @Override
-   public void configure(URL urlConfig)
+   protected Framework createFramework(Map<String, Object> properties)
    {
-      super.configure(urlConfig);
-      
       // Log INFO about this implementation
       String implTitle = getClass().getPackage().getImplementationTitle();
       String impVersion = getClass().getPackage().getImplementationVersion();
       log.info(implTitle + " - " + impVersion);
+      
+      // Load the framework instance
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(properties);
+      return framework;
    }
    
    @Override

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-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -23,12 +23,14 @@
 
 //$Id$
 
-import java.net.URL;
+import java.util.Map;
 
 import org.jboss.osgi.deployment.DeploymentActivator;
 import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+import org.jboss.osgi.spi.util.ServiceLoader;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,21 +48,24 @@
    private DeploymentActivator deploymentActivator;
    
    @Override
-   public void configure(URL urlConfig)
+   protected Framework createFramework(Map<String, Object> properties)
    {
-      super.configure(urlConfig);
-      
       // Log INFO about this implementation
       String implTitle = getClass().getPackage().getImplementationTitle();
       String impVersion = getClass().getPackage().getImplementationVersion();
       log.info(implTitle + " - " + impVersion);
-   }
+      
+      // When a Felix instance is embedded in a host application,
+      // the host application must inform the Felix instance that it is embedded
+      properties.put("felix.embedded.execution", "true");
 
-   @Override
-   public Framework getFramework()
-   {
-      Framework framework = super.getFramework();
-      return new FelixFrameworkWrapper(framework);
+      // An instance of Logger that the framework uses as its default logger
+      properties.put("felix.log.logger", new FelixLogger());
+
+      // Load the framework instance
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(properties);
+      return framework;
    }
    
    @Override

Deleted: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java	2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -1,48 +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.felix;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.BundleContextWrapper;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wraps the BundleContext provided by the Felix implementation.
- * 
- * It provides additional functionality on bundle install.
- * 
- * @author thomas.diesler at jboss.com
- * @since 15-Oct-2009
- */
-public class FelixBundleContextWrapper extends BundleContextWrapper
-{
-   // Provide logging
-   final Logger log = LoggerFactory.getLogger(FelixBundleContextWrapper.class);
-
-   public FelixBundleContextWrapper(BundleContext context)
-   {
-      super(context);
-   }
-}
\ No newline at end of file

Deleted: 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-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -1,49 +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.felix;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.FrameworkWrapper;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * Wraps the Framework provided by the Felix implementation.
- * 
- * @author thomas.diesler at jboss.com
- * @since 15-Oct-2009
- */
-class FelixFrameworkWrapper extends FrameworkWrapper
-{
-   FelixFrameworkWrapper(Framework framework)
-   {
-      super(framework);
-   }
-
-   @Override
-   public BundleContext getBundleContext()
-   {
-      BundleContext context = super.getBundleContext();
-      return new FelixBundleContextWrapper(context);
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java	2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -32,7 +32,7 @@
  * An integration with the Felix Logger.
  * 
  * This Logger gets registered with the Felix framework and 
- * delegates framework log messages to the JBoss logger.
+ * delegates framework log messages to SLF4J.
  * 
  * @author thomas.diesler at jboss.com
  * @since 04-Mar-2009

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-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-10-30 16:56:03 UTC (rev 95857)
@@ -40,12 +40,10 @@
 import org.jboss.osgi.spi.NotImplementedException;
 import org.jboss.osgi.spi.internal.StringPropertyReplacer;
 import org.jboss.osgi.spi.util.ExportedPackageHelper;
-import org.jboss.osgi.spi.util.ServiceLoader;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -84,7 +82,7 @@
  * @author thomas.diesler at jboss.com
  * @since 24-Apr-2009
  */
-public class PropertiesBootstrapProvider implements OSGiBootstrapProvider
+public abstract class PropertiesBootstrapProvider implements OSGiBootstrapProvider
 {
    // Provide logging
    final Logger log = LoggerFactory.getLogger(PropertiesBootstrapProvider.class);
@@ -123,8 +121,7 @@
       final Map<String, Object> props = getBootstrapProperties(urlConfig);
 
       // Load the framework instance
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      final Framework frameworkImpl = factory.newFramework(props);
+      final Framework frameworkImpl = createFramework(props);
       framework = new FrameworkWrapper(frameworkImpl)
       {
          @Override
@@ -193,6 +190,9 @@
       configured = true;
    }
 
+   /** Overwrite to create the framework */
+   protected abstract Framework createFramework(Map<String, Object> properties);
+   
    /**
     * Overwrite to register system services before bundles get installed.
     */

Modified: projects/jboss-osgi/trunk/reactor/jta/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/pom.xml	2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/trunk/reactor/jta/pom.xml	2009-10-30 16:56:03 UTC (rev 95857)
@@ -101,7 +101,7 @@
               javax.management, 
               javax.naming, 
               javax.naming.spi, 
-              javax.transaction, 
+              javax.transaction;version="[1.0,1.1)", 
               javax.xml.parsers, 
               org.apache.commons.logging, 
               org.jboss.osgi.spi.capability;version="[1.0,1.1)", 




More information about the jboss-cvs-commits mailing list