geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r926774 - in /geronimo/server/trunk/plugins/connector-1_6: ./ geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/ tra...
Date Tue, 23 Mar 2010 20:55:13 GMT
Author: gawor
Date: Tue Mar 23 20:55:13 2010
New Revision: 926774

URL: http://svn.apache.org/viewvc?rev=926774&view=rev
Log:
GERONIMO-5203: Register JTA services in service registry and install Aries transaction extensions
for blueprint

Modified:
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/GeronimoTransactionManagerGBean.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/TransactionManagerImplGBean.java
    geronimo/server/trunk/plugins/connector-1_6/pom.xml
    geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/pom.xml
    geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
Tue Mar 23 20:55:13 2010
@@ -573,7 +573,7 @@ public class ConnectorModuleBuilderTest 
 
 
         // add fake TransactionManager so refs will resolve
-        GBeanData tm = bootstrap.addGBean("TransactionManager", GeronimoTransactionManagerGBean.GBEAN_INFO);
+        GBeanData tm = bootstrap.addGBean("TransactionManager", GeronimoTransactionManagerGBean.class);
         tm.setAttribute("defaultTransactionTimeoutSeconds", 10);
 
         ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, bundleContext);

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/GeronimoTransactionManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/GeronimoTransactionManagerGBean.java?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/GeronimoTransactionManagerGBean.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/GeronimoTransactionManagerGBean.java
Tue Mar 23 20:55:13 2010
@@ -17,39 +17,61 @@
 
 package org.apache.geronimo.transaction.wrapper.manager;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
 import javax.management.j2ee.statistics.Stats;
+import javax.transaction.TransactionManager;
+import javax.transaction.TransactionSynchronizationRegistry;
+import javax.transaction.UserTransaction;
 import javax.transaction.xa.XAException;
-import org.apache.geronimo.management.stats.JTAStatsImpl;
-import org.apache.geronimo.management.StatisticsProvider;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.StatisticsProvider;
+import org.apache.geronimo.management.stats.JTAStatsImpl;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
-import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
 import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 
 /**
  * Used to provide the GBean metadata for the GeronimoTransactionManager class
  *
  * @version $Rev$ $Date$
  */
-public class GeronimoTransactionManagerGBean extends GeronimoTransactionManager implements
StatisticsProvider {
+@GBean(j2eeType=NameFactory.JTA_RESOURCE)
+public class GeronimoTransactionManagerGBean extends GeronimoTransactionManager implements
StatisticsProvider, GBeanLifecycle {
 
-    JTAStatsImpl stats = new JTAStatsImpl();
+    private final BundleContext bundleContext;
+    private final JTAStatsImpl stats;
+    private ServiceRegistration serviceRegistration;
 
     /**
      * TODO NOTE!!! this should be called in an unspecified transaction context, but we cannot
enforce this restriction!
      */
-    public GeronimoTransactionManagerGBean(int defaultTransactionTimeoutSeconds, XidFactory
xidFactory, TransactionLog transactionLog) throws XAException {
+    public GeronimoTransactionManagerGBean(@ParamAttribute(name="defaultTransactionTimeoutSeconds")
int defaultTransactionTimeoutSeconds,
+                                           @ParamReference(name="XidFactory", namingType=NameFactory.XID_FACTORY)
XidFactory xidFactory, 
+                                           @ParamReference(name="TransactionLog", namingType=NameFactory.TRANSACTION_LOG)
TransactionLog transactionLog,
+                                           @ParamSpecial(type=SpecialAttributeType.bundleContext)
BundleContext bundleContext) throws XAException {                                        
  
         super(defaultTransactionTimeoutSeconds == 0 ? DEFAULT_TIMEOUT : defaultTransactionTimeoutSeconds,

-                xidFactory,
-                transactionLog
-        );
+              xidFactory,
+              transactionLog);
+        
+        this.stats = new JTAStatsImpl();
+        this.bundleContext = bundleContext;
+        
         stats.setStartTime();
     }
 
-
     public void resetStats() {
         stats.setStartTime();
         super.resetStatistics();
@@ -79,17 +101,22 @@ public class GeronimoTransactionManagerG
         return false;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoTransactionManagerGBean.class,
-                TransactionManagerImplGBean.GBEAN_INFO,
-                NameFactory.JTA_RESOURCE);
-        GBEAN_INFO = infoFactory.getBeanInfo();
+    public void doFail() {
     }
 
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
+    public void doStart() throws Exception {
+        List<String> clazzes = new ArrayList<String>();
+        clazzes.add(TransactionManager.class.getName());
+        clazzes.add(TransactionSynchronizationRegistry.class.getName());
+        clazzes.add(UserTransaction.class.getName());
+        clazzes.add(RecoverableTransactionManager.class.getName());
+        serviceRegistration = bundleContext.registerService(clazzes.toArray(new String[clazzes.size()]),
this, new Properties());
     }
 
+    public void doStop() throws Exception {
+        if (serviceRegistration != null) {
+            serviceRegistration.unregister();
+        }
+    }
+    
 }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/TransactionManagerImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/TransactionManagerImplGBean.java?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/TransactionManagerImplGBean.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-transaction-1_6/src/main/java/org/apache/geronimo/transaction/wrapper/manager/TransactionManagerImplGBean.java
Tue Mar 23 20:55:13 2010
@@ -19,13 +19,14 @@ package org.apache.geronimo.transaction.
 
 import javax.transaction.xa.XAException;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
-import org.apache.geronimo.transaction.manager.XidFactory;
 import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
 import org.apache.geronimo.transaction.manager.TransactionTimer;
+import org.apache.geronimo.transaction.manager.XidFactory;
 
 /**
  * Simple implementation of a transaction manager.  This does not include XATerminator or
XAWork functionality:
@@ -33,37 +34,19 @@ import org.apache.geronimo.transaction.m
  *
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType=NameFactory.JTA_RESOURCE)
 public class TransactionManagerImplGBean extends TransactionManagerImpl {
 
     /**
      * TODO NOTE!!! this should be called in an unspecified transaction context, but we cannot
enforce this restriction!
      */
-    public TransactionManagerImplGBean(int defaultTransactionTimeoutSeconds, XidFactory xidFactory,
TransactionLog transactionLog) throws XAException {
+    public TransactionManagerImplGBean(@ParamAttribute(name="defaultTransactionTimeoutSeconds")
int defaultTransactionTimeoutSeconds,
+                                       @ParamReference(name="XidFactory", namingType=NameFactory.XID_FACTORY)
XidFactory xidFactory, 
+                                       @ParamReference(name="TransactionLog", namingType=NameFactory.TRANSACTION_LOG)
TransactionLog transactionLog) throws XAException {
         super(defaultTransactionTimeoutSeconds, xidFactory, transactionLog);
         // Start the TransactionTimer$CurrentTime thread. This should avoid potential ClassLoader

         // memory leaks caused by InheritableThreadLocals on the CurrentTime thread. See
GERONIMO-4869 for more info.
         TransactionTimer.getCurrentTime();
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(TransactionManagerImplGBean.class,
NameFactory.JTA_RESOURCE);
-
-        infoBuilder.addAttribute("defaultTransactionTimeoutSeconds", int.class, true);
-        infoBuilder.addReference("XidFactory", XidFactory.class, NameFactory.XID_FACTORY);
-        infoBuilder.addReference("TransactionLog", TransactionLog.class, NameFactory.TRANSACTION_LOG);
-
-        infoBuilder.setConstructor(new String[]{
-                "defaultTransactionTimeoutSeconds",
-                "XidFactory",
-                "TransactionLog"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/connector-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/pom.xml?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/pom.xml Tue Mar 23 20:55:13 2010
@@ -43,4 +43,14 @@
         <module>transaction-1_6</module>
     </modules>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.aries.transaction</groupId>
+                <artifactId>org.apache.aries.transaction.blueprint</artifactId>
+                <version>0.1-incubating-SNAPSHOT</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
 </project>

Modified: geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/pom.xml?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/pom.xml Tue Mar 23 20:55:13
2010
@@ -102,6 +102,11 @@
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.aries.transaction</groupId>
+            <artifactId>org.apache.aries.transaction.blueprint</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml?rev=926774&r1=926773&r2=926774&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml
Tue Mar 23 20:55:13 2010
@@ -7,6 +7,11 @@
         <type>car</type>
     </module-id>
     <dependency>
+        <groupId>org.apache.aries.transaction</groupId>
+        <artifactId>org.apache.aries.transaction.blueprint</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.geronimo.components</groupId>
         <artifactId>geronimo-connector</artifactId>
         <type>jar</type>



Mime
View raw message