[jbpm-commits] JBoss JBPM SVN: r5038 - in jbpm4/branches/tbaeyens/modules: enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jun 15 08:02:58 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-06-15 08:02:58 -0400 (Mon, 15 Jun 2009)
New Revision: 5038

Added:
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java
Removed:
   jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
Modified:
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml
   jbpm4/branches/tbaeyens/modules/examples/pom.xml
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
   jbpm4/branches/tbaeyens/modules/test-db/pom.xml
Log:
jta updates

Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml	2009-06-15 12:02:58 UTC (rev 5038)
@@ -20,7 +20,7 @@
       <local>org.jbpm.enterprise.internal.ejb.LocalCommandExecutor</local>
       <ejb-class>org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB</ejb-class>
       <session-type>Stateless</session-type>
-      <transaction-type>Container</transaction-type>
+      <transaction-type>Bean</transaction-type>
 
       <ejb-local-ref>
         <description>
@@ -150,13 +150,13 @@
 
   <assembly-descriptor>
 
-    <container-transaction>
+    <!--  container-transaction>
       <method>
         <ejb-name>CommandExecutor</ejb-name>
         <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
-    </container-transaction>
+    </container-transaction -->
 
     <container-transaction>
       <method>

Deleted: jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -1,65 +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.jbpm.enterprise.internal.wire.binding;
-
-import org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.binding.PropertiesBinding;
-import org.jbpm.pvm.internal.wire.binding.WireInterceptorBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * Mapping between a <code>jta-transaction-interceptor</code> element and a
- * {@link JtaTransactionInterceptor} object.
- * 
- * @author Alejandro Guizar
- */
-public class JtaTransactionInterceptorBinding extends WireInterceptorBinding {
-
-  private static final PropertiesBinding propertiesBinding = new PropertiesBinding();
-
-  public JtaTransactionInterceptorBinding() {
-    super("jta-transaction-interceptor");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    ObjectDescriptor descriptor = new ObjectDescriptor(JtaTransactionInterceptor.class);
-    // user transaction jndi name
-    String userTransactionName = XmlUtil.attribute(element, "user-transaction-name");
-    if (userTransactionName != null) {
-      descriptor.addInjection("userTransactionName", new StringDescriptor(userTransactionName));
-    }
-    // jndi properties
-    Element jndiPropertiesElement = XmlUtil.element(element, "jndi-properties");
-    if (jndiPropertiesElement != null) {
-      descriptor.addInjection("jndiProperties", (Descriptor) propertiesBinding.parse(
-          jndiPropertiesElement, parse, parser));
-    }
-    return descriptor;
-  }
-
-}

Modified: jbpm4/branches/tbaeyens/modules/examples/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/pom.xml	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/examples/pom.xml	2009-06-15 12:02:58 UTC (rev 5038)
@@ -183,16 +183,6 @@
             <configuration>
               <failIfNoTests>false</failIfNoTests>
               <trimStackTrace>false</trimStackTrace>
-              <excludes>
-                <!-- https://jira.jboss.org/jira/browse/JBPM-2147 -->
-                <!-- https://jira.jboss.org/jira/browse/JBPM-2200 
-                <exclude>org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java</exclude>
-                <exclude>org/jbpm/examples/task/candidates/TaskCandidatesTest.java</exclude>
-                <exclude>org/jbpm/examples/mail/template/TemplateMailTest.java</exclude>
-                <exclude>org/jbpm/examples/mail/inline/InlineMailTest.java</exclude>
-                <exclude>org/jbpm/examples/eventlistener/EventListenerTest.java</exclude>
-                -->
-              </excludes>
             </configuration>
           </plugin>
         </plugins>

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -98,7 +98,7 @@
    * transaction. */
   protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Throwable exception) {
     Transaction transaction = environment.get(Transaction.class);
-    transaction.setRollbackOnly();
+    // transaction.setRollbackOnly();
 
     CommandService commandService = (CommandService) environment.get(CommandService.class);
     JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);

Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -1,85 +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.jbpm.pvm.internal.tx;
-
-import javax.naming.InitialContext;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.env.Transaction;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JtaTransaction implements Transaction {
-
-  protected String userTransactionJndiName = "java:comp/UserTransaction";
-  protected String transactionManagerJndiName = "java:/TransactionManager";
-
-  public boolean isRollbackOnly() {
-    try {
-      return getUserTransaction().getStatus()==Status.STATUS_MARKED_ROLLBACK;
-    } catch (SystemException e) {
-      throw new JbpmException("couldn't get status of user transaction", e);
-    }
-  }
-
-  public void setRollbackOnly() {
-    try {
-      getUserTransaction().setRollbackOnly();
-    } catch (Exception e) {
-      throw new JbpmException("couldn't set user transaction to rollback only", e);
-    }
-  }
-
-  public void registerSynchronization(Synchronization synchronization) {
-    try {
-      getJeeTransaction().registerSynchronization(synchronization);
-    } catch (Exception e) {
-      throw new JbpmException("couldn't register synchronization", e);
-    }
-  }
-
-  protected UserTransaction getUserTransaction() {
-    try {
-      InitialContext initialContext = new InitialContext();
-      return (UserTransaction) initialContext.lookup(userTransactionJndiName);
-    } catch (Exception e) {
-      throw new JbpmException("couldn't lookup user transaction at "+userTransactionJndiName, e);
-    }
-  }
-
-  protected javax.transaction.Transaction getJeeTransaction() {
-    try {
-      InitialContext initialContext = new InitialContext();
-      TransactionManager transactionManager = (TransactionManager) initialContext.lookup(transactionManagerJndiName);
-      return transactionManager.getTransaction();
-    } catch (Exception e) {
-      throw new JbpmException("couldn't get transaction from transaction manager "+userTransactionJndiName, e);
-    }
-  }
-}

Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -0,0 +1,57 @@
+/*
+ * 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.jbpm.pvm.internal.tx.jta;
+
+import javax.transaction.Status;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JtaStatusHelper {
+
+  public static String toString(int txStatus) {
+    if (txStatus==Status.STATUS_ACTIVE) {
+      return "STATUS_ACTIVE";
+    } else if (txStatus==Status.STATUS_COMMITTED) {
+      return "STATUS_COMMITTED";
+    } else if (txStatus==Status.STATUS_COMMITTING) {
+      return "STATUS_COMMITTING";
+    } else if (txStatus==Status.STATUS_MARKED_ROLLBACK) {
+      return "STATUS_MARKED_ROLLBACK";
+    } else if (txStatus==Status.STATUS_NO_TRANSACTION) {
+      return "STATUS_NO_TRANSACTION";
+    } else if (txStatus==Status.STATUS_PREPARED) {
+      return "STATUS_PREPARED";
+    } else if (txStatus==Status.STATUS_PREPARING) {
+      return "STATUS_PREPARING";
+    } else if (txStatus==Status.STATUS_ROLLEDBACK) {
+      return "STATUS_ROLLEDBACK";
+    } else if (txStatus==Status.STATUS_ROLLING_BACK) {
+      return "STATUS_ROLLING_BACK";
+    } else if (txStatus==Status.STATUS_UNKNOWN) {
+      return "STATUS_UNKNOWN";
+    } else {
+      return "unknown";
+    }
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java (from rev 5035, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -0,0 +1,134 @@
+/*
+ * 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.jbpm.pvm.internal.tx.jta;
+
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.env.Transaction;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JtaTransaction implements Transaction {
+
+  protected String userTransactionJndiName = "java:comp/UserTransaction";
+  protected String transactionManagerJndiName = "java:/TransactionManager";
+
+  public boolean isRollbackOnly() {
+    try {
+      return lookupJeeUserTransaction().getStatus()==Status.STATUS_MARKED_ROLLBACK;
+    } catch (SystemException e) {
+      throw new JbpmException("couldn't get status of user transaction: "+e.getMessage(), e);
+    }
+  }
+
+  public void setRollbackOnly() {
+    try {
+      lookupJeeUserTransaction().setRollbackOnly();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't set user transaction to rollback only: "+e.getMessage(), e);
+    }
+  }
+
+  public void registerSynchronization(Synchronization synchronization) {
+    try {
+      lookupJeeTransaction().registerSynchronization(synchronization);
+    } catch (Exception e) {
+      throw new JbpmException("couldn't register synchronization: "+e.getMessage(), e);
+    }
+  }
+  
+  public void begin() {
+    try {
+      lookupJeeUserTransaction().begin();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't begin transaction: "+e.getMessage(), e);
+    }
+  }
+  
+  public void rollback() {
+    try {
+      lookupJeeUserTransaction().rollback();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't rollback: "+e.getMessage(), e);
+    }
+  }
+  
+  public void commit() {
+    try {
+      lookupJeeUserTransaction().commit();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't commit: "+e.getMessage(), e);
+    }
+  }
+  
+  public javax.transaction.Transaction suspend() {
+    try {
+      return lookupJeeTransactionManager().suspend();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't suspend: "+e.getMessage(), e);
+    }
+  }
+  
+  public void resume(javax.transaction.Transaction transaction) {
+    try {
+      lookupJeeTransactionManager().resume(transaction);
+    } catch (Exception e) {
+      throw new JbpmException("couldn't resume: "+e.getMessage(), e);
+    }
+  }
+  
+  // lookups //////////////////////////////////////////////////////////////////
+  
+  public UserTransaction lookupJeeUserTransaction() {
+    return (UserTransaction) lookupFromJndi(userTransactionJndiName);
+  }
+
+  public javax.transaction.Transaction lookupJeeTransaction() {
+    try {
+      TransactionManager transactionManager = lookupJeeTransactionManager();
+      return transactionManager.getTransaction();
+    } catch (Exception e) {
+      throw new JbpmException("couldn't get transaction from transaction manager "+transactionManagerJndiName+": "+e.getMessage(), e);
+    }
+  }
+
+  public TransactionManager lookupJeeTransactionManager() {
+    return (TransactionManager) lookupFromJndi(transactionManagerJndiName);
+  }
+  
+  public static Object lookupFromJndi(String jndiName) {
+    try {
+      InitialContext initialContext = new InitialContext();
+      return initialContext.lookup(jndiName);
+    } catch (Exception e) {
+      throw new JbpmException("couldn't lookup '"+jndiName+"' from jndi: "+e.getMessage()+": "+e.getMessage(), e);
+    }
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -0,0 +1,91 @@
+/*
+ * 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.jbpm.pvm.internal.tx.jta;
+
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.UserTransaction;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.svc.Interceptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JtaTransactionInterceptor extends Interceptor {
+  
+  private static Log log = Log.getLog(JtaTransactionInterceptor.class.getName());
+
+  public <T> T execute(Command<T> command) {
+    JtaTransaction jtaTransaction = Environment.getFromCurrent(JtaTransaction.class);
+    
+    UserTransaction userTransaction = jtaTransaction.lookupJeeUserTransaction();
+
+    int status = -1;
+    try {
+      status = userTransaction.getStatus();
+    } catch (SystemException e) {
+      throw new JbpmException("couldn't get transaction status: "+e.getMessage(), e);
+    }
+    log.debug("jta transaction status: "+JtaStatusHelper.toString(status));
+    
+    if ( (status != Status.STATUS_NO_TRANSACTION) 
+         && (status != Status.STATUS_COMMITTED) 
+         && (status != Status.STATUS_ROLLEDBACK)
+       ) {
+      throw new JbpmException("invalid transaction state: "+JtaStatusHelper.toString(status));
+    }
+
+    Transaction suspendedTransaction = null;
+    if ((status == Status.STATUS_COMMITTED) || (status == Status.STATUS_ROLLEDBACK)) {
+      suspendedTransaction = jtaTransaction.suspend();
+    }
+    
+    Object returnValue = null;
+    
+    try {
+      jtaTransaction.begin();
+      
+      returnValue = next.execute(command);
+
+      jtaTransaction.commit();
+
+    } catch (RuntimeException e) {
+      jtaTransaction.rollback();
+      throw e;
+      
+    } finally {
+      
+      if (suspendedTransaction!=null) {
+        jtaTransaction.resume(suspendedTransaction);
+      }
+    }
+    
+    return (T) returnValue;
+  }
+
+}


Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java (from rev 5035, jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -0,0 +1,46 @@
+/*
+ * 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.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * Mapping between a <code>jta-transaction-interceptor</code> element and a
+ * {@link JtaTransactionInterceptor} object.
+ * 
+ * @author Alejandro Guizar
+ */
+public class JtaTransactionInterceptorBinding extends WireInterceptorBinding {
+
+  public JtaTransactionInterceptorBinding() {
+    super("jta-transaction-interceptor");
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    return new ObjectDescriptor(JtaTransactionInterceptor.class);
+  }
+
+}

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -22,8 +22,8 @@
 package org.jbpm.pvm.internal.wire.binding;
 
 import org.jbpm.api.env.Transaction;
-import org.jbpm.pvm.internal.tx.JtaTransaction;
 import org.jbpm.pvm.internal.tx.StandardTransaction;
+import org.jbpm.pvm.internal.tx.jta.JtaTransaction;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java	2009-06-15 12:02:58 UTC (rev 5038)
@@ -28,8 +28,8 @@
 import org.jbpm.api.env.Environment;
 import org.jbpm.pvm.internal.identity.impl.IdentitySessionResource;
 import org.jbpm.pvm.internal.identity.impl.JBossIdmIdentitySessionImpl;
-import org.jbpm.pvm.internal.tx.JtaTransaction;
 import org.jbpm.pvm.internal.tx.StandardTransaction;
+import org.jbpm.pvm.internal.tx.jta.JtaTransaction;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireDefinition;
 

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-06-15 12:02:58 UTC (rev 5038)
@@ -78,6 +78,7 @@
   <binding class="org.jbpm.pvm.internal.wire.binding.RetryInterceptorBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.StandardTransactionInterceptorBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.SerializeInterceptorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.JtaTransactionInterceptorBinding" />
 
   <!-- operation -->
   <binding class="org.jbpm.pvm.internal.wire.binding.PropertyBinding" />
@@ -90,7 +91,6 @@
   <binding class="org.jbpm.enterprise.internal.wire.binding.EjbTimerSessionBinding" />
   <binding class="org.jbpm.enterprise.internal.wire.binding.EjbLocalCommandServiceBinding" />
   <binding class="org.jbpm.enterprise.internal.wire.binding.EjbRemoteCommandServiceBinding" />
-  <binding class="org.jbpm.enterprise.internal.wire.binding.JtaTransactionInterceptorBinding" />
 
   <!-- jpdl bindings -->
   <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />

Modified: jbpm4/branches/tbaeyens/modules/test-db/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/pom.xml	2009-06-15 12:00:58 UTC (rev 5037)
+++ jbpm4/branches/tbaeyens/modules/test-db/pom.xml	2009-06-15 12:02:58 UTC (rev 5038)
@@ -104,26 +104,8 @@
       </build>
     </profile>
 
-    <!-- 
-    skip tests if this is an integration test run 
-    (only examples and test-db are part of the integration test runs) 
-    -->
+    <!-- -Djboss.bind.address -->
     <profile>
-      <id>integration.test</id>
-      <activation>
-        <property>
-          <name>jboss.bind.address</name>
-        </property>
-      </activation>
-      <properties>
-        <skipTests>true</skipTests>
-      </properties>
-    </profile>
-    
-
-
-    <!-- -Djboss.bind.address
-    <profile>
       <id>integration.tests</id>
       <activation>
         <property>
@@ -137,6 +119,7 @@
           <artifactId>jbpm-enterprise</artifactId>
           <scope>test</scope>
         </dependency>
+        <!-- AS 5 Integration tests -->
         <dependency>
           <groupId>org.jboss.jbossas</groupId>
           <artifactId>jboss-as-client</artifactId>
@@ -165,10 +148,10 @@
                 <configuration>
                   <tasks>
                     <copy todir="target/test-classes" overwrite="true" failonerror="false">
-                      <fileset dir="../../qa/jbossremote" />
+                      <fileset dir="../distro/src/main/files/jboss/jbpm.cfg.remote.client" />
                     </copy>
                     <copy todir="target/test-classes" overwrite="true" failonerror="false">
-                      <fileset dir="${user.home}/.jbpm4/qa/jbossremote" />
+                      <fileset dir="${user.home}/.jbpm4/jbpm.cfg.remote.client" />
                     </copy>
                   </tasks>
                 </configuration>
@@ -180,15 +163,13 @@
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
               <failIfNoTests>false</failIfNoTests>
-              <trimStackTrace>false</trimStackTrace>              
-              <excludes>                
-              </excludes>
+              <trimStackTrace>false</trimStackTrace>
             </configuration>
           </plugin>
         </plugins>
       </build>
-    </profile
--->
+    </profile>
+
   </profiles>
 
 </project>
\ No newline at end of file




More information about the jbpm-commits mailing list