geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r983158 - in /geronimo/server/branches/2.2/plugins/openejb: ./ geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Date Sat, 07 Aug 2010 00:53:36 GMT
Author: djencks
Date: Sat Aug  7 00:53:35 2010
New Revision: 983158

URL: http://svn.apache.org/viewvc?rev=983158&view=rev
Log:
GERONIMO-5501 support of xa recovery for inbound resource adapters.  Apparently openejb is
not using our ra wrappers so we lose a lot of encapsulation.

Modified:
    geronimo/server/branches/2.2/plugins/openejb/   (props changed)
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java

Propchange: geronimo/server/branches/2.2/plugins/openejb/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug  7 00:53:35 2010
@@ -1 +1 @@
-/geronimo/server/trunk/plugins/openejb:982438
+/geronimo/server/trunk/plugins/openejb:982438,983150

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java?rev=983158&r1=983157&r2=983158&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoInboundRecovery.java
Sat Aug  7 00:53:35 2010
@@ -20,9 +20,13 @@
 
 package org.apache.geronimo.openejb;
 
+import javax.resource.ResourceException;
 import javax.resource.spi.ActivationSpec;
 import javax.resource.spi.ResourceAdapter;
-import org.apache.geronimo.connector.ResourceAdapterWrapper;
+import javax.transaction.xa.XAResource;
+import org.apache.geronimo.transaction.manager.NamedXAResource;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+import org.apache.geronimo.transaction.manager.WrapperNamedXAResource;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.core.mdb.InboundRecovery;
 
@@ -31,7 +35,22 @@ import org.apache.openejb.core.mdb.Inbou
  */
 public class GeronimoInboundRecovery implements InboundRecovery {
 
+    private final RecoverableTransactionManager transactionManager;
+
+    public GeronimoInboundRecovery(RecoverableTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
     public void recover(ResourceAdapter resourceAdapter, ActivationSpec activationSpec, String
containerId) throws OpenEJBException {
-        ((ResourceAdapterWrapper)resourceAdapter).doRecovery(activationSpec, containerId);
+        try {
+            XAResource[] xaress = resourceAdapter.getXAResources(new ActivationSpec[] {activationSpec});
+            if (xaress == null || xaress.length == 0) {
+                return;
+            }
+            NamedXAResource xares = new WrapperNamedXAResource(xaress[0], containerId);
+            transactionManager.recoverResourceManager(xares);
+        } catch (ResourceException e) {
+            throw new OpenEJBException("Could not recover resource manager", e);
+        }
     }
 }

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java?rev=983158&r1=983157&r2=983158&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Sat Aug  7 00:53:35 2010
@@ -47,6 +47,7 @@ import org.apache.geronimo.j2ee.j2eeobje
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.persistence.PersistenceUnitGBean;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
 import org.apache.openejb.Container;
 import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.NoSuchApplicationException;
@@ -97,11 +98,11 @@ public class OpenEjbSystemGBean implemen
     private ORB orb;
     private Properties properties; 
     
-    public OpenEjbSystemGBean(TransactionManager transactionManager) throws Exception {
+    public OpenEjbSystemGBean(RecoverableTransactionManager transactionManager) throws Exception
{
         this(transactionManager, null, null, new DeepBindableContext("java:openejb", false,
true, true, false), null, OpenEjbSystemGBean.class.getClassLoader(), new Properties());
     }
 
-    public OpenEjbSystemGBean(@ParamReference(name = "TransactionManager", namingType = NameFactory.JTA_RESOURCE)
TransactionManager transactionManager,
+    public OpenEjbSystemGBean(@ParamReference(name = "TransactionManager", namingType = NameFactory.JTA_RESOURCE)
RecoverableTransactionManager transactionManager,
                               @ParamReference(name = "ResourceAdapterWrappers", namingType
= NameFactory.JCA_RESOURCE_ADAPTER) Collection<ResourceAdapterWrapper> resourceAdapters,
                               @ParamReference(name = "PersistenceUnitGBeans", namingType
= NameFactory.PERSISTENCE_UNIT) Collection<PersistenceUnitGBean> persistenceUnitGBeans,
                               @ParamReference(name = "OpenEjbContext")DeepBindableContext
openejbContext,
@@ -142,7 +143,7 @@ public class OpenEjbSystemGBean implemen
         assembler.createTransactionManager(transactionServiceInfo);
 	    SystemInstance.get().setComponent(XAResourceWrapper.class, new GeronimoXAResourceWrapper());
 
-        SystemInstance.get().setComponent(InboundRecovery.class, new GeronimoInboundRecovery());
+        SystemInstance.get().setComponent(InboundRecovery.class, new GeronimoInboundRecovery(transactionManager));
 
         // install security service
         SecurityService securityService = new GeronimoSecurityService();



Mime
View raw message