svn commit: r1620538 [2/2] - in /ofbiz/trunk: ./ applications/product/src/org/ofbiz/product/product/ framework/common/src/org/ofbiz/common/ framework/entity/config/ framework/entity/dtd/ framework/entity/src/org/ofbiz/entity/ framework/entity/src/org/o...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1620538 [2/2] - in /ofbiz/trunk: ./ applications/product/src/org/ofbiz/product/product/ framework/common/src/org/ofbiz/common/ framework/entity/config/ framework/entity/dtd/ framework/entity/src/org/ofbiz/entity/ framework/entity/src/org/o...

jacopoc
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Tue Aug 26 09:16:52 2014
@@ -51,7 +51,10 @@ import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.Datasource;
+import org.ofbiz.entity.config.model.EntityConfig;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.jdbc.CursorConnection;
 
 /**
  * <p>Transaction Utility to help with some common transaction tasks
@@ -60,43 +63,26 @@ import org.ofbiz.entity.config.EntityCon
 public class TransactionUtil implements Status {
     // Debug module name
     public static final String module = TransactionUtil.class.getName();
-    public static Map<Xid, DebugXaResource> debugResMap = Collections.<Xid, DebugXaResource>synchronizedMap(new HashMap<Xid, DebugXaResource>());
 
     private static ThreadLocal<List<Transaction>> suspendedTxStack = new ThreadLocal<List<Transaction>>();
     private static ThreadLocal<List<Exception>> suspendedTxLocationStack = new ThreadLocal<List<Exception>>();
     private static ThreadLocal<Exception> transactionBeginStack = new ThreadLocal<Exception>();
     private static ThreadLocal<List<Exception>> transactionBeginStackSave = new ThreadLocal<List<Exception>>();
-    private static Map<Long, Exception> allThreadsTransactionBeginStack = Collections.<Long, Exception>synchronizedMap(new HashMap<Long, Exception>());
-    private static Map<Long, List<Exception>> allThreadsTransactionBeginStackSave = Collections.<Long, List<Exception>>synchronizedMap(new HashMap<Long, List<Exception>>());
     private static ThreadLocal<RollbackOnlyCause> setRollbackOnlyCause = new ThreadLocal<RollbackOnlyCause>();
     private static ThreadLocal<List<RollbackOnlyCause>> setRollbackOnlyCauseSave = new ThreadLocal<List<RollbackOnlyCause>>();
     private static ThreadLocal<Timestamp> transactionStartStamp = new ThreadLocal<Timestamp>();
     private static ThreadLocal<Timestamp> transactionLastNowStamp = new ThreadLocal<Timestamp>();
 
-    @Deprecated
-    public static <V> V doNewTransaction(String ifErrorMessage, Callable<V> callable) throws GenericEntityException {
-        return noTransaction(inTransaction(callable, ifErrorMessage, 0, true)).call();
-    }
-
-    @Deprecated
-    public static <V> V doNewTransaction(String ifErrorMessage, boolean printException, Callable<V> callable) throws GenericEntityException {
-        return noTransaction(inTransaction(callable, ifErrorMessage, 0, printException)).call();
-    }
+    private static final boolean debugResources = readDebugResources();
+    public static Map<Xid, DebugXaResource> debugResMap = Collections.<Xid, DebugXaResource>synchronizedMap(new HashMap<Xid, DebugXaResource>());
+    // in order to improve performance allThreadsTransactionBeginStack and allThreadsTransactionBeginStackSave are only maintained when logging level INFO is on
+    private static Map<Long, Exception> allThreadsTransactionBeginStack = Collections.<Long, Exception>synchronizedMap(new HashMap<Long, Exception>());
+    private static Map<Long, List<Exception>> allThreadsTransactionBeginStackSave = Collections.<Long, List<Exception>>synchronizedMap(new HashMap<Long, List<Exception>>());
 
     public static <V> V doNewTransaction(Callable<V> callable, String ifErrorMessage, int timeout, boolean printException) throws GenericEntityException {
         return noTransaction(inTransaction(callable, ifErrorMessage, timeout, printException)).call();
     }
 
-    @Deprecated
-    public static <V> V doTransaction(String ifErrorMessage, Callable<V> callable) throws GenericEntityException {
-        return inTransaction(callable, ifErrorMessage, 0, true).call();
-    }
-
-    @Deprecated
-    public static <V> V doTransaction(String ifErrorMessage, boolean printException, Callable<V> callable) throws GenericEntityException {
-        return inTransaction(callable, ifErrorMessage, 0, printException).call();
-    }
-
     public static <V> V doTransaction(Callable<V> callable, String ifErrorMessage, int timeout, boolean printException) throws GenericEntityException {
         return inTransaction(callable, ifErrorMessage, timeout, printException).call();
     }
@@ -130,24 +116,24 @@ 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.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 int currentStatus = ut.getStatus();
                 if (Debug.verboseOn()) {
-                    Debug.logVerbose("[TransactionUtil.begin] current status : " + getTransactionStateString(currentStatus), module);
+                    Debug.logVerbose("Current status : " + getTransactionStateString(currentStatus), module);
                 }
                 if (currentStatus == Status.STATUS_ACTIVE) {
                     if (Debug.verboseOn()) {
-                        Debug.logVerbose("[TransactionUtil.begin] active transaction in place, so no transaction begun", module);
+                        Debug.logVerbose("Active transaction in place, so no transaction begun", module);
                     }
                     return false;
                 } else if (currentStatus == Status.STATUS_MARKED_ROLLBACK) {
                     Exception e = getTransactionBeginStack();
                     if (e != null) {
-                        Debug.logWarning(e, "[TransactionUtil.begin] active transaction marked for rollback in place, so no transaction begun; this stack trace shows when the exception began: ", module);
+                        Debug.logWarning(e, "Active transaction marked for rollback in place, so no transaction begun; this stack trace shows when the exception began: ", module);
                     } else {
-                        Debug.logWarning("[TransactionUtil.begin] active transaction marked for rollback in place, so no transaction begun", module);
+                        Debug.logWarning("Active transaction marked for rollback in place, so no transaction begun", module);
                     }
 
                     RollbackOnlyCause roc = getSetRollbackOnlyCause();
@@ -169,7 +155,7 @@ public class TransactionUtil implements
                 setTransactionBeginStack();
 
                 // initialize the debug resource
-                if (EntityConfigUtil.isDebugXAResource()) {
+                if (debugResources()) {
                     DebugXaResource dxa = new DebugXaResource();
                     try {
                         dxa.enlist();
@@ -180,16 +166,12 @@ public class TransactionUtil implements
 
                 return true;
             } catch (NotSupportedException e) {
-                //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
                 throw new GenericTransactionException("Not Supported error, could not begin transaction (probably a nesting problem)", e);
             } catch (SystemException e) {
-                //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
                 throw new GenericTransactionException("System error, could not begin transaction", e);
-            } catch (GenericEntityConfException e) {
-                throw new GenericTransactionException("Configuration error, could not begin transaction", e);
             }
         } else {
-            if (Debug.infoOn()) Debug.logInfo("[TransactionUtil.begin] no user transaction, so no transaction begun", module);
+            if (Debug.infoOn()) Debug.logInfo("No user transaction, so no transaction begun", module);
             return false;
         }
     }
@@ -199,14 +181,14 @@ public class TransactionUtil implements
         if (timeout > 0) {
             ut.setTransactionTimeout(timeout);
             if (Debug.verboseOn()) {
-                Debug.logVerbose("[TransactionUtil.begin] set transaction timeout to : " + timeout + " seconds", module);
+                Debug.logVerbose("Set transaction timeout to : " + timeout + " seconds", module);
             }
         }
 
         // begin the transaction
         ut.begin();
         if (Debug.verboseOn()) {
-            Debug.logVerbose("[TransactionUtil.begin] transaction begun", module);
+            Debug.logVerbose("Transaction begun", module);
         }
 
         // reset the timeout to the default
@@ -218,7 +200,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.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 return ut.getStatus();
@@ -255,12 +237,12 @@ public class TransactionUtil implements
 
     /** Commits the transaction in the current thread IF transactions are available */
     public static void commit() throws GenericTransactionException {
-        UserTransaction ut = TransactionFactory.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
 
         if (ut != null) {
             try {
                 int status = ut.getStatus();
-                Debug.logVerbose("[TransactionUtil.commit] current status : " + getTransactionStateString(status), module);
+                Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
 
                 if (status != STATUS_NO_TRANSACTION && status != STATUS_COMMITTING && status != STATUS_COMMITTED && status != STATUS_ROLLING_BACK && status != STATUS_ROLLEDBACK) {
                     ut.commit();
@@ -271,9 +253,9 @@ public class TransactionUtil implements
                     clearTransactionBeginStack();
                     clearSetRollbackOnlyCause();
 
-                    Debug.logVerbose("[TransactionUtil.commit] transaction committed", module);
+                    Debug.logVerbose("Transaction committed", module);
                 } else {
-                    Debug.logWarning("[TransactionUtil.commit] Not committing transaction, status is " + getStatusString(), module);
+                    Debug.logWarning("Not committing transaction, status is " + getStatusString(), module);
                 }
             } catch (RollbackException e) {
                 RollbackOnlyCause rollbackOnlyCause = getSetRollbackOnlyCause();
@@ -304,7 +286,7 @@ public class TransactionUtil implements
                 throw new GenericTransactionException("System error, could not commit transaction: " + t.toString(), t);
             }
         } else {
-            Debug.logInfo("[TransactionUtil.commit] UserTransaction is null, not commiting", module);
+            Debug.logInfo("UserTransaction is null, not committing", module);
         }
     }
 
@@ -327,12 +309,12 @@ 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.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
 
         if (ut != null) {
             try {
                 int status = ut.getStatus();
-                Debug.logVerbose("[TransactionUtil.rollback] current status : " + getTransactionStateString(status), module);
+                Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
 
                 if (status != STATUS_NO_TRANSACTION) {
                     //if (Debug.infoOn()) Thread.dumpStack();
@@ -348,9 +330,9 @@ public class TransactionUtil implements
                     clearSetRollbackOnlyCause();
 
                     ut.rollback();
-                    Debug.logInfo("[TransactionUtil.rollback] transaction rolled back", module);
+                    Debug.logInfo("Transaction rolled back", module);
                 } else {
-                    Debug.logWarning("[TransactionUtil.rollback] transaction not rolled back, status is STATUS_NO_TRANSACTION", module);
+                    Debug.logWarning("Transaction not rolled back, status is STATUS_NO_TRANSACTION", module);
                 }
             } catch (IllegalStateException e) {
                 Throwable t = e.getCause() == null ? e : e.getCause();
@@ -360,30 +342,30 @@ public class TransactionUtil implements
                 throw new GenericTransactionException("System error, could not rollback transaction: " + t.toString(), t);
             }
         } else {
-            Debug.logInfo("[TransactionUtil.rollback] No UserTransaction, transaction not rolled back", module);
+            Debug.logInfo("No UserTransaction, transaction not rolled back", module);
         }
     }
 
     /** 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.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 int status = ut.getStatus();
-                Debug.logVerbose("[TransactionUtil.setRollbackOnly] current code : " + getTransactionStateString(status), module);
+                Debug.logVerbose("Current code : " + getTransactionStateString(status), module);
 
                 if (status != STATUS_NO_TRANSACTION) {
                     if (status != STATUS_MARKED_ROLLBACK) {
                         if (Debug.warningOn()) {
-                            Debug.logWarning(new Exception(causeMessage), "[TransactionUtil.setRollbackOnly] Calling transaction setRollbackOnly; this stack trace shows where this is happening:", module);
+                            Debug.logWarning(new Exception(causeMessage), "Calling transaction setRollbackOnly; this stack trace shows where this is happening:", module);
                         }
                         ut.setRollbackOnly();
                         setSetRollbackOnlyCause(causeMessage, causeThrowable);
                     } else {
-                        Debug.logInfo("[TransactionUtil.setRollbackOnly] transaction rollback only not set, rollback only is already set.", module);
+                        Debug.logInfo("Transaction rollback only not set, rollback only is already set.", module);
                     }
                 } else {
-                    Debug.logWarning("[TransactionUtil.setRollbackOnly] transaction rollback only not set, status is STATUS_NO_TRANSACTION", module);
+                    Debug.logWarning("Transaction rollback only not set, status is STATUS_NO_TRANSACTION", module);
                 }
             } catch (IllegalStateException e) {
                 Throwable t = e.getCause() == null ? e : e.getCause();
@@ -393,14 +375,14 @@ public class TransactionUtil implements
                 throw new GenericTransactionException("System error, could not set rollback only on transaction: " + t.toString(), t);
             }
         } else {
-            Debug.logInfo("[TransactionUtil.setRollbackOnly] No UserTransaction, transaction rollback only not set", module);
+            Debug.logInfo("No UserTransaction, transaction rollback only not set", module);
         }
     }
 
     public static Transaction suspend() throws GenericTransactionException {
         try {
             if (TransactionUtil.getStatus() != STATUS_NO_TRANSACTION) {
-                TransactionManager txMgr = TransactionFactory.getTransactionManager();
+                TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
                 if (txMgr != null) {
                     pushTransactionBeginStackSave(clearTransactionBeginStack());
                     pushSetRollbackOnlyCauseSave(clearSetRollbackOnlyCause());
@@ -423,7 +405,7 @@ public class TransactionUtil implements
         if (parentTx == null) {
             return;
         }
-        TransactionManager txMgr = TransactionFactory.getTransactionManager();
+        TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
         try {
             if (txMgr != null) {
                 setTransactionBeginStack(popTransactionBeginStackSave());
@@ -432,18 +414,6 @@ public class TransactionUtil implements
                 removeSuspendedTransaction(parentTx);
             }
         } catch (InvalidTransactionException e) {
-            /* NOTE: uncomment this for Weblogic Application Server
-            // this is a work-around for non-standard Weblogic functionality; for more information see: http://www.onjava.com/pub/a/onjava/2005/07/20/transactions.html?page=3
-            if (txMgr instanceof weblogic.transaction.ClientTransactionManager) {
-                // WebLogic 8 and above
-                ((weblogic.transaction.ClientTransactionManager) txMgr).forceResume(parentTx);
-            } else if (txMgr instanceof weblogic.transaction.TransactionManager) {
-                // WebLogic 7
-                ((weblogic.transaction.TransactionManager) txMgr).forceResume(parentTx);
-            } else {
-                throw new GenericTransactionException("System error, could not resume transaction", e);
-            }
-            */
             throw new GenericTransactionException("System error, could not resume transaction", e);
         } catch (SystemException e) {
             throw new GenericTransactionException("System error, could not resume transaction", e);
@@ -452,7 +422,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.getUserTransaction();
+        UserTransaction ut = TransactionFactoryLoader.getInstance().getUserTransaction();
         if (ut != null) {
             try {
                 ut.setTransactionTimeout(seconds);
@@ -482,7 +452,7 @@ public class TransactionUtil implements
         }
 
         try {
-            TransactionManager tm = TransactionFactory.getTransactionManager();
+            TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
             if (tm != null && tm.getStatus() == STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();
                 if (tx != null) {
@@ -538,21 +508,26 @@ public class TransactionUtil implements
         }
     }
 
-    public static boolean debugResources() throws GenericEntityConfException {
-        return EntityConfigUtil.isDebugXAResource();
+    private static boolean readDebugResources() {
+        try {
+            return EntityConfig.getInstance().getDebugXaResources().getValue();
+        } catch (GenericEntityConfException gece) {
+            Debug.logWarning(gece, module);
+        }
+        return false;
+    }
+
+    public static boolean debugResources() {
+        return debugResources;
     }
 
     public static void logRunningTx() {
-        try {
-            if (EntityConfigUtil.isDebugXAResource()) {
-                if (UtilValidate.isNotEmpty(debugResMap)) {
-                    for (DebugXaResource dxa: debugResMap.values()) {
-                        dxa.log();
-                    }
+        if (debugResources()) {
+            if (UtilValidate.isNotEmpty(debugResMap)) {
+                for (DebugXaResource dxa: debugResMap.values()) {
+                    dxa.log();
                 }
             }
-        } catch (GenericEntityConfException e) {
-            Debug.logWarning("Exception thrown while logging: " + e, module);
         }
     }
 
@@ -562,7 +537,7 @@ public class TransactionUtil implements
         }
 
         try {
-            TransactionManager tm = TransactionFactory.getTransactionManager();
+            TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
             if (tm != null && tm.getStatus() == STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();
                 if (tx != null) {
@@ -570,10 +545,8 @@ public class TransactionUtil implements
                 }
             }
         } catch (RollbackException e) {
-            //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
             throw new GenericTransactionException("Roll Back error, could not register synchronization in transaction even though transactions are available, current transaction rolled back", e);
         } catch (SystemException e) {
-            //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
             throw new GenericTransactionException("System error, could not register synchronization in transaction even though transactions are available", e);
         }
     }
@@ -581,7 +554,7 @@ public class TransactionUtil implements
     // =======================================
     // SUSPENDED TRANSACTIONS
     // =======================================
-    /** BE VERY CARFUL WHERE YOU CALL THIS!! */
+    /** BE VERY CAREFUL WHERE YOU CALL THIS!! */
     public static int cleanSuspendedTransactions() throws GenericTransactionException {
         Transaction trans = null;
         int num = 0;
@@ -666,23 +639,26 @@ public class TransactionUtil implements
         }
         el.add(0, e);
 
-        Long curThreadId = Thread.currentThread().getId();
-        List<Exception> ctEl = allThreadsTransactionBeginStackSave.get(curThreadId);
-        if (ctEl == null) {
-            ctEl = new LinkedList<Exception>();
-            allThreadsTransactionBeginStackSave.put(curThreadId, ctEl);
+        if (Debug.infoOn()) {
+            Long curThreadId = Thread.currentThread().getId();
+            List<Exception> ctEl = allThreadsTransactionBeginStackSave.get(curThreadId);
+            if (ctEl == null) {
+                ctEl = new LinkedList<Exception>();
+                allThreadsTransactionBeginStackSave.put(curThreadId, ctEl);
+            }
+            ctEl.add(0, e);
         }
-        ctEl.add(0, e);
     }
 
     private static Exception popTransactionBeginStackSave() {
-        // do the unofficial all threads Map one first, and don't do a real return
-        Long curThreadId = Thread.currentThread().getId();
-        List<Exception> ctEl = allThreadsTransactionBeginStackSave.get(curThreadId);
-        if (UtilValidate.isNotEmpty(ctEl)) {
-            ctEl.remove(0);
+        if (Debug.infoOn()) {
+            // do the unofficial all threads Map one first, and don't do a real return
+            Long curThreadId = Thread.currentThread().getId();
+            List<Exception> ctEl = allThreadsTransactionBeginStackSave.get(curThreadId);
+            if (UtilValidate.isNotEmpty(ctEl)) {
+                ctEl.remove(0);
+            }
         }
-
         // then do the more reliable ThreadLocal one
         List<Exception> el = transactionBeginStackSave.get();
         if (UtilValidate.isNotEmpty(el)) {
@@ -752,14 +728,17 @@ public class TransactionUtil implements
             Debug.logWarning(e2, "In setTransactionBeginStack a stack placeholder was already in place, here is the current location: ", module);
         }
         transactionBeginStack.set(newExc);
-        Long curThreadId = Thread.currentThread().getId();
-        allThreadsTransactionBeginStack.put(curThreadId, newExc);
+        if (Debug.infoOn()) {
+            Long curThreadId = Thread.currentThread().getId();
+            allThreadsTransactionBeginStack.put(curThreadId, newExc);
+        }
     }
 
     private static Exception clearTransactionBeginStack() {
-        Long curThreadId = Thread.currentThread().getId();
-        allThreadsTransactionBeginStack.remove(curThreadId);
-
+        if (Debug.infoOn()) {
+            Long curThreadId = Thread.currentThread().getId();
+            allThreadsTransactionBeginStack.remove(curThreadId);
+        }
         Exception e = transactionBeginStack.get();
         if (e == null) {
             Exception e2 = new Exception("Current Stack Trace");
@@ -1051,4 +1030,21 @@ public class TransactionUtil implements
             }
         }
     }
+
+    public static Connection getCursorConnection(GenericHelperInfo helperInfo, Connection con) {
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
+        if (datasourceInfo == null) {
+            Debug.logWarning("Could not find configuration for " + helperInfo.getHelperBaseName() + " datasource.", module);
+            return con;
+        } else if (datasourceInfo.getUseProxyCursor()) {
+            try {
+                if (datasourceInfo.getResultFetchSize() > 1)
+                    con = CursorConnection.newCursorConnection(con, datasourceInfo.getProxyCursorName(), datasourceInfo.getResultFetchSize());
+            } catch (Exception ex) {
+                Debug.logWarning(ex, "Error creating the cursor connection proxy " + helperInfo.getHelperBaseName() + " datasource.", module);
+            }
+        }
+        return con;
+    }
+
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Tue Aug 26 09:16:52 2014
@@ -36,8 +36,8 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.Datasource;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.config.model.EntityDataReader;
 import org.ofbiz.entity.config.model.ReadData;
 import org.ofbiz.entity.config.model.Resource;
@@ -58,7 +58,7 @@ public class EntityDataLoader {
     public static String getPathsString(String helperName) {
         StringBuilder pathBuffer = new StringBuilder();
         if (UtilValidate.isNotEmpty(helperName)) {
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+            Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
             for (SqlLoadPath sqlLoadPath : datasourceInfo.getSqlLoadPathList()) {
                 String prependEnv = sqlLoadPath.getPrependEnv();
                 pathBuffer.append(pathBuffer.length() == 0 ? "" : ";");
@@ -73,12 +73,12 @@ public class EntityDataLoader {
     }
 
     public static List<URL> getUrlList(String helperName) {
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
         return getUrlList(helperName, null, datasourceInfo.getReadDataList());
     }
 
     public static List<URL> getUrlList(String helperName, String componentName) {
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
         return getUrlList(helperName, componentName, datasourceInfo.getReadDataList());
     }
 
@@ -113,7 +113,7 @@ public class EntityDataLoader {
                 // get all of the main resource model stuff, ie specified in the entityengine.xml file
                 EntityDataReader entityDataReaderInfo = null;
                 try {
-                    entityDataReaderInfo = EntityConfigUtil.getEntityDataReader(readerName);
+                    entityDataReaderInfo = EntityConfig.getInstance().getEntityDataReader(readerName);
                     if (entityDataReaderInfo == null) {
                         // create a reader name defined at runtime
                         Debug.logInfo("Could not find entity-data-reader named: " + readerName + ". Creating a new reader with this name. ", module);
@@ -124,7 +124,7 @@ public class EntityDataLoader {
                 }
                 if (entityDataReaderInfo != null) {
                     for (Resource resourceElement: entityDataReaderInfo.getResourceList()) {
-                        ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation());
+                        ResourceHandler handler = new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation());
                         try {
                             urlList.add(handler.getURL());
                         } catch (GenericConfigException e) {
@@ -205,7 +205,7 @@ public class EntityDataLoader {
     }
 
     public static List<URL> getUrlByComponentList(String helperName, List<String> components) {
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
         List<String> readerNames = new LinkedList<String>();
         for (ReadData readerInfo :  datasourceInfo.getReadDataList()) {
             String readerName = readerInfo.getReaderName();

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java Tue Aug 26 09:16:52 2014
@@ -32,10 +32,10 @@ import org.ofbiz.base.util.UtilPropertie
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.datasource.GenericHelperInfo;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.transaction.GenericTransactionException;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.entity.transaction.TransactionUtil;
 
 /**
@@ -204,7 +204,7 @@ public class SequenceUtil {
                             ResultSet rs = null;
 
                             try {
-                                connection = ConnectionFactory.getConnection(SequenceUtil.this.helperInfo);
+                                connection = TransactionFactoryLoader.getInstance().getConnection(SequenceUtil.this.helperInfo);
                             } catch (SQLException sqle) {
                                 Debug.logWarning("[SequenceUtil.SequenceBank.fillBank]: Unable to esablish a connection with the database... Error was:" + sqle.toString(), module);
                                 throw sqle;

Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java Tue Aug 26 09:16:52 2014
@@ -38,7 +38,6 @@ import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.*;
 import org.w3c.dom.Element;
 
@@ -64,7 +63,7 @@ public class EntityEcaUtil {
     public static String getEntityEcaReaderName(String delegatorName) {
         DelegatorElement delegatorInfo = null;
         try {
-            delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
+            delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
         } catch (GenericEntityConfException e) {
             Debug.logWarning(e, "Exception thrown while getting field type config: ", module);
         }
@@ -78,7 +77,7 @@ public class EntityEcaUtil {
     protected static void readConfig(String entityEcaReaderName, Map<String, Map<String, List<EntityEcaRule>>> ecaCache) {
         EntityEcaReader entityEcaReaderInfo = null;
         try {
-            entityEcaReaderInfo = EntityConfigUtil.getEntityEcaReader(entityEcaReaderName);
+            entityEcaReaderInfo = EntityConfig.getInstance().getEntityEcaReader(entityEcaReaderName);
         } catch (GenericEntityConfException e) {
             Debug.logError(e, "Exception thrown while getting entity-eca-reader config with name: " + entityEcaReaderName, module);
         }
@@ -89,7 +88,7 @@ public class EntityEcaUtil {
 
         List<Future<List<EntityEcaRule>>> futures = FastList.newInstance();
         for (Resource eecaResourceElement : entityEcaReaderInfo.getResourceList()) {
-            ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, eecaResourceElement.getLoader(), eecaResourceElement.getLocation());
+            ResourceHandler handler = new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, eecaResourceElement.getLoader(), eecaResourceElement.getLocation());
             futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(createEcaLoaderCallable(handler)));
         }
 

Modified: ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java (original)
+++ ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java Tue Aug 26 09:16:52 2014
@@ -32,15 +32,15 @@ import org.apache.geronimo.transaction.m
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.config.model.Datasource;
-import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.datasource.GenericHelperInfo;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
-import org.ofbiz.entity.transaction.TransactionFactoryInterface;
+import org.ofbiz.entity.jdbc.ConnectionFactoryLoader;
+import org.ofbiz.entity.transaction.TransactionFactory;
 
 /**
  * GeronimoTransactionFactory
  */
-public class GeronimoTransactionFactory implements TransactionFactoryInterface {
+public class GeronimoTransactionFactory implements TransactionFactory {
 
     public static final String module = GeronimoTransactionFactory.class.getName();
 
@@ -59,14 +59,14 @@ public class GeronimoTransactionFactory
     }
 
     /*
-     * @see org.ofbiz.entity.transaction.TransactionFactoryInterface#getTransactionManager()
+     * @see org.ofbiz.entity.transaction.TransactionFactory#getTransactionManager()
      */
     public TransactionManager getTransactionManager() {
         return geronimoTransactionManager;
     }
 
     /*
-     * @see org.ofbiz.entity.transaction.TransactionFactoryInterface#getUserTransaction()
+     * @see org.ofbiz.entity.transaction.TransactionFactory#getUserTransaction()
      */
     public UserTransaction getUserTransaction() {
         return geronimoTransactionManager;
@@ -77,10 +77,10 @@ public class GeronimoTransactionFactory
     }
 
     public Connection getConnection(GenericHelperInfo helperInfo) throws SQLException, GenericEntityException {
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperInfo.getHelperBaseName());
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
 
         if (datasourceInfo != null && datasourceInfo.getInlineJdbc() != null) {
-            return ConnectionFactory.getManagedConnection(helperInfo, datasourceInfo.getInlineJdbc());
+            return ConnectionFactoryLoader.getInstance().getConnection(helperInfo, datasourceInfo.getInlineJdbc());
         } else {
             Debug.logError("Geronimo is the configured transaction manager but no inline-jdbc element was specified in the " + helperInfo.getHelperBaseName() + " datasource. Please check your configuration", module);
             return null;
@@ -88,7 +88,7 @@ public class GeronimoTransactionFactory
     }
 
     public void shutdown() {
-        ConnectionFactory.closeAllManagedConnections();
+        ConnectionFactoryLoader.getInstance().closeAll();
         /*
         if (transactionContextManager != null) {
             // TODO: need to do anything for this?

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Tue Aug 26 09:16:52 2014
@@ -40,8 +40,8 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.DelegatorElement;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.config.ServiceConfigUtil;
 import org.ofbiz.service.config.model.GlobalServices;
@@ -84,7 +84,7 @@ public class DispatchContext implements
             if (delegator != null) {
                 DelegatorElement delegatorInfo = null;
                 try {
-                    delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName());
+                    delegatorInfo = EntityConfig.getInstance().getDelegator(delegator.getDelegatorBaseName());
                 } catch (GenericEntityConfException e) {
                     Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
                 }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Tue Aug 26 09:16:52 2014
@@ -34,11 +34,9 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilTimer;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
-import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.DebugXaResource;
@@ -58,7 +56,6 @@ import org.ofbiz.service.jms.JmsListener
 import org.ofbiz.service.job.JobManager;
 import org.ofbiz.service.job.JobManagerException;
 import org.ofbiz.service.semaphore.ServiceSemaphore;
-import org.w3c.dom.Element;
 
 import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
 
@@ -563,9 +560,6 @@ public class ServiceDispatcher {
         } catch (GenericTransactionException te) {
             Debug.logError(te, "Problems with the transaction", module);
             throw new GenericServiceException("Problems with the transaction.", te.getNested());
-        } catch (GenericEntityConfException e) {
-            Debug.logError(e, "Problems with the transaction", module);
-            throw new GenericServiceException("Problems with the transaction.", e);
         } finally {
             if (lock != null) {
                 // release the semaphore lock
@@ -759,9 +753,6 @@ public class ServiceDispatcher {
         } catch (GenericTransactionException se) {
             Debug.logError(se, "Problems with the transaction", module);
             throw new GenericServiceException("Problems with the transaction: " + se.getMessage() + "; See logs for more detail");
-        } catch (GenericEntityConfException e) {
-            Debug.logError(e, "Problems with the transaction", module);
-            throw new GenericServiceException("Problems with the transaction: " + e.getMessage() + "; See logs for more detail");
         } finally {
             // resume the parent transaction
             if (parentTransaction != null) {

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceSynchronization.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceSynchronization.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceSynchronization.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceSynchronization.java Tue Aug 26 09:16:52 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.getTransactionManager().getTransaction();
+            Transaction transaction = TransactionFactoryLoader.getInstance().getTransactionManager().getTransaction();
             synchronized (transaction) {
                 sync = syncingleton.get(transaction);
                 if (sync == null) {

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java Tue Aug 26 09:16:52 2014
@@ -30,9 +30,10 @@ import jimm.datavision.UserCancellationE
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.webapp.control.ContextFilter;
 import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 
 /**
  * Handles DataVision type view rendering
@@ -74,7 +75,7 @@ public class DataVisionViewHandler exten
             String datasourceName = delegator.getEntityHelperName(info);
 
             Report report = new Report();
-            report.setDatabaseConnection(ConnectionFactory.getConnection(datasourceName));
+            report.setDatabaseConnection(TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, datasourceName)));
 
             /* NOTE: this is the old code that is no londer needed because of the new setDatabaseConnection method
             report.setDatabasePassword(""); // password can be bogus because we are using an OFBiz connection...

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java Tue Aug 26 09:16:52 2014
@@ -38,10 +38,10 @@ import net.sf.jasperreports.engine.expor
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.cache.UtilCache;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.webapp.control.ContextFilter;
-import org.ofbiz.webapp.view.AbstractViewHandler;
 import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 
 
 /**
@@ -105,7 +105,7 @@ public class JasperReportsJXlsViewHandle
                 String datasourceName = delegator.getEntityHelperName(info);
                 if (UtilValidate.isNotEmpty(datasourceName)) {
                     Debug.logInfo("Filling report with connection from datasource: " + datasourceName, module);
-                    jp = JasperFillManager.fillReport(report, parameters, ConnectionFactory.getConnection(datasourceName));
+                    jp = JasperFillManager.fillReport(report, parameters, TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, datasourceName)));
                 } else {
                     Debug.logInfo("Filling report with an empty JR datasource", module);
                     jp = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java Tue Aug 26 09:16:52 2014
@@ -37,10 +37,10 @@ import net.sf.jasperreports.engine.Jaspe
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.cache.UtilCache;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.webapp.control.ContextFilter;
-import org.ofbiz.webapp.view.AbstractViewHandler;
 import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 
 /**
  * Handles JasperReports PDF view rendering
@@ -103,7 +103,7 @@ public class JasperReportsPdfViewHandler
                 String datasourceName = delegator.getEntityHelperName(info);
                 if (UtilValidate.isNotEmpty(datasourceName)) {
                     Debug.logInfo("Filling report with connection from datasource: " + datasourceName, module);
-                    jp = JasperFillManager.fillReport(report, parameters, ConnectionFactory.getConnection(datasourceName));
+                    jp = JasperFillManager.fillReport(report, parameters, TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, datasourceName)));
                 } else {
                     Debug.logInfo("Filling report with an empty JR datasource", module);
                     jp = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java Tue Aug 26 09:16:52 2014
@@ -38,10 +38,10 @@ import net.sf.jasperreports.engine.expor
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.cache.UtilCache;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.webapp.control.ContextFilter;
-import org.ofbiz.webapp.view.AbstractViewHandler;
 import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 
 
 /**
@@ -105,7 +105,7 @@ public class JasperReportsPoiXlsViewHand
                 String datasourceName = delegator.getEntityHelperName(info);
                 if (UtilValidate.isNotEmpty(datasourceName)) {
                     Debug.logInfo("Filling report with connection from datasource: " + datasourceName, module);
-                    jp = JasperFillManager.fillReport(report, parameters, ConnectionFactory.getConnection(datasourceName));
+                    jp = JasperFillManager.fillReport(report, parameters, TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, datasourceName)));
                 } else {
                     Debug.logInfo("Filling report with an empty JR datasource", module);
                     jp = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java Tue Aug 26 09:16:52 2014
@@ -36,10 +36,10 @@ import net.sf.jasperreports.engine.Jaspe
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.webapp.control.ContextFilter;
-import org.ofbiz.webapp.view.AbstractViewHandler;
 import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.jdbc.ConnectionFactory;
 
 /**
  * Handles JasperReports PDF view rendering
@@ -90,7 +90,7 @@ public class JasperReportsXmlViewHandler
             PipedInputStream fillToPrintInputStream = new PipedInputStream(fillToPrintOutputStream);
 
             if (UtilValidate.isNotEmpty(datasourceName)) {
-                JasperFillManager.fillReportToStream(report, fillToPrintOutputStream, parameters, ConnectionFactory.getConnection(datasourceName));
+                JasperFillManager.fillReportToStream(report, fillToPrintOutputStream, parameters, TransactionFactoryLoader.getInstance().getConnection(new GenericHelperInfo(null, datasourceName)));
             } else {
                 JasperFillManager.fillReportToStream(report, fillToPrintOutputStream, parameters, new JREmptyDataSource());
             }

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Tue Aug 26 09:16:52 2014
@@ -43,8 +43,8 @@ import org.ofbiz.base.util.GeneralExcept
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.DelegatorElement;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelReader;
 import org.ofbiz.service.DispatchContext;
@@ -128,7 +128,7 @@ public class ArtifactInfoFactory {
     protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
         this.delegatorName = delegatorName;
         this.entityModelReader = ModelReader.getModelReader(delegatorName);
-        DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
+        DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
         String modelName;
         if (delegatorInfo != null) {
             modelName = delegatorInfo.getEntityModelReader();

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java Tue Aug 26 09:16:52 2014
@@ -42,7 +42,7 @@ import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.config.model.DelegatorElement;
-import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.service.DispatchContext;
@@ -73,7 +73,7 @@ public class LabelReferences {
         this.labels = factory.getLabels();
         DelegatorElement delegatorInfo = null;
         try {
-            delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName());
+            delegatorInfo = EntityConfig.getInstance().getDelegator(delegator.getDelegatorBaseName());
         } catch (GenericEntityConfException e) {
             Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
         }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp?rev=1620538&r1=1620537&r2=1620538&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp Tue Aug 26 09:16:52 2014
@@ -99,7 +99,7 @@ under the License.
   String originalLoaderName = request.getParameter("originalLoaderName");
   String originalLocation = request.getParameter("originalLocation");
   if (originalLoaderName != null && originalLocation != null) {
-    ec = reader.getResourceHandlerEntities(new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, originalLoaderName, originalLocation));
+    ec = reader.getResourceHandlerEntities(new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, originalLoaderName, originalLocation));
   } else {
     ec = reader.getEntityNames();
   }