[jboss-cvs] JBossAS SVN: r95882 - in projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta: internal and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Oct 31 08:07:21 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-31 08:07:21 -0400 (Sat, 31 Oct 2009)
New Revision: 95882
Added:
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
Modified:
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
Log:
Register JTA services conditionally
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-10-31 11:26:44 UTC (rev 95881)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -46,7 +46,7 @@
{
public TransactionCapability()
{
- super(TransactionManager.class.getName());
+ super(TransactionService.class.getName());
if (new File("target").exists())
addSystemProperty(Environment.OBJECTSTORE_DIR, "target/ObjectStore");
Added: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -0,0 +1,35 @@
+/*
+ * 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.jta;
+
+//$Id$
+
+
+/**
+ * A marker service for the jboss-osgi-jta bundle.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 27-Oct-2009
+ */
+public interface TransactionService
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-10-31 11:26:44 UTC (rev 95881)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -26,6 +26,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
+import org.jboss.osgi.jta.TransactionService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
@@ -44,18 +45,30 @@
public void start(BundleContext context)
{
+ // Always register the marker service
+ TransactionService markerService = new TransactionService(){};
+ context.registerService(TransactionService.class.getName(), markerService, null);
+
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- // Register the TransactionManager service
- TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
- transactionManagerReg = context.registerService(TransactionManager.class.getName(), tm, null);
+ // Register the TransactionManager service if is not already available
+ // which would be the case for jbossas integration
+ if (context.getServiceReference(TransactionManager.class.getName()) == null)
+ {
+ TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
+ transactionManagerReg = context.registerService(TransactionManager.class.getName(), tm, null);
+ }
- // Register the UserTransaction service
- ServiceFactory txFactory = new UserTransactionServiceFactory();
- userTransactionReg = context.registerService(UserTransaction.class.getName(), txFactory, null);
+ // Register the UserTransaction service if is not already available
+ // which would be the case for jbossas integration
+ if (context.getServiceReference(UserTransaction.class.getName()) == null)
+ {
+ ServiceFactory txFactory = new UserTransactionServiceFactory();
+ userTransactionReg = context.registerService(UserTransaction.class.getName(), txFactory, null);
+ }
}
finally
{
More information about the jboss-cvs-commits
mailing list