[jbpm-commits] JBoss JBPM SVN: r4472 - in jbpm4/trunk/modules: distro/src/main/resources/config-tool/jbpm/cfg and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 7 03:58:24 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-04-07 03:58:24 -0400 (Tue, 07 Apr 2009)
New Revision: 4472

Added:
   jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
   jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
Modified:
   jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml
   jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
   jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
   jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
Log:
adding jta transaction for enterprise configuration

Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -15,6 +15,11 @@
     <equals arg1="${database}" arg2="mysql" />
   </condition>
 
+  <condition property="transaction.type" value="jta">
+    <equals arg1="${deployment.type}" arg2="sar" />
+  </condition>
+	<property name="transaction.type" value="default" />
+
   <!-- condition property="is.identity.included">
    <equals arg1="${identity}" arg2="include" />
  </condition -->
@@ -62,6 +67,7 @@
         <!-- file name="jbpm/cfg/identity.session.factory.${identity}.xml" / -->
         <file name="jbpm/cfg/jpdl.deployers.${jpdl}.xml" />
         <file name="jbpm/cfg/part3.jbpm.cfg.xml" />
+        <file name="jbpm/cfg/transaction.${transaction.type}.xml" />
         <file name="jbpm/cfg/hibernate.session.${hibernate.session}.xml" />
         <file name="jbpm/cfg/identity.session.${identity}.xml" />
         <file name="jbpm/cfg/part4.jbpm.cfg.xml" />

Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -26,7 +26,6 @@
   </process-engine-context>
 
   <transaction-context>
-    <transaction />
     <repository-session />
     <pvm-db-session />
     <job-db-session />

Added: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml	                        (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1 @@
+    <transaction />


Property changes on: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml	                        (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1 @@
+    <transaction type="jta" />


Property changes on: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
   </process-engine-context>
 
   <transaction-context>
-    <transaction />
     <repository-session />
     <pvm-db-session />
     <job-db-session />
@@ -61,6 +60,7 @@
     <message-session />
     <timer-session />
     <history-session />
+    <transaction />
     <hibernate-session />
     <identity-session />
   </transaction-context>

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -12,7 +12,7 @@
       <generator class="native" />
     </id>
 
-    <property name="name" type="text"   column="NAME_" />
+    <property name="name" type="text" column="NAME_" />
     <property name="timestamp" column="TIMESTAMP_" />
 
     <map name="resources" cascade="all-delete-orphan">

Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
   </process-engine-context>
 
   <transaction-context>
-    <transaction />
     <repository-session />
     <pvm-db-session />
     <job-db-session />
@@ -61,6 +60,7 @@
     <message-session />
     <timer-session />
     <history-session />
+    <transaction />
     <hibernate-session />
     <identity-session />
   </transaction-context>

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java	2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1,85 @@
+/*
+ * 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.JbpmException;
+import org.jbpm.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);
+    }
+  }
+}


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

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java	2009-04-07 07:58:24 UTC (rev 4472)
@@ -22,6 +22,7 @@
 package org.jbpm.pvm.internal.wire.binding;
 
 import org.jbpm.env.Transaction;
+import org.jbpm.pvm.internal.tx.JtaTransaction;
 import org.jbpm.pvm.internal.tx.StandardTransaction;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
 import org.jbpm.pvm.internal.xml.Parse;
@@ -50,6 +51,8 @@
     
     if ("standard".equals(type)) {
       transactionDescriptor = new ObjectDescriptor(StandardTransaction.class);
+    } else if ("jta".equals(type)){
+      transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
     } else {
       parse.addProblem("unsupported transaction type: "+type);
     }

Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -52,7 +52,6 @@
   </process-engine-context>
 
   <transaction-context>
-    <transaction />
     <repository-session />
     <pvm-db-session />
     <job-db-session />
@@ -60,6 +59,7 @@
     <message-session />
     <timer-session />
     <history-session />
+    <transaction />
     <hibernate-session />
     <identity-session />
   </transaction-context>

Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
   </process-engine-context>
 
   <transaction-context>
-    <transaction />
     <repository-session />
     <pvm-db-session />
     <job-db-session />
@@ -61,6 +60,7 @@
     <message-session />
     <timer-session />
     <history-session />
+    <transaction />
     <hibernate-session />
     <identity-session />
   </transaction-context>




More information about the jbpm-commits mailing list