You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/08/22 19:29:46 UTC

svn commit: r1619871 - in /ofbiz/branches/framework-api-cleanup/framework: entity/src/org/ofbiz/entity/connection/ entity/src/org/ofbiz/entity/jdbc/ entity/src/org/ofbiz/entity/transaction/ service/src/org/ofbiz/service/

Author: jacopoc
Date: Fri Aug 22 17:29:46 2014
New Revision: 1619871

URL: http://svn.apache.org/r1619871
Log:
Renamed the class org.ofbiz.entity.transaction.TransactionFactory into org.ofbiz.entity.transaction.TransactionFactoryLoader: this name better describe its purpose.

Added:
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryLoader.java
      - copied, changed from r1619868, ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java
Removed:
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java
Modified:
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java
    ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
    ofbiz/branches/framework-api-cleanup/framework/service/src/org/ofbiz/service/ServiceSynchronization.java

Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Fri Aug 22 17:29:46 2014
@@ -44,7 +44,7 @@ import org.ofbiz.entity.config.EntityCon
 import org.ofbiz.entity.config.model.InlineJdbc;
 import org.ofbiz.entity.config.model.JdbcElement;
 import org.ofbiz.entity.datasource.GenericHelperInfo;
-import org.ofbiz.entity.transaction.TransactionFactory;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.entity.transaction.TransactionUtil;
 
 /**
@@ -68,7 +68,7 @@ public class DBCPConnectionFactory imple
         }
         InlineJdbc jdbcElement = (InlineJdbc) abstractJdbc;
         // connection properties
-        TransactionManager txMgr = TransactionFactory.getInstance().getTransactionManager();
+        TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
         String driverName = jdbcElement.getJdbcDriver();
 
         String jdbcUri = helperInfo.getOverrideJdbcUri(jdbcElement.getJdbcUri());

Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Fri Aug 22 17:29:46 2014
@@ -32,7 +32,7 @@ import org.ofbiz.entity.config.EntityCon
 import org.ofbiz.entity.config.model.JdbcElement;
 import org.ofbiz.entity.connection.ConnectionFactoryInterface;
 import org.ofbiz.entity.datasource.GenericHelperInfo;
-import org.ofbiz.entity.transaction.TransactionFactory;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 
 /**
  * ConnectionFactory - central source for JDBC connections
@@ -84,7 +84,7 @@ public class ConnectionFactory {
     public static Connection getConnection(String helperName) throws SQLException, GenericEntityException {
         // Debug.logVerbose("Getting a connection", module);
 
-        Connection con = TransactionFactory.getInstance().getConnection(new GenericHelperInfo(null, helperName));
+        Connection con = TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, helperName));
         if (con == null) {
             Debug.logError("******* ERROR: No database connection found for helperName \"" + helperName + "\"", module);
         }
@@ -94,7 +94,7 @@ public class ConnectionFactory {
     public static Connection getConnection(GenericHelperInfo helperInfo) throws SQLException, GenericEntityException {
         // Debug.logVerbose("Getting a connection", module);
 
-        Connection con = TransactionFactory.getInstance().getConnection(helperInfo);
+        Connection con = TransactionFactoryLoader.getInstance().getConnection(helperInfo);
         if (con == null) {
             Debug.logError("******* ERROR: No database connection found for helperName \"" + helperInfo.getHelperFullName() + "\"", module);
         }

Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java Fri Aug 22 17:29:46 2014
@@ -47,7 +47,7 @@ public abstract class GenericXaResource 
      * @throws XAException
      */
     public void enlist() throws XAException {
-        TransactionManager tm = TransactionFactory.getInstance().getTransactionManager();
+        TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
         try {
             if (tm != null && tm.getStatus() == Status.STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();

Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryInterface.java Fri Aug 22 17:29:46 2014
@@ -27,7 +27,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.datasource.GenericHelperInfo;
 
 /**
- * TransactionFactory - central source for JTA objects
+ * TransactionFactoryLoader - central source for JTA objects
  */
 public interface TransactionFactoryInterface {
 

Copied: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryLoader.java (from r1619868, ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java)
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryLoader.java?p2=ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryLoader.java&p1=ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java&r1=1619868&r2=1619871&rev=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactoryLoader.java Fri Aug 22 17:29:46 2014
@@ -23,11 +23,11 @@ import org.ofbiz.entity.GenericEntityCon
 import org.ofbiz.entity.config.EntityConfigUtil;
 
 /**
- * TransactionFactory - central source for JTA objects
+ * TransactionFactoryLoader - utility class that loads the transaction manager and provides to client code a reference to it (TransactionFactoryInterface)
  */
-public class TransactionFactory {
+public class TransactionFactoryLoader {
 
-    public static final String module = TransactionFactory.class.getName();
+    public static final String module = TransactionFactoryLoader.class.getName();
     private static final TransactionFactoryInterface txFactory = createTransactionFactoryInterface();
 
     private static TransactionFactoryInterface createTransactionFactoryInterface() {

Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Fri Aug 22 17:29:46 2014
@@ -133,7 +133,7 @@ public class TransactionUtil implements 
      * a transaction is already in place it will return false and do nothing.
      */
     public static boolean begin(int timeout) throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 int currentStatus = ut.getStatus();
@@ -221,7 +221,7 @@ public class TransactionUtil implements 
     /** Gets the status of the transaction in the current thread IF
      * transactions are available, otherwise returns STATUS_NO_TRANSACTION */
     public static int getStatus() throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 return ut.getStatus();
@@ -258,7 +258,7 @@ public class TransactionUtil implements 
 
     /** Commits the transaction in the current thread IF transactions are available */
     public static void commit() throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
 
         if (ut != null) {
             try {
@@ -330,7 +330,7 @@ public class TransactionUtil implements 
 
     /** Rolls back transaction in the current thread IF transactions are available */
     public static void rollback(Throwable causeThrowable) throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
 
         if (ut != null) {
             try {
@@ -369,7 +369,7 @@ public class TransactionUtil implements 
 
     /** Makes a rollback the only possible outcome of the transaction in the current thread IF transactions are available */
     public static void setRollbackOnly(String causeMessage, Throwable causeThrowable) throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 int status = ut.getStatus();
@@ -403,7 +403,7 @@ public class TransactionUtil implements 
     public static Transaction suspend() throws GenericTransactionException {
         try {
             if (TransactionUtil.getStatus() != STATUS_NO_TRANSACTION) {
-                TransactionManager txMgr = TransactionFactory.getInstance().getTransactionManager();
+                TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
                 if (txMgr != null) {
                     pushTransactionBeginStackSave(clearTransactionBeginStack());
                     pushSetRollbackOnlyCauseSave(clearSetRollbackOnlyCause());
@@ -426,7 +426,7 @@ public class TransactionUtil implements 
         if (parentTx == null) {
             return;
         }
-        TransactionManager txMgr = TransactionFactory.getInstance().getTransactionManager();
+        TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
         try {
             if (txMgr != null) {
                 setTransactionBeginStack(popTransactionBeginStackSave());
@@ -455,7 +455,7 @@ public class TransactionUtil implements 
 
     /** Sets the timeout of the transaction in the current thread IF transactions are available */
     public static void setTransactionTimeout(int seconds) throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getInstance().getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 ut.setTransactionTimeout(seconds);
@@ -485,7 +485,7 @@ public class TransactionUtil implements 
         }
 
         try {
-            TransactionManager tm = TransactionFactory.getInstance().getTransactionManager();
+            TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
             if (tm != null && tm.getStatus() == STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();
                 if (tx != null) {
@@ -565,7 +565,7 @@ public class TransactionUtil implements 
         }
 
         try {
-            TransactionManager tm = TransactionFactory.getInstance().getTransactionManager();
+            TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
             if (tm != null && tm.getStatus() == STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();
                 if (tx != null) {

Modified: ofbiz/branches/framework-api-cleanup/framework/service/src/org/ofbiz/service/ServiceSynchronization.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/service/src/org/ofbiz/service/ServiceSynchronization.java?rev=1619871&r1=1619870&r2=1619871&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/service/src/org/ofbiz/service/ServiceSynchronization.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/service/src/org/ofbiz/service/ServiceSynchronization.java Fri Aug 22 17:29:46 2014
@@ -14,7 +14,7 @@ import javax.transaction.Transaction;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.transaction.GenericTransactionException;
-import org.ofbiz.entity.transaction.TransactionFactory;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.entity.transaction.TransactionUtil;
 
 /**
@@ -49,7 +49,7 @@ public class ServiceSynchronization impl
     protected static ServiceSynchronization getInstance() throws GenericServiceException {
         ServiceSynchronization sync = null;
         try {
-            Transaction transaction = TransactionFactory.getInstance().getTransactionManager().getTransaction();
+            Transaction transaction = TransactionFactoryLoader.getInstance().getTransactionManager().getTransaction();
             synchronized (transaction) {
                 sync = syncingleton.get(transaction);
                 if (sync == null) {