You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/06/07 10:21:23 UTC
svn commit: r1490535 - in
/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config: ./ model/
Author: adrianc
Date: Fri Jun 7 08:21:22 2013
New Revision: 1490535
URL: http://svn.apache.org/r1490535
Log:
Improved entityengine.xml models:
1. Added file name and line number to validation code so exceptions can show where things went wrong.
2. Convert some attributes to primitive types.
Added:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java (with props)
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Resource.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Fri Jun 7 08:21:22 2013
@@ -51,6 +51,13 @@ public class EntityConfigUtil {
private static final UtilCache<String, EntityConfig> entityConfigCache = UtilCache.createUtilCache("entity.EntityConfig", 0, 0, false);
private static final List<EntityConfigListener> configListeners = new CopyOnWriteArrayList<EntityConfigListener>();
+ public static String createConfigFileLineNumberText(Element element) {
+ if (element.getUserData("startLine") != null) {
+ return " [" + ENTITY_ENGINE_XML_FILENAME + " line " + element.getUserData("startLine") + "]";
+ }
+ return "";
+ }
+
/**
* Returns the <code>EntityConfig</code> instance.
* @throws GenericEntityConfException
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -33,9 +34,10 @@ public final class ConnectionFactory {
private final String className; // type = xs:string
public ConnectionFactory(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String className = element.getAttribute("class").intern();
if (className.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty" + lineNumberText);
}
this.className = className;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -35,179 +36,124 @@ import org.w3c.dom.Element;
@ThreadSafe
public final class Datasource {
+/*
+ public static final int TYPE_JNDI_JDBC = 1;
+ public static final int TYPE_INLINE_JDBC = 2;
+ public static final int TYPE_TYREX_DATA_SOURCE = 3;
+ public static final int TYPE_OTHER = 4;
+*/
+
private final String name; // type = xs:string
private final String helperClass; // type = xs:string
private final String fieldTypeName; // type = xs:string
- private final String useSchemas;
+ private final boolean useSchemas;
private final String schemaName; // type = xs:string
- private final String checkOnStart;
- private final String addMissingOnStart;
- private final String usePkConstraintNames;
- private final String checkPksOnStart;
- private final String constraintNameClipLength; // type = xs:nonNegativeInteger
- private final String useProxyCursor;
+ private final boolean checkOnStart;
+ private final boolean addMissingOnStart;
+ private final boolean usePkConstraintNames;
+ private final boolean checkPksOnStart;
+ private final int constraintNameClipLength; // type = xs:nonNegativeInteger
+ private final boolean useProxyCursor;
private final String proxyCursorName; // type = xs:string
- private final String resultFetchSize; // type = xs:integer
- private final String useForeignKeys;
- private final String useForeignKeyIndices;
- private final String checkFksOnStart;
- private final String checkFkIndicesOnStart;
+ private final int resultFetchSize; // type = xs:integer
+ private final boolean useForeignKeys;
+ private final boolean useForeignKeyIndices;
+ private final boolean checkFksOnStart;
+ private final boolean checkFkIndicesOnStart;
private final String fkStyle;
- private final String useFkInitiallyDeferred;
- private final String useIndices;
- private final String useIndicesUnique;
- private final String checkIndicesOnStart;
+ private final boolean useFkInitiallyDeferred;
+ private final boolean useIndices;
+ private final boolean useIndicesUnique;
+ private final boolean checkIndicesOnStart;
private final String joinStyle;
- private final String aliasViewColumns;
- private final String alwaysUseConstraintKeyword;
- private final String dropFkUseForeignKeyKeyword;
- private final String useBinaryTypeForBlob;
- private final String useOrderByNulls;
+ private final boolean aliasViewColumns;
+ private final boolean alwaysUseConstraintKeyword;
+ private final boolean dropFkUseForeignKeyKeyword;
+ private final boolean useBinaryTypeForBlob;
+ private final boolean useOrderByNulls;
private final String offsetStyle;
private final String tableType; // type = xs:string
private final String characterSet; // type = xs:string
private final String collate; // type = xs:string
- private final String maxWorkerPoolSize; // type = xs:integer
+ private final int maxWorkerPoolSize; // type = xs:integer
private final List<SqlLoadPath> sqlLoadPathList; // <sql-load-path>
private final List<ReadData> readDataList; // <read-data>
+ private final InlineJdbc inlineJdbc; // <inline-jdbc>
+ private final JndiJdbc jndiJdbc; // <jndi-jdbc>
+ private final TyrexDataSource tyrexDataSource; // <tyrex-dataSource>
public Datasource(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
String helperClass = element.getAttribute("helper-class").intern();
if (helperClass.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element helper-class attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element helper-class attribute is empty" + lineNumberText);
}
this.helperClass = helperClass;
String fieldTypeName = element.getAttribute("field-type-name").intern();
if (fieldTypeName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element field-type-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element field-type-name attribute is empty" + lineNumberText);
}
this.fieldTypeName = fieldTypeName;
- String useSchemas = element.getAttribute("use-schemas").intern();
- if (useSchemas.isEmpty()) {
- useSchemas = "true";
- }
- this.useSchemas = useSchemas;
+ this.useSchemas = !"false".equals(element.getAttribute("use-schemas"));
this.schemaName = element.getAttribute("schema-name").intern();
- String checkOnStart = element.getAttribute("check-on-start").intern();
- if (checkOnStart.isEmpty()) {
- checkOnStart = "true";
- }
- this.checkOnStart = checkOnStart;
- String addMissingOnStart = element.getAttribute("add-missing-on-start").intern();
- if (addMissingOnStart.isEmpty()) {
- addMissingOnStart = "false";
- }
- this.addMissingOnStart = addMissingOnStart;
- String usePkConstraintNames = element.getAttribute("use-pk-constraint-names").intern();
- if (usePkConstraintNames.isEmpty()) {
- usePkConstraintNames = "true";
- }
- this.usePkConstraintNames = usePkConstraintNames;
- String checkPksOnStart = element.getAttribute("check-pks-on-start").intern();
- if (checkPksOnStart.isEmpty()) {
- checkPksOnStart = "true";
- }
- this.checkPksOnStart = checkPksOnStart;
- String constraintNameClipLength = element.getAttribute("constraint-name-clip-length").intern();
+ this.checkOnStart = !"false".equals(element.getAttribute("check-on-start"));
+ this.addMissingOnStart = "true".equals(element.getAttribute("add-missing-on-start"));
+ this.usePkConstraintNames = !"false".equals(element.getAttribute("use-pk-constraint-names"));
+ this.checkPksOnStart = !"false".equals(element.getAttribute("check-pks-on-start"));
+ String constraintNameClipLength = element.getAttribute("constraint-name-clip-length");
if (constraintNameClipLength.isEmpty()) {
- constraintNameClipLength = "30";
- }
- this.constraintNameClipLength = constraintNameClipLength;
- String useProxyCursor = element.getAttribute("use-proxy-cursor").intern();
- if (useProxyCursor.isEmpty()) {
- useProxyCursor = "false";
+ this.constraintNameClipLength = 30;
+ } else {
+ try {
+ this.constraintNameClipLength = Integer.parseInt(constraintNameClipLength);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element constraint-name-clip-length attribute is invalid" + lineNumberText);
+ }
}
- this.useProxyCursor = useProxyCursor;
+ this.useProxyCursor = "true".equalsIgnoreCase(element.getAttribute("use-proxy-cursor"));
String proxyCursorName = element.getAttribute("proxy-cursor-name").intern();
if (proxyCursorName.isEmpty()) {
proxyCursorName = "p_cursor";
}
this.proxyCursorName = proxyCursorName;
- String resultFetchSize = element.getAttribute("result-fetch-size").intern();
+ String resultFetchSize = element.getAttribute("result-fetch-size");
if (resultFetchSize.isEmpty()) {
- resultFetchSize = "-1";
- }
- this.resultFetchSize = resultFetchSize;
- String useForeignKeys = element.getAttribute("use-foreign-keys").intern();
- if (useForeignKeys.isEmpty()) {
- useForeignKeys = "true";
- }
- this.useForeignKeys = useForeignKeys;
- String useForeignKeyIndices = element.getAttribute("use-foreign-key-indices").intern();
- if (useForeignKeyIndices.isEmpty()) {
- useForeignKeyIndices = "true";
- }
- this.useForeignKeyIndices = useForeignKeyIndices;
- String checkFksOnStart = element.getAttribute("check-fks-on-start").intern();
- if (checkFksOnStart.isEmpty()) {
- checkFksOnStart = "false";
- }
- this.checkFksOnStart = checkFksOnStart;
- String checkFkIndicesOnStart = element.getAttribute("check-fk-indices-on-start").intern();
- if (checkFkIndicesOnStart.isEmpty()) {
- checkFkIndicesOnStart = "false";
+ this.resultFetchSize = -1;
+ } else {
+ try {
+ this.resultFetchSize = Integer.parseInt(resultFetchSize);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element result-fetch-size attribute is invalid" + lineNumberText);
+ }
}
- this.checkFkIndicesOnStart = checkFkIndicesOnStart;
+ this.useForeignKeys = !"false".equals(element.getAttribute("use-foreign-keys"));
+ this.useForeignKeyIndices = !"false".equals(element.getAttribute("use-foreign-key-indices"));
+ this.checkFksOnStart = "true".equals(element.getAttribute("check-fks-on-start"));
+ this.checkFkIndicesOnStart = "true".equals(element.getAttribute("check-fk-indices-on-start"));
String fkStyle = element.getAttribute("fk-style").intern();
if (fkStyle.isEmpty()) {
fkStyle = "name_constraint";
}
this.fkStyle = fkStyle;
- String useFkInitiallyDeferred = element.getAttribute("use-fk-initially-deferred").intern();
- if (useFkInitiallyDeferred.isEmpty()) {
- useFkInitiallyDeferred = "false";
- }
- this.useFkInitiallyDeferred = useFkInitiallyDeferred;
- String useIndices = element.getAttribute("use-indices").intern();
- if (useIndices.isEmpty()) {
- useIndices = "true";
- }
- this.useIndices = useIndices;
- String useIndicesUnique = element.getAttribute("use-indices-unique").intern();
- if (useIndicesUnique.isEmpty()) {
- useIndicesUnique = "true";
- }
- this.useIndicesUnique = useIndicesUnique;
- String checkIndicesOnStart = element.getAttribute("check-indices-on-start").intern();
- if (checkIndicesOnStart.isEmpty()) {
- checkIndicesOnStart = "false";
- }
- this.checkIndicesOnStart = checkIndicesOnStart;
+ this.useFkInitiallyDeferred = "true".equals(element.getAttribute("use-fk-initially-deferred"));
+ this.useIndices = !"false".equals(element.getAttribute("use-indices"));
+ this.useIndicesUnique = !"false".equals(element.getAttribute("use-indices-unique"));
+ this.checkIndicesOnStart = "true".equals(element.getAttribute("check-indices-on-start"));
String joinStyle = element.getAttribute("join-style").intern();
if (joinStyle.isEmpty()) {
joinStyle = "ansi";
}
this.joinStyle = joinStyle;
- String aliasViewColumns = element.getAttribute("alias-view-columns").intern();
- if (aliasViewColumns.isEmpty()) {
- aliasViewColumns = "false";
- }
- this.aliasViewColumns = aliasViewColumns;
- String alwaysUseConstraintKeyword = element.getAttribute("always-use-constraint-keyword").intern();
- if (alwaysUseConstraintKeyword.isEmpty()) {
- alwaysUseConstraintKeyword = "false";
- }
- this.alwaysUseConstraintKeyword = alwaysUseConstraintKeyword;
- String dropFkUseForeignKeyKeyword = element.getAttribute("drop-fk-use-foreign-key-keyword").intern();
- if (dropFkUseForeignKeyKeyword.isEmpty()) {
- dropFkUseForeignKeyKeyword = "false";
- }
- this.dropFkUseForeignKeyKeyword = dropFkUseForeignKeyKeyword;
- String useBinaryTypeForBlob = element.getAttribute("use-binary-type-for-blob").intern();
- if (useBinaryTypeForBlob.isEmpty()) {
- useBinaryTypeForBlob = "false";
- }
- this.useBinaryTypeForBlob = useBinaryTypeForBlob;
- String useOrderByNulls = element.getAttribute("use-order-by-nulls").intern();
- if (useOrderByNulls.isEmpty()) {
- useOrderByNulls = "false";
- }
- this.useOrderByNulls = useOrderByNulls;
+ this.aliasViewColumns = "true".equals(element.getAttribute("alias-view-columns"));
+ this.alwaysUseConstraintKeyword = "true".equals(element.getAttribute("always-use-constraint-keyword"));
+ this.dropFkUseForeignKeyKeyword = "true".equals(element.getAttribute("drop-fk-use-foreign-key-keyword"));
+ this.useBinaryTypeForBlob = "true".equals(element.getAttribute("use-binary-type-for-blob"));
+ this.useOrderByNulls = "true".equals(element.getAttribute("use-order-by-nulls"));
String offsetStyle = element.getAttribute("offset-style").intern();
if (offsetStyle.isEmpty()) {
offsetStyle = "none";
@@ -218,9 +164,20 @@ public final class Datasource {
this.collate = element.getAttribute("collate").intern();
String maxWorkerPoolSize = element.getAttribute("max-worker-pool-size").intern();
if (maxWorkerPoolSize.isEmpty()) {
- maxWorkerPoolSize = "0";
+ this.maxWorkerPoolSize = 1;
+ } else {
+ try {
+ int maxWorkerPoolSizeInt = Integer.parseInt(maxWorkerPoolSize);
+ if (maxWorkerPoolSizeInt == 0) {
+ maxWorkerPoolSizeInt = 1;
+ } else if (maxWorkerPoolSizeInt < -2) {
+ maxWorkerPoolSizeInt = -2;
+ }
+ this.maxWorkerPoolSize = maxWorkerPoolSizeInt;
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element max-worker-pool-size attribute is invalid" + lineNumberText);
+ }
}
- this.maxWorkerPoolSize = maxWorkerPoolSize;
List<? extends Element> sqlLoadPathElementList = UtilXml.childElementList(element, "sql-load-path");
if (sqlLoadPathElementList.isEmpty()) {
this.sqlLoadPathList = Collections.emptyList();
@@ -241,6 +198,31 @@ public final class Datasource {
}
this.readDataList = Collections.unmodifiableList(readDataList);
}
+ int jdbcElementCount = 0;
+ Element inlineJdbcElement = UtilXml.firstChildElement(element, "inline-jdbc");
+ if (inlineJdbcElement == null) {
+ this.inlineJdbc = null;
+ } else {
+ this.inlineJdbc = new InlineJdbc(inlineJdbcElement);
+ jdbcElementCount++;
+ }
+ Element jndiJdbcElement = UtilXml.firstChildElement(element, "jndi-jdbc");
+ if (jndiJdbcElement == null) {
+ this.jndiJdbc = null;
+ } else {
+ this.jndiJdbc = new JndiJdbc(jndiJdbcElement);
+ jdbcElementCount++;
+ }
+ Element tyrexElement = UtilXml.firstChildElement(element, "tyrex-dataSource");
+ if (tyrexElement == null) {
+ this.tyrexDataSource = null;
+ } else {
+ this.tyrexDataSource = new TyrexDataSource(tyrexElement);
+ jdbcElementCount++;
+ }
+ if (jdbcElementCount > 1) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element is invalid: Only one of <inline-jdbc>, <jndi-jdbc>, <tyrex-dataSource> is allowed" + lineNumberText);
+ }
}
/** Returns the value of the <code>name</code> attribute. */
@@ -259,7 +241,7 @@ public final class Datasource {
}
/** Returns the value of the <code>use-schemas</code> attribute. */
- public String getUseSchemas() {
+ public boolean getUseSchemas() {
return this.useSchemas;
}
@@ -269,32 +251,32 @@ public final class Datasource {
}
/** Returns the value of the <code>check-on-start</code> attribute. */
- public String getCheckOnStart() {
+ public boolean getCheckOnStart() {
return this.checkOnStart;
}
/** Returns the value of the <code>add-missing-on-start</code> attribute. */
- public String getAddMissingOnStart() {
+ public boolean getAddMissingOnStart() {
return this.addMissingOnStart;
}
/** Returns the value of the <code>use-pk-constraint-names</code> attribute. */
- public String getUsePkConstraintNames() {
+ public boolean getUsePkConstraintNames() {
return this.usePkConstraintNames;
}
/** Returns the value of the <code>check-pks-on-start</code> attribute. */
- public String getCheckPksOnStart() {
+ public boolean getCheckPksOnStart() {
return this.checkPksOnStart;
}
/** Returns the value of the <code>constraint-name-clip-length</code> attribute. */
- public String getConstraintNameClipLength() {
+ public int getConstraintNameClipLength() {
return this.constraintNameClipLength;
}
/** Returns the value of the <code>use-proxy-cursor</code> attribute. */
- public String getUseProxyCursor() {
+ public boolean getUseProxyCursor() {
return this.useProxyCursor;
}
@@ -304,27 +286,27 @@ public final class Datasource {
}
/** Returns the value of the <code>result-fetch-size</code> attribute. */
- public String getResultFetchSize() {
+ public int getResultFetchSize() {
return this.resultFetchSize;
}
/** Returns the value of the <code>use-foreign-keys</code> attribute. */
- public String getUseForeignKeys() {
+ public boolean getUseForeignKeys() {
return this.useForeignKeys;
}
/** Returns the value of the <code>use-foreign-key-indices</code> attribute. */
- public String getUseForeignKeyIndices() {
+ public boolean getUseForeignKeyIndices() {
return this.useForeignKeyIndices;
}
/** Returns the value of the <code>check-fks-on-start</code> attribute. */
- public String getCheckFksOnStart() {
+ public boolean getCheckFksOnStart() {
return this.checkFksOnStart;
}
/** Returns the value of the <code>check-fk-indices-on-start</code> attribute. */
- public String getCheckFkIndicesOnStart() {
+ public boolean getCheckFkIndicesOnStart() {
return this.checkFkIndicesOnStart;
}
@@ -334,22 +316,22 @@ public final class Datasource {
}
/** Returns the value of the <code>use-fk-initially-deferred</code> attribute. */
- public String getUseFkInitiallyDeferred() {
+ public boolean getUseFkInitiallyDeferred() {
return this.useFkInitiallyDeferred;
}
/** Returns the value of the <code>use-indices</code> attribute. */
- public String getUseIndices() {
+ public boolean getUseIndices() {
return this.useIndices;
}
/** Returns the value of the <code>use-indices-unique</code> attribute. */
- public String getUseIndicesUnique() {
+ public boolean getUseIndicesUnique() {
return this.useIndicesUnique;
}
/** Returns the value of the <code>check-indices-on-start</code> attribute. */
- public String getCheckIndicesOnStart() {
+ public boolean getCheckIndicesOnStart() {
return this.checkIndicesOnStart;
}
@@ -359,27 +341,27 @@ public final class Datasource {
}
/** Returns the value of the <code>alias-view-columns</code> attribute. */
- public String getAliasViewColumns() {
+ public boolean getAliasViewColumns() {
return this.aliasViewColumns;
}
/** Returns the value of the <code>always-use-constraint-keyword</code> attribute. */
- public String getAlwaysUseConstraintKeyword() {
+ public boolean getAlwaysUseConstraintKeyword() {
return this.alwaysUseConstraintKeyword;
}
/** Returns the value of the <code>drop-fk-use-foreign-key-keyword</code> attribute. */
- public String getDropFkUseForeignKeyKeyword() {
+ public boolean getDropFkUseForeignKeyKeyword() {
return this.dropFkUseForeignKeyKeyword;
}
/** Returns the value of the <code>use-binary-type-for-blob</code> attribute. */
- public String getUseBinaryTypeForBlob() {
+ public boolean getUseBinaryTypeForBlob() {
return this.useBinaryTypeForBlob;
}
/** Returns the value of the <code>use-order-by-nulls</code> attribute. */
- public String getUseOrderByNulls() {
+ public boolean getUseOrderByNulls() {
return this.useOrderByNulls;
}
@@ -404,7 +386,7 @@ public final class Datasource {
}
/** Returns the value of the <code>max-worker-pool-size</code> attribute. */
- public String getMaxWorkerPoolSize() {
+ public int getMaxWorkerPoolSize() {
return this.maxWorkerPoolSize;
}
@@ -417,4 +399,19 @@ public final class Datasource {
public List<ReadData> getReadDataList() {
return this.readDataList;
}
+
+ /** Returns the <code><inline-jdbc></code> child element. */
+ public InlineJdbc getInlineJdbc() {
+ return this.inlineJdbc;
+ }
+
+ /** Returns the <code><jndi-jdbc></code> child element. */
+ public JndiJdbc getJndiJdbc() {
+ return this.jndiJdbc;
+ }
+
+ /** Returns the <code><tyrex-dataSource></code> child element. */
+ public TyrexDataSource getTyrexDataSource() {
+ return this.tyrexDataSource;
+ }
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -30,18 +31,19 @@ import org.w3c.dom.Element;
@ThreadSafe
public final class DebugXaResources {
- private final String value; // type = xs:string
+ private final boolean value; // type = xs:string
public DebugXaResources(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String value = element.getAttribute("value").intern();
if (value.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element value attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element value attribute is empty" + lineNumberText);
}
- this.value = value;
+ this.value = "true".equals(value);
}
/** Returns the value of the <code>value</code> attribute. */
- public String getValue() {
+ public boolean getValue() {
return this.value;
}
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -50,19 +51,20 @@ public final class Delegator {
private final List<GroupMap> groupMapList; // <group-map>
public Delegator(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
String entityModelReader = element.getAttribute("entity-model-reader").intern();
if (entityModelReader.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element entity-model-reader attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element entity-model-reader attribute is empty" + lineNumberText);
}
this.entityModelReader = entityModelReader;
String entityGroupReader = element.getAttribute("entity-group-reader").intern();
if (entityGroupReader.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element entity-group-reader attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element entity-group-reader attribute is empty" + lineNumberText);
}
this.entityGroupReader = entityGroupReader;
this.entityEcaReader = element.getAttribute("entity-eca-reader").intern();
@@ -100,7 +102,7 @@ public final class Delegator {
this.keyEncryptingKey = element.getAttribute("key-encrypting-key").intern();
List<? extends Element> groupMapElementList = UtilXml.childElementList(element, "group-map");
if (groupMapElementList.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements <group-map> are missing");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements <group-map> are missing" + lineNumberText);
} else {
List<GroupMap> groupMapList = new ArrayList<GroupMap>(groupMapElementList.size());
for (Element groupMapElement : groupMapElementList) {
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -39,9 +40,10 @@ public final class EntityDataReader {
private final List<Resource> resourceList; // <resource>
public EntityDataReader(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
List<? extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -39,9 +40,10 @@ public final class EntityEcaReader {
private final List<Resource> resourceList; // <resource>
public EntityEcaReader(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
List<? extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -41,9 +42,10 @@ public final class EntityGroupReader {
private final List<Resource> resourceList; // <resource>
public EntityGroupReader(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
this.loader = element.getAttribute("loader").intern();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java Fri Jun 7 08:21:22 2013
@@ -25,6 +25,7 @@ import java.util.List;
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;
/**
@@ -39,9 +40,10 @@ public final class EntityModelReader {
private final List<Resource> resourceList; // <resource>
public EntityModelReader(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
List<? extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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,19 +36,20 @@ public final class FieldType {
private final String location; // type = xs:string
public FieldType(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
String loader = element.getAttribute("loader").intern();
if (loader.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty" + lineNumberText);
}
this.loader = loader;
String location = element.getAttribute("location").intern();
if (location.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty" + lineNumberText);
}
this.location = location;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -34,14 +35,15 @@ public final class GroupMap {
private final String datasourceName; // type = xs:string
public GroupMap(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String groupName = element.getAttribute("group-name").intern();
if (groupName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element group-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element group-name attribute is empty" + lineNumberText);
}
this.groupName = groupName;
String datasourceName = element.getAttribute("datasource-name").intern();
if (datasourceName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element datasource-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element datasource-name attribute is empty" + lineNumberText);
}
this.datasourceName = datasourceName;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -28,80 +29,124 @@ import org.w3c.dom.Element;
* @see <code>entity-config.xsd</code>
*/
@ThreadSafe
-public final class InlineJdbc {
+public final class InlineJdbc extends JdbcElement {
private final String jdbcDriver; // type = xs:string
private final String jdbcUri; // type = xs:string
private final String jdbcUsername; // type = xs:string
private final String jdbcPassword; // type = xs:string
private final String jdbcPasswordLookup; // type = xs:string
- private final String isolationLevel;
- private final String poolMaxsize; // type = xs:nonNegativeInteger
- private final String poolMinsize; // type = xs:nonNegativeInteger
- private final String idleMaxsize; // type = xs:nonNegativeInteger
- private final String timeBetweenEvictionRunsMillis; // type = xs:nonNegativeInteger
- private final String poolSleeptime; // type = xs:nonNegativeInteger
- private final String poolLifetime; // type = xs:nonNegativeInteger
- private final String poolDeadlockMaxwait; // type = xs:nonNegativeInteger
- private final String poolDeadlockRetrywait; // type = xs:nonNegativeInteger
+ private final int poolMaxsize; // type = xs:nonNegativeInteger
+ private final int poolMinsize; // type = xs:nonNegativeInteger
+ private final int idleMaxsize; // type = xs:nonNegativeInteger
+ private final int timeBetweenEvictionRunsMillis; // type = xs:nonNegativeInteger
+ private final int poolSleeptime; // type = xs:nonNegativeInteger
+ private final int poolLifetime; // type = xs:nonNegativeInteger
+ private final int poolDeadlockMaxwait; // type = xs:nonNegativeInteger
+ private final int poolDeadlockRetrywait; // type = xs:nonNegativeInteger
private final String poolJdbcTestStmt; // type = xs:string
private final String poolXaWrapperClass; // type = xs:string
public InlineJdbc(Element element) throws GenericEntityConfException {
+ super(element);
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String jdbcDriver = element.getAttribute("jdbc-driver").intern();
if (jdbcDriver.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-driver attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-driver attribute is empty" + lineNumberText);
}
this.jdbcDriver = jdbcDriver;
String jdbcUri = element.getAttribute("jdbc-uri").intern();
if (jdbcUri.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-uri attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-uri attribute is empty" + lineNumberText);
}
this.jdbcUri = jdbcUri;
String jdbcUsername = element.getAttribute("jdbc-username").intern();
if (jdbcUsername.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-username attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-username attribute is empty" + lineNumberText);
}
this.jdbcUsername = jdbcUsername;
this.jdbcPassword = element.getAttribute("jdbc-password").intern();
this.jdbcPasswordLookup = element.getAttribute("jdbc-password-lookup").intern();
- this.isolationLevel = element.getAttribute("isolation-level").intern();
- String poolMaxsize = element.getAttribute("pool-maxsize").intern();
+ String poolMaxsize = element.getAttribute("pool-maxsize");
if (poolMaxsize.isEmpty()) {
- poolMaxsize = "50";
+ this.poolMaxsize = 50;
+ } else {
+ try {
+ this.poolMaxsize = Integer.parseInt(poolMaxsize);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-maxsize attribute is invalid" + lineNumberText);
+ }
}
- this.poolMaxsize = poolMaxsize;
- String poolMinsize = element.getAttribute("pool-minsize").intern();
+ String poolMinsize = element.getAttribute("pool-minsize");
if (poolMinsize.isEmpty()) {
- poolMinsize = "2";
+ this.poolMinsize = 2;
+ } else {
+ try {
+ this.poolMinsize = Integer.parseInt(poolMinsize);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-minsize attribute is invalid" + lineNumberText);
+ }
+ }
+ String idleMaxsize = element.getAttribute("idle-maxsize");
+ if (idleMaxsize.isEmpty()) {
+ this.idleMaxsize = this.poolMaxsize / 2;
+ } else {
+ try {
+ this.idleMaxsize = Integer.parseInt(idleMaxsize);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element idle-maxsize attribute is invalid" + lineNumberText);
+ }
}
- this.poolMinsize = poolMinsize;
- this.idleMaxsize = element.getAttribute("idle-maxsize").intern();
- String timeBetweenEvictionRunsMillis = element.getAttribute("time-between-eviction-runs-millis").intern();
+ String timeBetweenEvictionRunsMillis = element.getAttribute("time-between-eviction-runs-millis");
if (timeBetweenEvictionRunsMillis.isEmpty()) {
- timeBetweenEvictionRunsMillis = "600000";
+ this.timeBetweenEvictionRunsMillis = 600000;
+ } else {
+ try {
+ this.timeBetweenEvictionRunsMillis = Integer.parseInt(timeBetweenEvictionRunsMillis);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element time-between-eviction-runs-millis attribute is invalid" + lineNumberText);
+ }
}
- this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
- String poolSleeptime = element.getAttribute("pool-sleeptime").intern();
+ String poolSleeptime = element.getAttribute("pool-sleeptime");
if (poolSleeptime.isEmpty()) {
- poolSleeptime = "300000";
+ this.poolSleeptime = 300000;
+ } else {
+ try {
+ this.poolSleeptime = Integer.parseInt(poolSleeptime);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-sleeptime attribute is invalid" + lineNumberText);
+ }
}
- this.poolSleeptime = poolSleeptime;
- String poolLifetime = element.getAttribute("pool-lifetime").intern();
+ String poolLifetime = element.getAttribute("pool-lifetime");
if (poolLifetime.isEmpty()) {
- poolLifetime = "600000";
+ this.poolLifetime = 600000;
+ } else {
+ try {
+ this.poolLifetime = Integer.parseInt(poolLifetime);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-lifetime attribute is invalid" + lineNumberText);
+ }
}
- this.poolLifetime = poolLifetime;
- String poolDeadlockMaxwait = element.getAttribute("pool-deadlock-maxwait").intern();
+ String poolDeadlockMaxwait = element.getAttribute("pool-deadlock-maxwait");
if (poolDeadlockMaxwait.isEmpty()) {
- poolDeadlockMaxwait = "300000";
+ this.poolDeadlockMaxwait = 300000;
+ } else {
+ try {
+ this.poolDeadlockMaxwait = Integer.parseInt(poolDeadlockMaxwait);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-deadlock-maxwait attribute is invalid" + lineNumberText);
+ }
}
- this.poolDeadlockMaxwait = poolDeadlockMaxwait;
- String poolDeadlockRetrywait = element.getAttribute("pool-deadlock-retrywait").intern();
+ String poolDeadlockRetrywait = element.getAttribute("pool-deadlock-retrywait");
if (poolDeadlockRetrywait.isEmpty()) {
- poolDeadlockRetrywait = "10000";
+ this.poolDeadlockRetrywait = 10000;
+ } else {
+ try {
+ this.poolDeadlockRetrywait = Integer.parseInt(poolDeadlockRetrywait);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element pool-deadlock-retrywait attribute is invalid" + lineNumberText);
+ }
}
- this.poolDeadlockRetrywait = poolDeadlockRetrywait;
this.poolJdbcTestStmt = element.getAttribute("pool-jdbc-test-stmt").intern();
this.poolXaWrapperClass = element.getAttribute("pool-xa-wrapper-class").intern();
}
@@ -131,48 +176,43 @@ public final class InlineJdbc {
return this.jdbcPasswordLookup;
}
- /** Returns the value of the <code>isolation-level</code> attribute. */
- public String getIsolationLevel() {
- return this.isolationLevel;
- }
-
/** Returns the value of the <code>pool-maxsize</code> attribute. */
- public String getPoolMaxsize() {
+ public int getPoolMaxsize() {
return this.poolMaxsize;
}
/** Returns the value of the <code>pool-minsize</code> attribute. */
- public String getPoolMinsize() {
+ public int getPoolMinsize() {
return this.poolMinsize;
}
/** Returns the value of the <code>idle-maxsize</code> attribute. */
- public String getIdleMaxsize() {
+ public int getIdleMaxsize() {
return this.idleMaxsize;
}
/** Returns the value of the <code>time-between-eviction-runs-millis</code> attribute. */
- public String getTimeBetweenEvictionRunsMillis() {
+ public int getTimeBetweenEvictionRunsMillis() {
return this.timeBetweenEvictionRunsMillis;
}
/** Returns the value of the <code>pool-sleeptime</code> attribute. */
- public String getPoolSleeptime() {
+ public int getPoolSleeptime() {
return this.poolSleeptime;
}
/** Returns the value of the <code>pool-lifetime</code> attribute. */
- public String getPoolLifetime() {
+ public int getPoolLifetime() {
return this.poolLifetime;
}
/** Returns the value of the <code>pool-deadlock-maxwait</code> attribute. */
- public String getPoolDeadlockMaxwait() {
+ public int getPoolDeadlockMaxwait() {
return this.poolDeadlockMaxwait;
}
/** Returns the value of the <code>pool-deadlock-retrywait</code> attribute. */
- public String getPoolDeadlockRetrywait() {
+ public int getPoolDeadlockRetrywait() {
return this.poolDeadlockRetrywait;
}
Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java?rev=1490535&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java Fri Jun 7 08:21:22 2013
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.entity.config.model;
+
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An abstract class for <code><datasource></code> JDBC child elements.
+ *
+ * @see <code>entity-config.xsd</code>
+ */
+public abstract class JdbcElement {
+
+ private final String isolationLevel;
+
+ public JdbcElement(Element element) throws GenericEntityConfException {
+ this.isolationLevel = element.getAttribute("isolation-level").intern();
+ }
+
+ /** Returns the value of the <code>isolation-level</code> attribute. */
+ public String getIsolationLevel() {
+ return this.isolationLevel;
+ }
+}
Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JdbcElement.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Rev URL
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -28,24 +29,24 @@ import org.w3c.dom.Element;
* @see <code>entity-config.xsd</code>
*/
@ThreadSafe
-public final class JndiJdbc {
+public final class JndiJdbc extends JdbcElement {
private final String jndiServerName; // type = xs:string
private final String jndiName; // type = xs:string
- private final String isolationLevel;
public JndiJdbc(Element element) throws GenericEntityConfException {
+ super(element);
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String jndiServerName = element.getAttribute("jndi-server-name").intern();
if (jndiServerName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty" + lineNumberText);
}
this.jndiServerName = jndiServerName;
String jndiName = element.getAttribute("jndi-name").intern();
if (jndiName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty" + lineNumberText);
}
this.jndiName = jndiName;
- this.isolationLevel = element.getAttribute("isolation-level").intern();
}
/** Returns the value of the <code>jndi-server-name</code> attribute. */
@@ -57,9 +58,4 @@ public final class JndiJdbc {
public String getJndiName() {
return this.jndiName;
}
-
- /** Returns the value of the <code>isolation-level</code> attribute. */
- public String getIsolationLevel() {
- return this.isolationLevel;
- }
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -33,9 +34,10 @@ public final class ReadData {
private final String readerName; // type = xs:string
public ReadData(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String readerName = element.getAttribute("reader-name").intern();
if (readerName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element reader-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element reader-name attribute is empty" + lineNumberText);
}
this.readerName = readerName;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Resource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Resource.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Resource.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Resource.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -34,14 +35,15 @@ public final class Resource {
private final String location; // type = xs:string
public Resource(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String loader = element.getAttribute("loader").intern();
if (loader.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty" + lineNumberText);
}
this.loader = loader;
String location = element.getAttribute("location").intern();
if (location.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty" + lineNumberText);
}
this.location = location;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -36,14 +37,15 @@ public final class ResourceLoader {
private final String prefix; // type = xs:string
public ResourceLoader(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty" + lineNumberText);
}
this.name = name;
String className = element.getAttribute("class").intern();
if (className.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty" + lineNumberText);
}
this.className = className;
this.prependEnv = element.getAttribute("prepend-env").intern();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -34,9 +35,10 @@ public final class SqlLoadPath {
private final String prependEnv; // type = xs:string
public SqlLoadPath(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String path = element.getAttribute("path").intern();
if (path.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element path attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element path attribute is empty" + lineNumberText);
}
this.path = path;
this.prependEnv = element.getAttribute("prepend-env").intern();
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java Fri Jun 7 08:21:22 2013
@@ -21,6 +21,7 @@ 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;
/**
@@ -36,9 +37,10 @@ public final class TransactionFactory {
private final TransactionManagerJndi transactionManagerJndi; // <transaction-manager-jndi>
public TransactionFactory(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String className = element.getAttribute("class").intern();
if (className.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty" + lineNumberText);
}
this.className = className;
Element userTransactionJndiElement = UtilXml.firstChildElement(element, "user-transaction-jndi");
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -34,14 +35,15 @@ public final class TransactionManagerJnd
private final String jndiName; // type = xs:string
public TransactionManagerJndi(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String jndiServerName = element.getAttribute("jndi-server-name").intern();
if (jndiServerName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty" + lineNumberText);
}
this.jndiServerName = jndiServerName;
String jndiName = element.getAttribute("jndi-name").intern();
if (jndiName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty" + lineNumberText);
}
this.jndiName = jndiName;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -28,27 +29,22 @@ import org.w3c.dom.Element;
* @see <code>entity-config.xsd</code>
*/
@ThreadSafe
-public final class TyrexDataSource {
+public final class TyrexDataSource extends JdbcElement {
private final String dataSourceName; // type = xs:string
- private final String isolationLevel;
public TyrexDataSource(Element element) throws GenericEntityConfException {
+ super(element);
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String dataSourceName = element.getAttribute("dataSource-name").intern();
if (dataSourceName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element dataSource-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element dataSource-name attribute is empty" + lineNumberText);
}
this.dataSourceName = dataSourceName;
- this.isolationLevel = element.getAttribute("isolation-level").intern();
}
/** Returns the value of the <code>dataSource-name</code> attribute. */
public String getDataSourceName() {
return this.dataSourceName;
}
-
- /** Returns the value of the <code>isolation-level</code> attribute. */
- public String getIsolationLevel() {
- return this.isolationLevel;
- }
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java?rev=1490535&r1=1490534&r2=1490535&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java Fri Jun 7 08:21:22 2013
@@ -20,6 +20,7 @@ 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;
/**
@@ -34,14 +35,15 @@ public final class UserTransactionJndi {
private final String jndiName; // type = xs:string
public UserTransactionJndi(Element element) throws GenericEntityConfException {
+ String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String jndiServerName = element.getAttribute("jndi-server-name").intern();
if (jndiServerName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty" + lineNumberText);
}
this.jndiServerName = jndiServerName;
String jndiName = element.getAttribute("jndi-name").intern();
if (jndiName.isEmpty()) {
- throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty" + lineNumberText);
}
this.jndiName = jndiName;
}