[jboss-cvs] JBossAS SVN: r95881 - in projects/jboss-osgi: projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Oct 31 07:26:45 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-31 07:26:44 -0400 (Sat, 31 Oct 2009)
New Revision: 95881

Added:
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
Removed:
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/
Modified:
   projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
   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/installer/install-definition.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
Provide AS integration for the JTA services

Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml	2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml	2009-10-31 11:26:44 UTC (rev 95881)
@@ -29,7 +29,16 @@
     <version>1.0.4-SNAPSHOT</version>
   </parent>
 
+  <!-- Subversion -->
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/jbossas/trunk</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/jbossas/trunk</developerConnection>
+    <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+  </scm>
+  
+  <!-- Properties -->
   <properties>
+    <version.jboss.osgi.jta>1.0.0-SNAPSHOT</version.jboss.osgi.jta>
     <version.jboss.osgi.microcontainer>2.0.9-SNAPSHOT</version.jboss.osgi.microcontainer>
     <version.osgi>4.2.0</version.osgi>
   </properties>
@@ -38,6 +47,11 @@
   <dependencies>
     <dependency>
       <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-jta</artifactId>
+      <version>${version.jboss.osgi.jta}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
       <artifactId>jboss-osgi-microcontainer</artifactId>
       <version>${version.jboss.osgi.microcontainer}</version>
     </dependency>
@@ -86,11 +100,5 @@
     </plugins>
   </build>
 
-  <!-- Subversion -->
-  <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/jbossas/trunk</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/jbossas/trunk</developerConnection>
-    <url>http://fisheye.jboss.com/qsearch/JBossOSGi/projects/runtime/jbossas/trunk</url>
-  </scm>
   
 </project>
\ No newline at end of file

Copied: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java (from rev 95880, projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/MicrocontainerServiceBean.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	2009-10-31 11:26:44 UTC (rev 95881)
@@ -0,0 +1,120 @@
+/*
+ * 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.integration.jbossas;
+
+
+//$Id$
+
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.integration.AbstractMicrocontainerService;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.service.MicrocontainerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+/**
+ * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
+ * which is installed as MC bean in jbossas.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerServiceBean extends AbstractMicrocontainerService implements MicrocontainerServiceMBean
+{
+   private static Logger log = Logger.getLogger(MicrocontainerServiceBean.class);
+
+   private BundleContext bundleContext;
+   private MBeanServer mbeanServer;
+   private Kernel kernel;
+
+   public void setBundleContext(BundleContext bundleContext)
+   {
+      this.bundleContext = bundleContext;
+   }
+
+   public void setMbeanServer(MBeanServer mbeanServer)
+   {
+      this.mbeanServer = mbeanServer;
+   }
+
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+
+   @Override
+   public void logDebug(String message)
+   {
+      log.debug(message);
+   }
+
+   @Override
+   public void logWarning(String message, Exception ex)
+   {
+      log.warn(message, ex);
+   }
+
+   public void start() throws Exception
+   {
+      Kernel kernel = getKernel();
+      KernelController controller = kernel.getController();
+
+      // Preregister some MC beans
+      installBean(controller, BEAN_SYSTEM_BUNDLE_CONTEXT, bundleContext);
+      installBean(controller, BEAN_KERNEL, kernel);
+      installBean(controller, BEAN_KERNEL_CONTROLLER, controller);
+      installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
+
+      // Register the MicrocontainerService
+      log.debug("Register MicrocontainerService");
+      bundleContext.registerService(MicrocontainerService.class.getName(), this, null);
+      log.debug("MicrocontainerService registered");
+
+      // Register the DeployerService
+      Properties props = new Properties();
+      props.setProperty("provider", "microcontainer");
+      props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+      bundleContext.registerService(DeployerService.class.getName(), this, props);
+      log.debug("DeployerService registered");
+
+      // Register the MicrocontainerServiceMBean
+      registerMicrocontainerServiceMBean(mbeanServer);
+      log.debug("MicrocontainerServiceMBean registered");
+   }
+
+   void stop()
+   {
+      unregisterMicrocontainerServiceMBean(mbeanServer);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java	2009-10-31 11:26:44 UTC (rev 95881)
@@ -0,0 +1,76 @@
+/*
+ * 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.integration.jbossas;
+
+//$Id$
+
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * JBossAS intergration of the TransactionManager and UserTransaction service.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 31-Oct-2009
+ */
+public class TransactionServiceBean
+{
+   private BundleContext context;
+   private TransactionManager transactionManager;
+   private UserTransaction userTransaction;
+   
+   private ServiceRegistration txManagerRegistration;
+   private ServiceRegistration userTxRegistration;
+
+   public void setBundleContext(BundleContext bundleContext)
+   {
+      this.context = bundleContext;
+   }
+
+   public void setTransactionManager(TransactionManager transactionManager)
+   {
+      this.transactionManager = transactionManager;
+   }
+
+   public void setUserTransaction(UserTransaction userTransaction)
+   {
+      this.userTransaction = userTransaction;
+   }
+
+   public void start() throws Exception
+   {
+      txManagerRegistration = context.registerService(TransactionManager.class.getName(), transactionManager, null);
+      userTxRegistration = context.registerService(UserTransaction.class.getName(), userTransaction, null);
+   }
+
+   void stop()
+   {
+      if (txManagerRegistration != null)
+         txManagerRegistration.unregister();
+      
+      if (userTxRegistration != null)
+         userTxRegistration.unregister();
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-10-31 11:26:44 UTC (rev 95881)
@@ -40,10 +40,12 @@
 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;
 
@@ -82,7 +84,7 @@
  * @author thomas.diesler at jboss.com
  * @since 24-Apr-2009
  */
-public abstract class PropertiesBootstrapProvider implements OSGiBootstrapProvider
+public class PropertiesBootstrapProvider implements OSGiBootstrapProvider
 {
    // Provide logging
    final Logger log = LoggerFactory.getLogger(PropertiesBootstrapProvider.class);
@@ -191,7 +193,12 @@
    }
 
    /** Overwrite to create the framework */
-   protected abstract Framework createFramework(Map<String, Object> properties);
+   protected Framework createFramework(Map<String, Object> properties)
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(properties);
+      return framework;
+   }
    
    /**
     * Overwrite to register system services before bundles get installed.

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml	2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml	2009-10-31 11:26:44 UTC (rev 95881)
@@ -236,6 +236,7 @@
         <!-- all -->
         <include name="jboss-osgi-apache-xerces.jar" />
         <include name="jboss-osgi-blueprint.jar" />
+        <include name="jboss-osgi-husky.jar" />
         <include name="jboss-osgi-jaxb.jar" />
         <include name="jboss-osgi-jta.jar" />
         <include name="jboss-osgi-xml-binding.jar" />
@@ -366,6 +367,7 @@
       <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer" override="true">
         <include name="jboss-osgi-deployers.jar" />
         <include name="jboss-osgi-deployment.jar" />
+        <include name="jboss-osgi-runtime-jbossas.jar" />
         <include name="jboss-osgi-spi.jar" />
       </fileset>
 
@@ -375,6 +377,7 @@
         <include name="jboss-osgi-blueprint.jar" />
         <include name="jboss-osgi-common.jar" />
         <include name="jboss-osgi-common-core.jar" />
+        <include name="jboss-osgi-husky.jar" />
         <include name="jboss-osgi-jaxb.jar" />
         <include name="jboss-osgi-jmx.jar" />
         <include name="jboss-osgi-jndi.jar" />
@@ -389,7 +392,6 @@
       <fileset condition="isFelix" dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer"
         override="true">
         <include name="jboss-osgi-runtime-felix.jar" />
-        <include name="jboss-osgi-runtime-jbossas.jar" />
         <include name="org.apache.felix.framework.jar" />
       </fileset>
       <singlefile condition="isFelix" src="@{deploy.artifacts.dir}/resources/jbossas/jboss-beans-felix.xml" target="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer/META-INF/jboss-osgi-jboss-beans.xml"
@@ -408,7 +410,6 @@
       <fileset condition="isEquinox" dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer"
         override="true">
         <include name="jboss-osgi-runtime-equinox.jar" />
-        <include name="jboss-osgi-runtime-jbossas.jar" />
         <include name="org.apache.equinox.framework.jar" />
         <include name="org.eclipse.osgi.jar" />
       </fileset>

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2009-10-31 11:26:44 UTC (rev 95881)
@@ -84,12 +84,19 @@
   -->
 
   <!-- Microcontainer Service -->
-  <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.integration.MicrocontainerServiceBean">
+  <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
    <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
    <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
   </bean>
 
+  <!-- Transaction Service -->
+  <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+   <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+   <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+   <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+  </bean>
+  
   <!-- 
   ********************************
   *                              *  

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-10-31 11:26:44 UTC (rev 95881)
@@ -107,12 +107,19 @@
   -->
 
   <!-- Microcontainer Service -->
-  <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.integration.MicrocontainerServiceBean">
+  <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
    <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
    <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
   </bean>
 
+  <!-- Transaction Service -->
+  <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+   <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+   <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+   <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+  </bean>
+  
   <!-- 
   ********************************
   *                              *  

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml	2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml	2009-10-31 11:26:44 UTC (rev 95881)
@@ -198,4 +198,19 @@
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
 
+
+  <!-- 
+  ********************************
+  *                              *  
+  *  Generic OSGi Services       *
+  *                              *
+  ********************************
+  -->
+  
+  <bean name="OSGiTransactionService" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+   <property name="bundleContext"><inject bean="OSGiBundleManager" property="systemContext"/></property>
+   <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+   <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+  </bean>
+
 </deployment>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list