Author: jacopoc
Date: Mon Aug 25 13:02:26 2014 New Revision: 1620316 URL: http://svn.apache.org/r1620316 Log: Made connection-factory element in entityengine.xml optional: in fact there are transaction managers that do not depend an external connection pool because it is already integrated (e.g. Atomikos Transaction Essentials). Modified: ofbiz/branches/framework-api-cleanup/framework/entity/dtd/entity-config.xsd ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactoryLoader.java Modified: ofbiz/branches/framework-api-cleanup/framework/entity/dtd/entity-config.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/dtd/entity-config.xsd?rev=1620316&r1=1620315&r2=1620316&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/dtd/entity-config.xsd (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/dtd/entity-config.xsd Mon Aug 25 13:02:26 2014 @@ -24,7 +24,7 @@ under the License. <xs:sequence> <xs:element maxOccurs="unbounded" ref="resource-loader"/> <xs:element ref="transaction-factory"/> - <xs:element ref="connection-factory"/> + <xs:element minOccurs="0" ref="connection-factory"/> <xs:element ref="debug-xa-resources"/> <xs:element maxOccurs="unbounded" ref="delegator"/> <xs:element maxOccurs="unbounded" ref="entity-model-reader"/> Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java?rev=1620316&r1=1620315&r2=1620316&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java Mon Aug 25 13:02:26 2014 @@ -98,10 +98,10 @@ public final class EntityConfig { this.transactionFactory = new TransactionFactory(transactionFactoryElement); } Element connectionFactoryElement = UtilXml.firstChildElement(element, "connection-factory"); - if (connectionFactoryElement == null) { - throw new GenericEntityConfException("<entity-config> element child element <connection-factory> is missing"); - } else { + if (connectionFactoryElement != null) { this.connectionFactory = new ConnectionFactory(connectionFactoryElement); + } else { + this.connectionFactory = null; } Element debugXaResourcesElement = UtilXml.firstChildElement(element, "debug-xa-resources"); if (debugXaResourcesElement == null) { Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactoryLoader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactoryLoader.java?rev=1620316&r1=1620315&r2=1620316&view=diff ============================================================================== --- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactoryLoader.java (original) +++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactoryLoader.java Mon Aug 25 13:02:26 2014 @@ -34,6 +34,9 @@ public class ConnectionFactoryLoader { private static ConnectionFactory createConnectionFactory() { ConnectionFactory instance = null; try { + if (EntityConfig.getInstance().getConnectionFactory() == null) { + return null; + } String className = EntityConfig.getInstance().getConnectionFactory().getClassName(); if (className == null) { throw new IllegalStateException("Could not find connection factory class name definition"); |
Free forum by Nabble | Edit this page |