svn commit: r1620803 [2/3] - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/marketing/src/org/ofbiz/marketing/tracking/ applications/order/script/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/...

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

svn commit: r1620803 [2/3] - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/marketing/src/org/ofbiz/marketing/tracking/ applications/order/script/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/...

jleroux@apache.org
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Resource.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Resource.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Resource.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Resource.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -35,7 +34,7 @@ public final class Resource {
     private final String location; // type = xs:string
 
     Resource(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String loader = element.getAttribute("loader").intern();
         if (loader.isEmpty()) {
             throw new GenericEntityConfException("<resource> element loader attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -37,7 +36,7 @@ public final class ResourceLoader {
     private final String prefix; // type = xs:string
 
     ResourceLoader(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String name = element.getAttribute("name").intern();
         if (name.isEmpty()) {
             throw new GenericEntityConfException("<resource-loader> element name attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -35,7 +34,7 @@ public final class SqlLoadPath {
     private final String prependEnv; // type = xs:string
 
     SqlLoadPath(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String path = element.getAttribute("path").intern();
         if (path.isEmpty()) {
             throw new GenericEntityConfException("<sql-load-path> element path attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java Wed Aug 27 08:29:10 2014
@@ -21,7 +21,6 @@ package org.ofbiz.entity.config.model;
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -37,7 +36,7 @@ public final class TransactionFactory {
     private final TransactionManagerJndi transactionManagerJndi; // <transaction-manager-jndi>
 
     TransactionFactory(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String className = element.getAttribute("class").intern();
         if (className.isEmpty()) {
             throw new GenericEntityConfException("<transaction-factory> element class attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -35,7 +34,7 @@ public final class TransactionManagerJnd
     private final String jndiName; // type = xs:string
 
     TransactionManagerJndi(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String jndiServerName = element.getAttribute("jndi-server-name").intern();
         if (jndiServerName.isEmpty()) {
             throw new GenericEntityConfException("<transaction-manager-jndi> element jndi-server-name attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -35,7 +34,7 @@ public final class TyrexDataSource exten
 
     TyrexDataSource(Element element) throws GenericEntityConfException {
         super(element);
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String dataSourceName = element.getAttribute("dataSource-name").intern();
         if (dataSourceName.isEmpty()) {
             throw new GenericEntityConfException("<tyrex-dataSource> element dataSource-name attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java Wed Aug 27 08:29:10 2014
@@ -20,7 +20,6 @@ package org.ofbiz.entity.config.model;
 
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.w3c.dom.Element;
 
 /**
@@ -35,7 +34,7 @@ public final class UserTransactionJndi {
     private final String jndiName; // type = xs:string
 
     UserTransactionJndi(Element element) throws GenericEntityConfException {
-        String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
+        String lineNumberText = EntityConfig.createConfigFileLineNumberText(element);
         String jndiServerName = element.getAttribute("jndi-server-name").intern();
         if (jndiServerName.isEmpty()) {
             throw new GenericEntityConfException("<user-transaction-jndi> element jndi-server-name attribute is empty" + lineNumberText);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Wed Aug 27 08:29:10 2014
@@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHa
 
 import javax.transaction.TransactionManager;
 
-import org.apache.commons.dbcp2.ConnectionFactory;
 import org.apache.commons.dbcp2.DriverConnectionFactory;
 import org.apache.commons.dbcp2.PoolableConnectionFactory;
 import org.apache.commons.dbcp2.managed.LocalXAConnectionFactory;
@@ -40,18 +39,19 @@ import org.apache.commons.pool2.impl.Gen
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.EntityConfig;
 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;
 
 /**
  * Apache Commons DBCP connection factory.
  *
  * @see <a href="http://commons.apache.org/proper/commons-dbcp/">Apache Commons DBCP</a>
  */
-public class DBCPConnectionFactory implements ConnectionFactoryInterface {
+public class DBCPConnectionFactory implements ConnectionFactory {
 
     public static final String module = DBCPConnectionFactory.class.getName();
     protected static final ConcurrentHashMap<String, ManagedDataSource> dsCache = new ConcurrentHashMap<String, ManagedDataSource>();
@@ -60,19 +60,19 @@ public class DBCPConnectionFactory imple
         String cacheKey = helperInfo.getHelperFullName();
         ManagedDataSource mds = dsCache.get(cacheKey);
         if (mds != null) {
-            return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection());
+            return TransactionUtil.getCursorConnection(helperInfo, mds.getConnection());
         }
         if (!(abstractJdbc instanceof InlineJdbc)) {
             throw new GenericEntityConfException("DBCP requires an <inline-jdbc> child element in the <datasource> element");
         }
         InlineJdbc jdbcElement = (InlineJdbc) abstractJdbc;
         // connection properties
-        TransactionManager txMgr = TransactionFactory.getTransactionManager();
+        TransactionManager txMgr = TransactionFactoryLoader.getInstance().getTransactionManager();
         String driverName = jdbcElement.getJdbcDriver();
 
         String jdbcUri = helperInfo.getOverrideJdbcUri(jdbcElement.getJdbcUri());
         String jdbcUsername = helperInfo.getOverrideUsername(jdbcElement.getJdbcUsername());
-        String jdbcPassword = helperInfo.getOverridePassword(EntityConfigUtil.getJdbcPassword(jdbcElement));
+        String jdbcPassword = helperInfo.getOverridePassword(EntityConfig.getJdbcPassword(jdbcElement));
 
         // pool settings
         int maxSize = jdbcElement.getPoolMaxsize();
@@ -98,7 +98,7 @@ public class DBCPConnectionFactory imple
         cfProps.put("password", jdbcPassword);
 
         // create the connection factory
-        ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps);
+        org.apache.commons.dbcp2.ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps);
 
         // wrap it with a LocalXAConnectionFactory
         XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf);
@@ -152,7 +152,7 @@ public class DBCPConnectionFactory imple
         dsCache.putIfAbsent(cacheKey, mds);
         mds = dsCache.get(cacheKey);
 
-        return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection());
+        return TransactionUtil.getCursorConnection(helperInfo, mds.getConnection());
     }
 
     public void closeAll() {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Wed Aug 27 08:29:10 2014
@@ -43,7 +43,6 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.EntityLockedException;
 import org.ofbiz.entity.GenericDataSourceException;
 import org.ofbiz.entity.GenericEntity;
-import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericEntityNotFoundException;
 import org.ofbiz.entity.GenericModelException;
@@ -53,7 +52,6 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityConditionParam;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.config.model.*;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.jdbc.DatabaseUtil;
 import org.ofbiz.entity.jdbc.SQLProcessor;
 import org.ofbiz.entity.jdbc.SqlJdbcUtil;
@@ -95,7 +93,7 @@ public class GenericDAO {
     public GenericDAO(GenericHelperInfo helperInfo) {
         this.helperInfo = helperInfo;
         this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName());
-        this.datasource = EntityConfigUtil.getDatasource(helperInfo.getHelperBaseName());
+        this.datasource = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
         this.executor = ExecutionPool.getScheduledExecutor(GENERIC_DAO_THREAD_GROUP, "OFBiz-entity-datasource(" + helperInfo.getHelperFullName() + ")", datasource.getMaxWorkerPoolSize(), false);
     }
 

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java Wed Aug 27 08:29:10 2014
@@ -24,7 +24,7 @@ import java.util.Map;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.config.model.Datasource;
-import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.EntityConfig;
 
 /**
  * Generic Entity Helper Factory Class
@@ -46,7 +46,7 @@ public class GenericHelperFactory {
                 helper = helperCache.get(helperInfo.getHelperFullName());
                 if (helper == null) {
                     try {
-                        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperInfo.getHelperBaseName());
+                        Datasource datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
 
                         if (datasourceInfo == null) {
                             throw new IllegalStateException("Could not find datasource definition with name " + helperInfo.getHelperBaseName());

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java Wed Aug 27 08:29:10 2014
@@ -39,8 +39,8 @@ import org.ofbiz.entity.GenericNotImplem
 import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.config.model.Datasource;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.jdbc.SqlJdbcUtil;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
@@ -281,7 +281,7 @@ public class MemoryHelper implements Gen
     public MemoryHelper(String helperName) {
         this.helperName = helperName;
         modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName);
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
         this.executor = ExecutionPool.getScheduledExecutor(MEMORY_HELPER_THREAD_GROUP, "OFBiz-entity-datasource(" + helperName + ")", datasourceInfo.getMaxWorkerPoolSize(), false);
     }
 

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Wed Aug 27 08:29:10 2014
@@ -22,6 +22,8 @@ import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.Driver;
+import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -33,6 +35,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.Callable;
@@ -47,7 +50,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 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.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
@@ -57,6 +60,7 @@ import org.ofbiz.entity.model.ModelIndex
 import org.ofbiz.entity.model.ModelKeyMap;
 import org.ofbiz.entity.model.ModelRelation;
 import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -91,7 +95,7 @@ public class DatabaseUtil {
     public DatabaseUtil(GenericHelperInfo helperInfo, ExecutorService executor) {
         this.helperInfo = helperInfo;
         this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName());
-        this.datasourceInfo = EntityConfigUtil.getDatasource(helperInfo.getHelperBaseName());
+        this.datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
         this.executor = executor;
     }
 
@@ -132,9 +136,9 @@ public class DatabaseUtil {
     protected Connection getConnection() throws SQLException, GenericEntityException {
         Connection connection = null;
         if (!isLegacy) {
-            connection = ConnectionFactory.getConnection(helperInfo);
+            connection = TransactionFactoryLoader.getInstance().getConnection(helperInfo);
         } else {
-            connection = ConnectionFactory.getConnection(driverName, connectionUrl, null, userName, password);
+            connection = getConnection(driverName, connectionUrl, null, userName, password);
         }
 
         if (connection == null) {
@@ -150,6 +154,36 @@ public class DatabaseUtil {
         return connection;
     }
 
+    private Connection getConnection(String driverName, String connectionUrl, Properties props, String userName, String password) throws SQLException {
+        // first register the JDBC driver with the DriverManager
+        if (driverName != null) {
+            if (DriverManager.getDriver(driverName) == null) {
+                try {
+                    Driver driver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance();
+                    DriverManager.registerDriver(driver);
+                } catch (ClassNotFoundException e) {
+                    Debug.logWarning(e, "Unable to load driver [" + driverName + "]", module);
+                } catch (InstantiationException e) {
+                    Debug.logWarning(e, "Unable to instantiate driver [" + driverName + "]", module);
+                } catch (IllegalAccessException e) {
+                    Debug.logWarning(e, "Illegal access exception [" + driverName + "]", module);
+                }
+            }
+        }
+
+        try {
+            if (UtilValidate.isNotEmpty(userName))
+                return DriverManager.getConnection(connectionUrl, userName, password);
+            else if (props != null)
+                return DriverManager.getConnection(connectionUrl, props);
+            else
+                return DriverManager.getConnection(connectionUrl);
+        } catch (SQLException e) {
+            Debug.logError(e, "SQL Error obtaining JDBC connection", module);
+            throw e;
+        }
+    }
+
     protected Connection getConnectionLogged(Collection<String> messages) {
         try {
             return getConnection();

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java Wed Aug 27 08:29:10 2014
@@ -40,9 +40,10 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericDataSourceException;
 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.transaction.GenericTransactionException;
+import org.ofbiz.entity.transaction.TransactionFactoryLoader;
 import org.ofbiz.entity.transaction.TransactionUtil;
 
 /**
@@ -242,7 +243,7 @@ public class SQLProcessor {
     }
 
     /**
-     * Get a connection from the ConnectionFactory
+     * Get a connection from the TransactionFactoryLoader
      *
      * @return  The connection created
      *
@@ -256,7 +257,7 @@ public class SQLProcessor {
         _manualTX = true;
 
         try {
-            _connection = ConnectionFactory.getConnection(helperInfo);
+            _connection = TransactionFactoryLoader.getInstance().getConnection(helperInfo);
             if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:connection() : manualTx=" + _manualTX, module);
         } catch (SQLException sqle) {
             throw new GenericDataSourceException("Unable to esablish a connection with the database.", sqle);
@@ -753,7 +754,7 @@ public class SQLProcessor {
         if (field != null) {
             _ps.setBlob(_ind, field);
         } else {
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(this.helperInfo.getHelperBaseName());
+            Datasource datasourceInfo = EntityConfig.getDatasource(this.helperInfo.getHelperBaseName());
             if (datasourceInfo.getUseBinaryTypeForBlob()) {
                 _ps.setNull(_ind, Types.BINARY);
             } else {
@@ -804,7 +805,7 @@ public class SQLProcessor {
                 throw new SQLException(ex.getMessage());
             }
         } else {
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(this.helperInfo.getHelperBaseName());
+            Datasource datasourceInfo = EntityConfig.getDatasource(this.helperInfo.getHelperBaseName());
             if (datasourceInfo.getUseBinaryTypeForBlob()) {
                 _ps.setNull(_ind, Types.BINARY);
             } else {
@@ -827,7 +828,7 @@ public class SQLProcessor {
         if (bytes != null) {
             _ps.setBytes(_ind, bytes);
         } else {
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(this.helperInfo.getHelperBaseName());
+            Datasource datasourceInfo = EntityConfig.getDatasource(this.helperInfo.getHelperBaseName());
             if (datasourceInfo.getUseBinaryTypeForBlob()) {
                 _ps.setNull(_ind, Types.BINARY);
             } else {
@@ -865,7 +866,7 @@ public class SQLProcessor {
 
         // check if the statement was called with a specific fetch size, if not grab the default from the datasource
         if (fetchSize < 0) {
-            Datasource ds = EntityConfigUtil.getDatasource(this.helperInfo.getHelperBaseName());
+            Datasource ds = EntityConfig.getDatasource(this.helperInfo.getHelperBaseName());
             if (ds != null) {
                 fetchSize = ds.getResultFetchSize();
             } else {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Wed Aug 27 08:29:10 2014
@@ -47,8 +47,8 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntity;
 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.jdbc.DatabaseUtil;
 import org.ofbiz.entity.model.ModelIndex.Field;
 import org.w3c.dom.Document;
@@ -407,7 +407,7 @@ public class ModelEntity implements Comp
 
     /** The table-name of the Entity including a Schema name if specified in the datasource config */
     public String getTableName(String helperName) {
-        return getTableName(EntityConfigUtil.getDatasource(helperName));
+        return getTableName(EntityConfig.getDatasource(helperName));
     }
 
     /** The table-name of the Entity including a Schema name if specified in the datasource config */

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java Wed Aug 27 08:29:10 2014
@@ -33,8 +33,8 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.GenericEntityConfException;
-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.FieldType;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -66,7 +66,7 @@ public class ModelFieldTypeReader implem
     }
 
     public static ModelFieldTypeReader getModelFieldTypeReader(String helperName) {
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+        Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
         if (datasourceInfo == null) {
             throw new IllegalArgumentException("Could not find a datasource/helper with the name " + helperName);
         }
@@ -75,14 +75,14 @@ public class ModelFieldTypeReader implem
         while (reader == null) {
             FieldType fieldTypeInfo = null;
             try {
-                fieldTypeInfo = EntityConfigUtil.getFieldType(tempModelName);
+                fieldTypeInfo = EntityConfig.getInstance().getFieldType(tempModelName);
             } catch (GenericEntityConfException e) {
                 Debug.logWarning(e, "Exception thrown while getting field type config: ", module);
             }
             if (fieldTypeInfo == null) {
                 throw new IllegalArgumentException("Could not find a field-type definition with name \"" + tempModelName + "\"");
             }
-            ResourceHandler fieldTypeResourceHandler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, fieldTypeInfo.getLoader(), fieldTypeInfo.getLocation());
+            ResourceHandler fieldTypeResourceHandler = new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, fieldTypeInfo.getLoader(), fieldTypeInfo.getLocation());
             UtilTimer utilTimer = new UtilTimer();
             utilTimer.timerString("[ModelFieldTypeReader.getModelFieldTypeReader] Reading field types from " + fieldTypeResourceHandler.getLocation());
             Document document = null;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Wed Aug 27 08:29:10 2014
@@ -37,8 +37,8 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
 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.entity.config.model.EntityGroupReader;
 import org.ofbiz.entity.config.model.Resource;
 import org.w3c.dom.Document;
@@ -62,7 +62,7 @@ public class ModelGroupReader implements
     public List<ResourceHandler> entityGroupResourceHandlers = new LinkedList<ResourceHandler>();
 
     public static ModelGroupReader getModelGroupReader(String delegatorName) throws GenericEntityConfException {
-        DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
+        DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
 
         if (delegatorInfo == null) {
             throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
@@ -79,13 +79,13 @@ public class ModelGroupReader implements
 
     public ModelGroupReader(String modelName) throws GenericEntityConfException {
         this.modelName = modelName;
-        EntityGroupReader entityGroupReaderInfo = EntityConfigUtil.getEntityGroupReader(modelName);
+        EntityGroupReader entityGroupReaderInfo = EntityConfig.getInstance().getEntityGroupReader(modelName);
 
         if (entityGroupReaderInfo == null) {
             throw new GenericEntityConfException("Cound not find an entity-group-reader with the name " + modelName);
         }
         for (Resource resourceElement: entityGroupReaderInfo.getResourceList()) {
-            this.entityGroupResourceHandlers.add(new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation()));
+            this.entityGroupResourceHandlers.add(new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation()));
         }
 
         // get all of the component resource group stuff, ie specified in each ofbiz-component.xml file
@@ -171,7 +171,7 @@ public class ModelGroupReader implements
             if (groupName == null) {
                 DelegatorElement delegatorInfo = null;
                 try {
-                    delegatorInfo = EntityConfigUtil.getDelegator(delegatorBaseName);
+                    delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorBaseName);
                 } catch (GenericEntityConfException e) {
                     Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
                 }
@@ -197,7 +197,7 @@ public class ModelGroupReader implements
         if (this.groupNames == null) return null;
         Set<String> newSet = new HashSet<String>();
         try {
-            newSet.add(EntityConfigUtil.getDelegator(delegatorBaseName).getDefaultGroupName());
+            newSet.add(EntityConfig.getInstance().getDelegator(delegatorBaseName).getDefaultGroupName());
         } catch (GenericEntityConfException e) {
             Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Wed Aug 27 08:29:10 2014
@@ -42,8 +42,8 @@ import org.ofbiz.base.util.cache.UtilCac
 import org.ofbiz.entity.GenericEntityConfException;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericModelException;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.DelegatorElement;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.config.model.EntityModelReader;
 import org.ofbiz.entity.config.model.Resource;
 import org.w3c.dom.Document;
@@ -80,7 +80,7 @@ public class ModelReader implements Seri
     protected Map<String, ResourceHandler> entityResourceHandlerMap;
 
     public static ModelReader getModelReader(String delegatorName) throws GenericEntityException {
-        DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
+        DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
 
         if (delegatorInfo == null) {
             throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
@@ -104,7 +104,7 @@ public class ModelReader implements Seri
         resourceHandlerEntities = new HashMap<ResourceHandler, Collection<String>>();
         entityResourceHandlerMap = new HashMap<String, ResourceHandler>();
 
-        EntityModelReader entityModelReaderInfo = EntityConfigUtil.getEntityModelReader(modelName);
+        EntityModelReader entityModelReaderInfo = EntityConfig.getInstance().getEntityModelReader(modelName);
 
         if (entityModelReaderInfo == null) {
             throw new GenericEntityConfException("Cound not find an entity-model-reader with the name " + modelName);
@@ -112,7 +112,7 @@ public class ModelReader implements Seri
 
         // get all of the main resource model stuff, ie specified in the entityengine.xml file
         for (Resource resourceElement : entityModelReaderInfo.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());
             entityResourceHandlers.add(handler);
         }
 
@@ -463,7 +463,7 @@ TEMP_VIEW_LOOP:
     }
 
     public void addEntityToResourceHandler(String entityName, String loaderName, String location) {
-        entityResourceHandlerMap.put(entityName, new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, loaderName, location));
+        entityResourceHandlerMap.put(entityName, new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, loaderName, location));
     }
 
     public ResourceHandler getEntityResourceHandler(String entityName) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Wed Aug 27 08:29:10 2014
@@ -46,8 +46,8 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.config.model.Datasource;
+import org.ofbiz.entity.config.model.EntityConfig;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.testtools.EntityTestCase;
@@ -461,7 +461,7 @@ public class EntityTestSuite extends Ent
     public void testForeignKeyCreate() {
         try {
             String helperName = delegator.getEntityHelper("Testing").getHelperName();
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+            Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
             if (!datasourceInfo.getUseForeignKeys()) {
                 Debug.logInfo("Datasource " + datasourceInfo.getName() + " use-foreign-keys set to false, skipping testForeignKeyCreate", module);
                 return;
@@ -485,7 +485,7 @@ public class EntityTestSuite extends Ent
     public void testForeignKeyRemove() throws Exception {
         try {
             String helperName = delegator.getEntityHelper("TestingNode").getHelperName();
-            Datasource datasourceInfo = EntityConfigUtil.getDatasource(helperName);
+            Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
             if (!datasourceInfo.getUseForeignKeys()) {
                 Debug.logInfo("Datasource " + datasourceInfo.getName() + " use-foreign-keys set to false, skipping testForeignKeyRemove", module);
                 return;
@@ -857,7 +857,7 @@ public class EntityTestSuite extends Ent
      */
     /*public void testLimitOffsetOptions() throws Exception {
         String entityName = "Content";
-        Datasource datasourceInfo = EntityConfigUtil.getDatasource(delegator.getEntityHelper(entityName).getHelperName());
+        Datasource datasourceInfo = EntityConfig.getDatasource(delegator.getEntityHelper(entityName).getHelperName());
         if (UtilValidate.isEmpty(datasourceInfo.offsetStyle) || datasourceInfo.offsetStyle.equals("none")) {
             Debug.logInfo("The offset-stype configured in datasource is " + datasourceInfo.offsetStyle +  ", this test is skipped.", module);
             return;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java Wed Aug 27 08:29:10 2014
@@ -47,7 +47,7 @@ public abstract class GenericXaResource
      * @throws XAException
      */
     public void enlist() throws XAException {
-        TransactionManager tm = TransactionFactory.getTransactionManager();
+        TransactionManager tm = TransactionFactoryLoader.getInstance().getTransactionManager();
         try {
             if (tm != null && tm.getStatus() == Status.STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Wed Aug 27 08:29:10 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Wed Aug 27 08:29:10 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());
     }
 
@@ -105,15 +105,15 @@ public class EntityDataLoader {
                 }
                 readerName = readerName.trim();
                 
-                // ignore the "tenant" reader if the multitenant property is "N"
-                if ("tenant".equals(readerName) && "N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+                // ignore the "tenant" reader if multitenant is disabled
+                if ("tenant".equals(readerName) && !EntityUtil.isMultiTenantEnabled()) {
                     continue;
                 }
 
                 // 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Wed Aug 27 08:29:10 2014
@@ -35,6 +35,7 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntity;
@@ -539,4 +540,13 @@ public class EntityUtil {
 
         return fieldList;
     }
+
+    /**
+     * Returns <code>true</code> if multi-tenant has been enabled.
+     * <p>Multi-tenant features are enabled by setting the <code>multitenant</code>
+     * property in <code>general.properties</code> to "Y".</p>
+     */
+    public static boolean isMultiTenantEnabled() {
+        return "Y".equalsIgnoreCase(UtilProperties.getPropertyValue("general.properties", "multitenant"));
+    }
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java Wed Aug 27 08:29:10 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Wed Aug 27 08:29:10 2014
@@ -37,7 +37,6 @@ import org.ofbiz.base.container.Containe
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
@@ -51,6 +50,7 @@ import org.ofbiz.entity.datasource.Gener
 import org.ofbiz.entity.jdbc.DatabaseUtil;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.util.EntityDataLoader;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.ServiceDispatcher;
 
 
@@ -206,8 +206,8 @@ public class EntityDataLoadContainer imp
      */
     public boolean start() throws ContainerException {
         if("all-tenants".equals(this.overrideDelegator)) {
-            if ("N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
-                Debug.logWarning("Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
+            if (!EntityUtil.isMultiTenantEnabled()) {
+                Debug.logWarning("Multitenant is disabled. Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
                 return true;
             }
             ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
@@ -317,7 +317,7 @@ public class EntityDataLoadContainer imp
         }
         // load specify components
         List<String> loadComponents = FastList.newInstance();
-        if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && "Y".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+        if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && EntityUtil.isMultiTenantEnabled()) {
             try {
                 List<EntityExpr> exprs = new ArrayList<EntityExpr>();
                 exprs.add(EntityCondition.makeCondition("rootLocation", EntityOperator.NOT_LIKE, "%hot-deploy%"));

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java Wed Aug 27 08:29:10 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java?rev=1620803&r1=1620802&r2=1620803&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java Wed Aug 27 08:29:10 2014
@@ -609,7 +609,7 @@ public class EntitySyncServices {
             }
 
 
-            int keepSeconds = (int) Math.floor(keepRemoveInfoHours * 60);
+            int keepSeconds = (int) Math.floor(keepRemoveInfoHours * 3600);
 
             Calendar nowCal = Calendar.getInstance();
             nowCal.setTimeInMillis(System.currentTimeMillis());