Author: jacopoc
Date: Sat Aug 23 07:36:25 2014 New Revision: 1619979 URL: http://svn.apache.org/r1619979 Log: Removed dependency of ConnectionFactory on TransactionFactoryLoader. Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Sat Aug 23 07:36:25 2014 @@ -81,20 +81,6 @@ public class ConnectionFactory { return getConnection(null, connectionUrl, props, null, null); } - public static Connection getConnection(String helperName) throws SQLException, GenericEntityException { - return getConnection(new GenericHelperInfo(null, helperName)); - } - - public static Connection getConnection(GenericHelperInfo helperInfo) throws SQLException, GenericEntityException { - // Debug.logVerbose("Getting a connection", module); - - Connection con = TransactionFactoryLoader.getInstance().getConnection(helperInfo); - if (con == null) { - Debug.logError("******* ERROR: No database connection found for helperName \"" + helperInfo.getHelperFullName() + "\"", module); - } - return con; - } - private static ConnectionFactoryInterface getManagedConnectionFactory() { ConnectionFactoryInterface instance = connFactoryRef.get(); if (instance == null) { Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Sat Aug 23 07:36:25 2014 @@ -57,6 +57,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; @@ -132,7 +133,7 @@ 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); } Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java Sat Aug 23 07:36:25 2014 @@ -43,6 +43,7 @@ import org.ofbiz.entity.config.model.Dat 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; /** @@ -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); Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java Sat Aug 23 07:36:25 2014 @@ -36,6 +36,7 @@ import org.ofbiz.entity.jdbc.ConnectionF 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 +205,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/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java Sat Aug 23 07:36:25 2014 @@ -30,6 +30,8 @@ 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; @@ -74,7 +76,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/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java Sat Aug 23 07:36:25 2014 @@ -38,6 +38,8 @@ 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; @@ -105,7 +107,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/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java Sat Aug 23 07:36:25 2014 @@ -37,6 +37,8 @@ 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; @@ -103,7 +105,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/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java Sat Aug 23 07:36:25 2014 @@ -38,6 +38,8 @@ 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; @@ -105,7 +107,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/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java?rev=1619979&r1=1619978&r2=1619979&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java Sat Aug 23 07:36:25 2014 @@ -36,6 +36,8 @@ 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; @@ -90,7 +92,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()); } |
Free forum by Nabble | Edit this page |