diff --git a/framework/entity/src/org/ofbiz/entity/config/EntityConfigListener.java b/framework/entity/src/org/ofbiz/entity/config/EntityConfigListener.java
new file mode 100644
index 0000000000..c0f9bf5282
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/EntityConfigListener.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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;
+
+import org.ofbiz.entity.config.model.EntityConfig;
+
+/**
+ * An object that receives notifications when the entityengine.xml file is reloaded.
+ */
+public interface EntityConfigListener {
+
+ /**
+ * Processes entityengine.xml changes.
+ *
+ * @param entityConfig The new EntityConfig instance.
+ */
+ void onEntityConfigChange(EntityConfig entityConfig);
+
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java b/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
index 63bff9415c..727701e37f 100644
--- a/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
+++ b/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
@@ -18,18 +18,25 @@
*******************************************************************************/
package org.ofbiz.entity.config;
+import java.net.URL;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.config.ResourceLoader;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilURL;
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.GenericEntityException;
+import org.ofbiz.entity.config.model.EntityConfig;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
@@ -40,6 +47,43 @@ public class EntityConfigUtil {
public static final String module = EntityConfigUtil.class.getName();
public static final String ENTITY_ENGINE_XML_FILENAME = "entityengine.xml";
+ // Keep the EntityConfig instance in a cache - so the configuration can be reloaded at run-time. There will be only one EntityConfig instance in the cache.
+ private static final UtilCache entityConfigCache = UtilCache.createUtilCache("entity.EntityConfig", 0, 0, false);
+ private static final List configListeners = new CopyOnWriteArrayList();
+
+ /**
+ * Returns the EntityConfig instance.
+ * @throws GenericEntityConfException
+ */
+ public static EntityConfig getEntityConfig() throws GenericEntityConfException {
+ EntityConfig instance = entityConfigCache.get("instance");
+ if (instance == null) {
+ Element entityConfigElement = getXmlDocument().getDocumentElement();
+ instance = new EntityConfig(entityConfigElement);
+ entityConfigCache.putIfAbsent("instance", instance);
+ instance = entityConfigCache.get("instance");
+ for (EntityConfigListener listener : configListeners) {
+ try {
+ listener.onEntityConfigChange(instance);
+ } catch (Exception e) {
+ Debug.logError(e, "Exception thrown while notifying listener " + listener + ": ", module);
+ }
+ }
+ }
+ return instance;
+ }
+
+ private static Document getXmlDocument() throws GenericEntityConfException {
+ URL confUrl = UtilURL.fromResource(ENTITY_ENGINE_XML_FILENAME);
+ if (confUrl == null) {
+ throw new GenericEntityConfException("Could not find the " + ENTITY_ENGINE_XML_FILENAME + " file");
+ }
+ try {
+ return UtilXml.readXmlDocument(confUrl, true, true);
+ } catch (Exception e) {
+ throw new GenericEntityConfException("Exception thrown while reading " + ENTITY_ENGINE_XML_FILENAME + ": ", e);
+ }
+ }
private static volatile AtomicReference configRef = new AtomicReference();
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java b/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java
new file mode 100644
index 0000000000..26840aa5a2
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/ConnectionFactory.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <connection-factory> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class ConnectionFactory {
+
+ private final String className; // type = xs:string
+
+ public ConnectionFactory(Element element) throws GenericEntityConfException {
+ String className = element.getAttribute("class").intern();
+ if (className.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ }
+ this.className = className;
+ }
+
+ /** Returns the value of the class attribute. */
+ public String getClassName() {
+ return this.className;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java b/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java
new file mode 100644
index 0000000000..8b6b6cf3b6
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <datasource> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class Datasource {
+
+ 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 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 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 String fkStyle;
+ private final String useFkInitiallyDeferred;
+ private final String useIndices;
+ private final String useIndicesUnique;
+ private final String 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 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 List sqlLoadPathList; //
+ private final List readDataList; //
+
+ public Datasource(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ String helperClass = element.getAttribute("helper-class").intern();
+ if (helperClass.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element helper-class attribute is empty");
+ }
+ 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");
+ }
+ this.fieldTypeName = fieldTypeName;
+ String useSchemas = element.getAttribute("use-schemas").intern();
+ if (useSchemas.isEmpty()) {
+ useSchemas = "true";
+ }
+ this.useSchemas = useSchemas;
+ 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();
+ if (constraintNameClipLength.isEmpty()) {
+ constraintNameClipLength = "30";
+ }
+ this.constraintNameClipLength = constraintNameClipLength;
+ String useProxyCursor = element.getAttribute("use-proxy-cursor").intern();
+ if (useProxyCursor.isEmpty()) {
+ useProxyCursor = "false";
+ }
+ this.useProxyCursor = useProxyCursor;
+ 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();
+ 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.checkFkIndicesOnStart = checkFkIndicesOnStart;
+ 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;
+ 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;
+ String offsetStyle = element.getAttribute("offset-style").intern();
+ if (offsetStyle.isEmpty()) {
+ offsetStyle = "none";
+ }
+ this.offsetStyle = offsetStyle;
+ this.tableType = element.getAttribute("table-type").intern();
+ this.characterSet = element.getAttribute("character-set").intern();
+ this.collate = element.getAttribute("collate").intern();
+ String maxWorkerPoolSize = element.getAttribute("max-worker-pool-size").intern();
+ if (maxWorkerPoolSize.isEmpty()) {
+ maxWorkerPoolSize = "0";
+ }
+ this.maxWorkerPoolSize = maxWorkerPoolSize;
+ List extends Element> sqlLoadPathElementList = UtilXml.childElementList(element, "sql-load-path");
+ if (sqlLoadPathElementList.isEmpty()) {
+ this.sqlLoadPathList = Collections.emptyList();
+ } else {
+ List sqlLoadPathList = new ArrayList(sqlLoadPathElementList.size());
+ for (Element sqlLoadPathElement : sqlLoadPathElementList) {
+ sqlLoadPathList.add(new SqlLoadPath(sqlLoadPathElement));
+ }
+ this.sqlLoadPathList = Collections.unmodifiableList(sqlLoadPathList);
+ }
+ List extends Element> readDataElementList = UtilXml.childElementList(element, "read-data");
+ if (readDataElementList.isEmpty()) {
+ this.readDataList = Collections.emptyList();
+ } else {
+ List readDataList = new ArrayList(readDataElementList.size());
+ for (Element readDataElement : readDataElementList) {
+ readDataList.add(new ReadData(readDataElement));
+ }
+ this.readDataList = Collections.unmodifiableList(readDataList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the value of the helper-class attribute. */
+ public String getHelperClass() {
+ return this.helperClass;
+ }
+
+ /** Returns the value of the field-type-name attribute. */
+ public String getFieldTypeName() {
+ return this.fieldTypeName;
+ }
+
+ /** Returns the value of the use-schemas attribute. */
+ public String getUseSchemas() {
+ return this.useSchemas;
+ }
+
+ /** Returns the value of the schema-name attribute. */
+ public String getSchemaName() {
+ return this.schemaName;
+ }
+
+ /** Returns the value of the check-on-start attribute. */
+ public String getCheckOnStart() {
+ return this.checkOnStart;
+ }
+
+ /** Returns the value of the add-missing-on-start attribute. */
+ public String getAddMissingOnStart() {
+ return this.addMissingOnStart;
+ }
+
+ /** Returns the value of the use-pk-constraint-names attribute. */
+ public String getUsePkConstraintNames() {
+ return this.usePkConstraintNames;
+ }
+
+ /** Returns the value of the check-pks-on-start attribute. */
+ public String getCheckPksOnStart() {
+ return this.checkPksOnStart;
+ }
+
+ /** Returns the value of the constraint-name-clip-length attribute. */
+ public String getConstraintNameClipLength() {
+ return this.constraintNameClipLength;
+ }
+
+ /** Returns the value of the use-proxy-cursor attribute. */
+ public String getUseProxyCursor() {
+ return this.useProxyCursor;
+ }
+
+ /** Returns the value of the proxy-cursor-name attribute. */
+ public String getProxyCursorName() {
+ return this.proxyCursorName;
+ }
+
+ /** Returns the value of the result-fetch-size attribute. */
+ public String getResultFetchSize() {
+ return this.resultFetchSize;
+ }
+
+ /** Returns the value of the use-foreign-keys attribute. */
+ public String getUseForeignKeys() {
+ return this.useForeignKeys;
+ }
+
+ /** Returns the value of the use-foreign-key-indices attribute. */
+ public String getUseForeignKeyIndices() {
+ return this.useForeignKeyIndices;
+ }
+
+ /** Returns the value of the check-fks-on-start attribute. */
+ public String getCheckFksOnStart() {
+ return this.checkFksOnStart;
+ }
+
+ /** Returns the value of the check-fk-indices-on-start attribute. */
+ public String getCheckFkIndicesOnStart() {
+ return this.checkFkIndicesOnStart;
+ }
+
+ /** Returns the value of the fk-style attribute. */
+ public String getFkStyle() {
+ return this.fkStyle;
+ }
+
+ /** Returns the value of the use-fk-initially-deferred attribute. */
+ public String getUseFkInitiallyDeferred() {
+ return this.useFkInitiallyDeferred;
+ }
+
+ /** Returns the value of the use-indices attribute. */
+ public String getUseIndices() {
+ return this.useIndices;
+ }
+
+ /** Returns the value of the use-indices-unique attribute. */
+ public String getUseIndicesUnique() {
+ return this.useIndicesUnique;
+ }
+
+ /** Returns the value of the check-indices-on-start attribute. */
+ public String getCheckIndicesOnStart() {
+ return this.checkIndicesOnStart;
+ }
+
+ /** Returns the value of the join-style attribute. */
+ public String getJoinStyle() {
+ return this.joinStyle;
+ }
+
+ /** Returns the value of the alias-view-columns attribute. */
+ public String getAliasViewColumns() {
+ return this.aliasViewColumns;
+ }
+
+ /** Returns the value of the always-use-constraint-keyword attribute. */
+ public String getAlwaysUseConstraintKeyword() {
+ return this.alwaysUseConstraintKeyword;
+ }
+
+ /** Returns the value of the drop-fk-use-foreign-key-keyword attribute. */
+ public String getDropFkUseForeignKeyKeyword() {
+ return this.dropFkUseForeignKeyKeyword;
+ }
+
+ /** Returns the value of the use-binary-type-for-blob attribute. */
+ public String getUseBinaryTypeForBlob() {
+ return this.useBinaryTypeForBlob;
+ }
+
+ /** Returns the value of the use-order-by-nulls attribute. */
+ public String getUseOrderByNulls() {
+ return this.useOrderByNulls;
+ }
+
+ /** Returns the value of the offset-style attribute. */
+ public String getOffsetStyle() {
+ return this.offsetStyle;
+ }
+
+ /** Returns the value of the table-type attribute. */
+ public String getTableType() {
+ return this.tableType;
+ }
+
+ /** Returns the value of the character-set attribute. */
+ public String getCharacterSet() {
+ return this.characterSet;
+ }
+
+ /** Returns the value of the collate attribute. */
+ public String getCollate() {
+ return this.collate;
+ }
+
+ /** Returns the value of the max-worker-pool-size attribute. */
+ public String getMaxWorkerPoolSize() {
+ return this.maxWorkerPoolSize;
+ }
+
+ /** Returns the <sql-load-path> child elements. */
+ public List getSqlLoadPathList() {
+ return this.sqlLoadPathList;
+ }
+
+ /** Returns the <read-data> child elements. */
+ public List getReadDataList() {
+ return this.readDataList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java b/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java
new file mode 100644
index 0000000000..012bb85206
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/DebugXaResources.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <debug-xa-resources> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class DebugXaResources {
+
+ private final String value; // type = xs:string
+
+ public DebugXaResources(Element element) throws GenericEntityConfException {
+ String value = element.getAttribute("value").intern();
+ if (value.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element value attribute is empty");
+ }
+ this.value = value;
+ }
+
+ /** Returns the value of the value attribute. */
+ public String getValue() {
+ return this.value;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java b/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
new file mode 100644
index 0000000000..24e6f6370d
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <delegator> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class Delegator {
+
+ private final String name; // type = xs:string
+ private final String entityModelReader; // type = xs:string
+ private final String entityGroupReader; // type = xs:string
+ private final String entityEcaReader; // type = xs:string
+ private final String entityEcaEnabled;
+ private final String entityEcaHandlerClassName; // type = xs:string
+ private final String distributedCacheClearEnabled;
+ private final String distributedCacheClearClassName; // type = xs:string
+ private final String distributedCacheClearUserLoginId; // type = xs:string
+ private final String sequencedIdPrefix; // type = xs:string
+ private final String defaultGroupName; // type = xs:string
+ private final String keyEncryptingKey; // type = xs:string
+ private final List groupMapList; //
+
+ public Delegator(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ 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");
+ }
+ 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");
+ }
+ this.entityGroupReader = entityGroupReader;
+ this.entityEcaReader = element.getAttribute("entity-eca-reader").intern();
+ String entityEcaEnabled = element.getAttribute("entity-eca-enabled").intern();
+ if (entityEcaEnabled.isEmpty()) {
+ entityEcaEnabled = "true";
+ }
+ this.entityEcaEnabled = entityEcaEnabled;
+ String entityEcaHandlerClassName = element.getAttribute("entity-eca-handler-class-name").intern();
+ if (entityEcaHandlerClassName.isEmpty()) {
+ entityEcaHandlerClassName = "org.ofbiz.entityext.eca.DelegatorEcaHandler";
+ }
+ this.entityEcaHandlerClassName = entityEcaHandlerClassName;
+ String distributedCacheClearEnabled = element.getAttribute("distributed-cache-clear-enabled").intern();
+ if (distributedCacheClearEnabled.isEmpty()) {
+ distributedCacheClearEnabled = "false";
+ }
+ this.distributedCacheClearEnabled = distributedCacheClearEnabled;
+ String distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name").intern();
+ if (distributedCacheClearClassName.isEmpty()) {
+ distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices";
+ }
+ this.distributedCacheClearClassName = distributedCacheClearClassName;
+ String distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id").intern();
+ if (distributedCacheClearUserLoginId.isEmpty()) {
+ distributedCacheClearUserLoginId = "system";
+ }
+ this.distributedCacheClearUserLoginId = distributedCacheClearUserLoginId;
+ this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix").intern();
+ String defaultGroupName = element.getAttribute("default-group-name").intern();
+ if (defaultGroupName.isEmpty()) {
+ defaultGroupName = "org.ofbiz";
+ }
+ this.defaultGroupName = defaultGroupName;
+ 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 are missing");
+ } else {
+ List groupMapList = new ArrayList(groupMapElementList.size());
+ for (Element groupMapElement : groupMapElementList) {
+ groupMapList.add(new GroupMap(groupMapElement));
+ }
+ this.groupMapList = Collections.unmodifiableList(groupMapList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the value of the entity-model-reader attribute. */
+ public String getEntityModelReader() {
+ return this.entityModelReader;
+ }
+
+ /** Returns the value of the entity-group-reader attribute. */
+ public String getEntityGroupReader() {
+ return this.entityGroupReader;
+ }
+
+ /** Returns the value of the entity-eca-reader attribute. */
+ public String getEntityEcaReader() {
+ return this.entityEcaReader;
+ }
+
+ /** Returns the value of the entity-eca-enabled attribute. */
+ public String getEntityEcaEnabled() {
+ return this.entityEcaEnabled;
+ }
+
+ /** Returns the value of the entity-eca-handler-class-name attribute. */
+ public String getEntityEcaHandlerClassName() {
+ return this.entityEcaHandlerClassName;
+ }
+
+ /** Returns the value of the distributed-cache-clear-enabled attribute. */
+ public String getDistributedCacheClearEnabled() {
+ return this.distributedCacheClearEnabled;
+ }
+
+ /** Returns the value of the distributed-cache-clear-class-name attribute. */
+ public String getDistributedCacheClearClassName() {
+ return this.distributedCacheClearClassName;
+ }
+
+ /** Returns the value of the distributed-cache-clear-user-login-id attribute. */
+ public String getDistributedCacheClearUserLoginId() {
+ return this.distributedCacheClearUserLoginId;
+ }
+
+ /** Returns the value of the sequenced-id-prefix attribute. */
+ public String getSequencedIdPrefix() {
+ return this.sequencedIdPrefix;
+ }
+
+ /** Returns the value of the default-group-name attribute. */
+ public String getDefaultGroupName() {
+ return this.defaultGroupName;
+ }
+
+ /** Returns the value of the key-encrypting-key attribute. */
+ public String getKeyEncryptingKey() {
+ return this.keyEncryptingKey;
+ }
+
+ /** Returns the <group-map> child elements. */
+ public List getGroupMapList() {
+ return this.groupMapList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java b/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java
new file mode 100644
index 0000000000..f29b9959ef
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <entity-config> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class EntityConfig {
+
+ private final List resourceLoaderList; //
+ private final TransactionFactory transactionFactory; //
+ private final ConnectionFactory connectionFactory; //
+ private final DebugXaResources debugXaResources; //
+ private final List delegatorList; //
+ private final List entityModelReaderList; //
+ private final List entityGroupReaderList; //
+ private final List entityEcaReaderList; //
+ private final List entityDataReaderList; //
+ private final List fieldTypeList; //
+ private final List datasourceList; //
+
+ public EntityConfig(Element element) throws GenericEntityConfException {
+ List extends Element> resourceLoaderElementList = UtilXml.childElementList(element, "resource-loader");
+ if (resourceLoaderElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List resourceLoaderList = new ArrayList(resourceLoaderElementList.size());
+ for (Element resourceLoaderElement : resourceLoaderElementList) {
+ resourceLoaderList.add(new ResourceLoader(resourceLoaderElement));
+ }
+ this.resourceLoaderList = Collections.unmodifiableList(resourceLoaderList);
+ }
+ Element transactionFactoryElement = UtilXml.firstChildElement(element, "transaction-factory");
+ if (transactionFactoryElement == null) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child element is missing");
+ } else {
+ this.transactionFactory = new TransactionFactory(transactionFactoryElement);
+ }
+ Element connectionFactoryElement = UtilXml.firstChildElement(element, "connection-factory");
+ if (connectionFactoryElement == null) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child element is missing");
+ } else {
+ this.connectionFactory = new ConnectionFactory(connectionFactoryElement);
+ }
+ Element debugXaResourcesElement = UtilXml.firstChildElement(element, "debug-xa-resources");
+ if (debugXaResourcesElement == null) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child element is missing");
+ } else {
+ this.debugXaResources = new DebugXaResources(debugXaResourcesElement);
+ }
+ List extends Element> delegatorElementList = UtilXml.childElementList(element, "delegator");
+ if (delegatorElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List delegatorList = new ArrayList(delegatorElementList.size());
+ for (Element delegatorElement : delegatorElementList) {
+ delegatorList.add(new Delegator(delegatorElement));
+ }
+ this.delegatorList = Collections.unmodifiableList(delegatorList);
+ }
+ List extends Element> entityModelReaderElementList = UtilXml.childElementList(element, "entity-model-reader");
+ if (entityModelReaderElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List entityModelReaderList = new ArrayList(entityModelReaderElementList.size());
+ for (Element entityModelReaderElement : entityModelReaderElementList) {
+ entityModelReaderList.add(new EntityModelReader(entityModelReaderElement));
+ }
+ this.entityModelReaderList = Collections.unmodifiableList(entityModelReaderList);
+ }
+ List extends Element> entityGroupReaderElementList = UtilXml.childElementList(element, "entity-group-reader");
+ if (entityGroupReaderElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List entityGroupReaderList = new ArrayList(entityGroupReaderElementList.size());
+ for (Element entityGroupReaderElement : entityGroupReaderElementList) {
+ entityGroupReaderList.add(new EntityGroupReader(entityGroupReaderElement));
+ }
+ this.entityGroupReaderList = Collections.unmodifiableList(entityGroupReaderList);
+ }
+ List extends Element> entityEcaReaderElementList = UtilXml.childElementList(element, "entity-eca-reader");
+ if (entityEcaReaderElementList.isEmpty()) {
+ this.entityEcaReaderList = Collections.emptyList();
+ } else {
+ List entityEcaReaderList = new ArrayList(entityEcaReaderElementList.size());
+ for (Element entityEcaReaderElement : entityEcaReaderElementList) {
+ entityEcaReaderList.add(new EntityEcaReader(entityEcaReaderElement));
+ }
+ this.entityEcaReaderList = Collections.unmodifiableList(entityEcaReaderList);
+ }
+ List extends Element> entityDataReaderElementList = UtilXml.childElementList(element, "entity-data-reader");
+ if (entityDataReaderElementList.isEmpty()) {
+ this.entityDataReaderList = Collections.emptyList();
+ } else {
+ List entityDataReaderList = new ArrayList(entityDataReaderElementList.size());
+ for (Element entityDataReaderElement : entityDataReaderElementList) {
+ entityDataReaderList.add(new EntityDataReader(entityDataReaderElement));
+ }
+ this.entityDataReaderList = Collections.unmodifiableList(entityDataReaderList);
+ }
+ List extends Element> fieldTypeElementList = UtilXml.childElementList(element, "field-type");
+ if (fieldTypeElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List fieldTypeList = new ArrayList(fieldTypeElementList.size());
+ for (Element fieldTypeElement : fieldTypeElementList) {
+ fieldTypeList.add(new FieldType(fieldTypeElement));
+ }
+ this.fieldTypeList = Collections.unmodifiableList(fieldTypeList);
+ }
+ List extends Element> datasourceElementList = UtilXml.childElementList(element, "datasource");
+ if (datasourceElementList.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements are missing");
+ } else {
+ List datasourceList = new ArrayList(datasourceElementList.size());
+ for (Element datasourceElement : datasourceElementList) {
+ datasourceList.add(new Datasource(datasourceElement));
+ }
+ this.datasourceList = Collections.unmodifiableList(datasourceList);
+ }
+ }
+
+ /** Returns the <resource-loader> child elements. */
+ public List getResourceLoaderList() {
+ return this.resourceLoaderList;
+ }
+
+ /** Returns the <transaction-factory> child element, or null if no child element was found. */
+ public TransactionFactory getTransactionFactory() {
+ return this.transactionFactory;
+ }
+
+ /** Returns the <connection-factory> child element, or null if no child element was found. */
+ public ConnectionFactory getConnectionFactory() {
+ return this.connectionFactory;
+ }
+
+ /** Returns the <debug-xa-resources> child element, or null if no child element was found. */
+ public DebugXaResources getDebugXaResources() {
+ return this.debugXaResources;
+ }
+
+ /** Returns the <delegator> child elements. */
+ public List getDelegatorList() {
+ return this.delegatorList;
+ }
+
+ /** Returns the <entity-model-reader> child elements. */
+ public List getEntityModelReaderList() {
+ return this.entityModelReaderList;
+ }
+
+ /** Returns the <entity-group-reader> child elements. */
+ public List getEntityGroupReaderList() {
+ return this.entityGroupReaderList;
+ }
+
+ /** Returns the <entity-eca-reader> child elements. */
+ public List getEntityEcaReaderList() {
+ return this.entityEcaReaderList;
+ }
+
+ /** Returns the <entity-data-reader> child elements. */
+ public List getEntityDataReaderList() {
+ return this.entityDataReaderList;
+ }
+
+ /** Returns the <field-type> child elements. */
+ public List getFieldTypeList() {
+ return this.fieldTypeList;
+ }
+
+ /** Returns the <datasource> child elements. */
+ public List getDatasourceList() {
+ return this.datasourceList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java b/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java
new file mode 100644
index 0000000000..74b9191517
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/EntityDataReader.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <entity-data-reader> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class EntityDataReader {
+
+ private final String name; // type = xs:string
+ private final List resourceList; //
+
+ public EntityDataReader(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ List extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
+ if (resourceElementList.isEmpty()) {
+ this.resourceList = Collections.emptyList();
+ } else {
+ List resourceList = new ArrayList(resourceElementList.size());
+ for (Element resourceElement : resourceElementList) {
+ resourceList.add(new Resource(resourceElement));
+ }
+ this.resourceList = Collections.unmodifiableList(resourceList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the <resource> child elements. */
+ public List getResourceList() {
+ return this.resourceList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java b/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java
new file mode 100644
index 0000000000..91c6e76e5e
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/EntityEcaReader.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <entity-eca-reader> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class EntityEcaReader {
+
+ private final String name; // type = xs:string
+ private final List resourceList; //
+
+ public EntityEcaReader(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ List extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
+ if (resourceElementList.isEmpty()) {
+ this.resourceList = Collections.emptyList();
+ } else {
+ List resourceList = new ArrayList(resourceElementList.size());
+ for (Element resourceElement : resourceElementList) {
+ resourceList.add(new Resource(resourceElement));
+ }
+ this.resourceList = Collections.unmodifiableList(resourceList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the <resource> child elements. */
+ public List getResourceList() {
+ return this.resourceList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java b/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java
new file mode 100644
index 0000000000..291aa15bd6
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/EntityGroupReader.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <entity-group-reader> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class EntityGroupReader {
+
+ private final String name; // type = xs:string
+ private final String loader; // type = xs:string
+ private final String location; // type = xs:string
+ private final List resourceList; //
+
+ public EntityGroupReader(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ this.loader = element.getAttribute("loader").intern();
+ this.location = element.getAttribute("location").intern();
+ List extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
+ if (resourceElementList.isEmpty()) {
+ this.resourceList = Collections.emptyList();
+ } else {
+ List resourceList = new ArrayList(resourceElementList.size());
+ for (Element resourceElement : resourceElementList) {
+ resourceList.add(new Resource(resourceElement));
+ }
+ this.resourceList = Collections.unmodifiableList(resourceList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the value of the loader attribute. */
+ public String getLoader() {
+ return this.loader;
+ }
+
+ /** Returns the value of the location attribute. */
+ public String getLocation() {
+ return this.location;
+ }
+
+ /** Returns the <resource> child elements. */
+ public List getResourceList() {
+ return this.resourceList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java b/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java
new file mode 100644
index 0000000000..b62cbd49ff
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/EntityModelReader.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <entity-model-reader> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class EntityModelReader {
+
+ private final String name; // type = xs:string
+ private final List resourceList; //
+
+ public EntityModelReader(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ List extends Element> resourceElementList = UtilXml.childElementList(element, "resource");
+ if (resourceElementList.isEmpty()) {
+ this.resourceList = Collections.emptyList();
+ } else {
+ List resourceList = new ArrayList(resourceElementList.size());
+ for (Element resourceElement : resourceElementList) {
+ resourceList.add(new Resource(resourceElement));
+ }
+ this.resourceList = Collections.unmodifiableList(resourceList);
+ }
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the <resource> child elements. */
+ public List getResourceList() {
+ return this.resourceList;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java b/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java
new file mode 100644
index 0000000000..95d8b72ef3
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/FieldType.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <field-type> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class FieldType {
+
+ private final String name; // type = xs:string
+ private final String loader; // type = xs:string
+ private final String location; // type = xs:string
+
+ public FieldType(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ String loader = element.getAttribute("loader").intern();
+ if (loader.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty");
+ }
+ this.loader = loader;
+ String location = element.getAttribute("location").intern();
+ if (location.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty");
+ }
+ this.location = location;
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the value of the loader attribute. */
+ public String getLoader() {
+ return this.loader;
+ }
+
+ /** Returns the value of the location attribute. */
+ public String getLocation() {
+ return this.location;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java b/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java
new file mode 100644
index 0000000000..3cfd9fb396
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/GroupMap.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <group-map> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class GroupMap {
+
+ private final String groupName; // type = xs:string
+ private final String datasourceName; // type = xs:string
+
+ public GroupMap(Element element) throws GenericEntityConfException {
+ String groupName = element.getAttribute("group-name").intern();
+ if (groupName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element group-name attribute is empty");
+ }
+ this.groupName = groupName;
+ String datasourceName = element.getAttribute("datasource-name").intern();
+ if (datasourceName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element datasource-name attribute is empty");
+ }
+ this.datasourceName = datasourceName;
+ }
+
+ /** Returns the value of the group-name attribute. */
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ /** Returns the value of the datasource-name attribute. */
+ public String getDatasourceName() {
+ return this.datasourceName;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java b/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java
new file mode 100644
index 0000000000..de8cc4100f
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/InlineJdbc.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <inline-jdbc> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class InlineJdbc {
+
+ 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 String poolJdbcTestStmt; // type = xs:string
+ private final String poolXaWrapperClass; // type = xs:string
+
+ public InlineJdbc(Element element) throws GenericEntityConfException {
+ String jdbcDriver = element.getAttribute("jdbc-driver").intern();
+ if (jdbcDriver.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-driver attribute is empty");
+ }
+ this.jdbcDriver = jdbcDriver;
+ String jdbcUri = element.getAttribute("jdbc-uri").intern();
+ if (jdbcUri.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-uri attribute is empty");
+ }
+ this.jdbcUri = jdbcUri;
+ String jdbcUsername = element.getAttribute("jdbc-username").intern();
+ if (jdbcUsername.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jdbc-username attribute is empty");
+ }
+ 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();
+ if (poolMaxsize.isEmpty()) {
+ poolMaxsize = "50";
+ }
+ this.poolMaxsize = poolMaxsize;
+ String poolMinsize = element.getAttribute("pool-minsize").intern();
+ if (poolMinsize.isEmpty()) {
+ poolMinsize = "2";
+ }
+ this.poolMinsize = poolMinsize;
+ this.idleMaxsize = element.getAttribute("idle-maxsize").intern();
+ String timeBetweenEvictionRunsMillis = element.getAttribute("time-between-eviction-runs-millis").intern();
+ if (timeBetweenEvictionRunsMillis.isEmpty()) {
+ timeBetweenEvictionRunsMillis = "600000";
+ }
+ this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
+ String poolSleeptime = element.getAttribute("pool-sleeptime").intern();
+ if (poolSleeptime.isEmpty()) {
+ poolSleeptime = "300000";
+ }
+ this.poolSleeptime = poolSleeptime;
+ String poolLifetime = element.getAttribute("pool-lifetime").intern();
+ if (poolLifetime.isEmpty()) {
+ poolLifetime = "600000";
+ }
+ this.poolLifetime = poolLifetime;
+ String poolDeadlockMaxwait = element.getAttribute("pool-deadlock-maxwait").intern();
+ if (poolDeadlockMaxwait.isEmpty()) {
+ poolDeadlockMaxwait = "300000";
+ }
+ this.poolDeadlockMaxwait = poolDeadlockMaxwait;
+ String poolDeadlockRetrywait = element.getAttribute("pool-deadlock-retrywait").intern();
+ if (poolDeadlockRetrywait.isEmpty()) {
+ poolDeadlockRetrywait = "10000";
+ }
+ this.poolDeadlockRetrywait = poolDeadlockRetrywait;
+ this.poolJdbcTestStmt = element.getAttribute("pool-jdbc-test-stmt").intern();
+ this.poolXaWrapperClass = element.getAttribute("pool-xa-wrapper-class").intern();
+ }
+
+ /** Returns the value of the jdbc-driver attribute. */
+ public String getJdbcDriver() {
+ return this.jdbcDriver;
+ }
+
+ /** Returns the value of the jdbc-uri attribute. */
+ public String getJdbcUri() {
+ return this.jdbcUri;
+ }
+
+ /** Returns the value of the jdbc-username attribute. */
+ public String getJdbcUsername() {
+ return this.jdbcUsername;
+ }
+
+ /** Returns the value of the jdbc-password attribute. */
+ public String getJdbcPassword() {
+ return this.jdbcPassword;
+ }
+
+ /** Returns the value of the jdbc-password-lookup attribute. */
+ public String getJdbcPasswordLookup() {
+ return this.jdbcPasswordLookup;
+ }
+
+ /** Returns the value of the isolation-level attribute. */
+ public String getIsolationLevel() {
+ return this.isolationLevel;
+ }
+
+ /** Returns the value of the pool-maxsize attribute. */
+ public String getPoolMaxsize() {
+ return this.poolMaxsize;
+ }
+
+ /** Returns the value of the pool-minsize attribute. */
+ public String getPoolMinsize() {
+ return this.poolMinsize;
+ }
+
+ /** Returns the value of the idle-maxsize attribute. */
+ public String getIdleMaxsize() {
+ return this.idleMaxsize;
+ }
+
+ /** Returns the value of the time-between-eviction-runs-millis attribute. */
+ public String getTimeBetweenEvictionRunsMillis() {
+ return this.timeBetweenEvictionRunsMillis;
+ }
+
+ /** Returns the value of the pool-sleeptime attribute. */
+ public String getPoolSleeptime() {
+ return this.poolSleeptime;
+ }
+
+ /** Returns the value of the pool-lifetime attribute. */
+ public String getPoolLifetime() {
+ return this.poolLifetime;
+ }
+
+ /** Returns the value of the pool-deadlock-maxwait attribute. */
+ public String getPoolDeadlockMaxwait() {
+ return this.poolDeadlockMaxwait;
+ }
+
+ /** Returns the value of the pool-deadlock-retrywait attribute. */
+ public String getPoolDeadlockRetrywait() {
+ return this.poolDeadlockRetrywait;
+ }
+
+ /** Returns the value of the pool-jdbc-test-stmt attribute. */
+ public String getPoolJdbcTestStmt() {
+ return this.poolJdbcTestStmt;
+ }
+
+ /** Returns the value of the pool-xa-wrapper-class attribute. */
+ public String getPoolXaWrapperClass() {
+ return this.poolXaWrapperClass;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java b/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java
new file mode 100644
index 0000000000..cc9f7dc39f
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/JndiJdbc.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <jndi-jdbc> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class JndiJdbc {
+
+ private final String jndiServerName; // type = xs:string
+ private final String jndiName; // type = xs:string
+ private final String isolationLevel;
+
+ public JndiJdbc(Element element) throws GenericEntityConfException {
+ String jndiServerName = element.getAttribute("jndi-server-name").intern();
+ if (jndiServerName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ }
+ this.jndiServerName = jndiServerName;
+ String jndiName = element.getAttribute("jndi-name").intern();
+ if (jndiName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ }
+ this.jndiName = jndiName;
+ this.isolationLevel = element.getAttribute("isolation-level").intern();
+ }
+
+ /** Returns the value of the jndi-server-name attribute. */
+ public String getJndiServerName() {
+ return this.jndiServerName;
+ }
+
+ /** Returns the value of the jndi-name attribute. */
+ public String getJndiName() {
+ return this.jndiName;
+ }
+
+ /** Returns the value of the isolation-level attribute. */
+ public String getIsolationLevel() {
+ return this.isolationLevel;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java b/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java
new file mode 100644
index 0000000000..3f3711ab1d
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/ReadData.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <read-data> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class ReadData {
+
+ private final String readerName; // type = xs:string
+
+ public ReadData(Element element) throws GenericEntityConfException {
+ String readerName = element.getAttribute("reader-name").intern();
+ if (readerName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element reader-name attribute is empty");
+ }
+ this.readerName = readerName;
+ }
+
+ /** Returns the value of the reader-name attribute. */
+ public String getReaderName() {
+ return this.readerName;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/Resource.java b/framework/entity/src/org/ofbiz/entity/config/model/Resource.java
new file mode 100644
index 0000000000..fff3b45587
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/Resource.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <resource> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class Resource {
+
+ private final String loader; // type = xs:string
+ private final String location; // type = xs:string
+
+ public Resource(Element element) throws GenericEntityConfException {
+ String loader = element.getAttribute("loader").intern();
+ if (loader.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element loader attribute is empty");
+ }
+ this.loader = loader;
+ String location = element.getAttribute("location").intern();
+ if (location.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element location attribute is empty");
+ }
+ this.location = location;
+ }
+
+ /** Returns the value of the loader attribute. */
+ public String getLoader() {
+ return this.loader;
+ }
+
+ /** Returns the value of the location attribute. */
+ public String getLocation() {
+ return this.location;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java b/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java
new file mode 100644
index 0000000000..2d176e319a
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/ResourceLoader.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <resource-loader> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class ResourceLoader {
+
+ private final String name; // type = xs:string
+ private final String className; // type = xs:string
+ private final String prependEnv; // type = xs:string
+ private final String prefix; // type = xs:string
+
+ public ResourceLoader(Element element) throws GenericEntityConfException {
+ String name = element.getAttribute("name").intern();
+ if (name.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element name attribute is empty");
+ }
+ this.name = name;
+ String className = element.getAttribute("class").intern();
+ if (className.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ }
+ this.className = className;
+ this.prependEnv = element.getAttribute("prepend-env").intern();
+ this.prefix = element.getAttribute("prefix").intern();
+ }
+
+ /** Returns the value of the name attribute. */
+ public String getName() {
+ return this.name;
+ }
+
+ /** Returns the value of the class attribute. */
+ public String getClassName() {
+ return this.className;
+ }
+
+ /** Returns the value of the prepend-env attribute. */
+ public String getPrependEnv() {
+ return this.prependEnv;
+ }
+
+ /** Returns the value of the prefix attribute. */
+ public String getPrefix() {
+ return this.prefix;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java b/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java
new file mode 100644
index 0000000000..69b1b2346b
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/SqlLoadPath.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <sql-load-path> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class SqlLoadPath {
+
+ private final String path; // type = xs:string
+ private final String prependEnv; // type = xs:string
+
+ public SqlLoadPath(Element element) throws GenericEntityConfException {
+ String path = element.getAttribute("path").intern();
+ if (path.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element path attribute is empty");
+ }
+ this.path = path;
+ this.prependEnv = element.getAttribute("prepend-env").intern();
+ }
+
+ /** Returns the value of the path attribute. */
+ public String getPath() {
+ return this.path;
+ }
+
+ /** Returns the value of the prepend-env attribute. */
+ public String getPrependEnv() {
+ return this.prependEnv;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java b/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java
new file mode 100644
index 0000000000..83d293a4e0
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/TransactionFactory.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <transaction-factory> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class TransactionFactory {
+
+ private final String className; // type = xs:string
+ private final UserTransactionJndi userTransactionJndi; //
+ private final TransactionManagerJndi transactionManagerJndi; //
+
+ public TransactionFactory(Element element) throws GenericEntityConfException {
+ String className = element.getAttribute("class").intern();
+ if (className.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element class attribute is empty");
+ }
+ this.className = className;
+ Element userTransactionJndiElement = UtilXml.firstChildElement(element, "user-transaction-jndi");
+ if (userTransactionJndiElement == null) {
+ this.userTransactionJndi = null;
+ } else {
+ this.userTransactionJndi = new UserTransactionJndi(userTransactionJndiElement);
+ }
+ Element transactionManagerJndiElement = UtilXml.firstChildElement(element, "transaction-manager-jndi");
+ if (transactionManagerJndiElement == null) {
+ this.transactionManagerJndi = null;
+ } else {
+ this.transactionManagerJndi = new TransactionManagerJndi(transactionManagerJndiElement);
+ }
+ }
+
+ /** Returns the value of the class attribute. */
+ public String getClassName() {
+ return this.className;
+ }
+
+ /** Returns the <user-transaction-jndi> child element, or null if no child element was found. */
+ public UserTransactionJndi getUserTransactionJndi() {
+ return this.userTransactionJndi;
+ }
+
+ /** Returns the <transaction-manager-jndi> child element, or null if no child element was found. */
+ public TransactionManagerJndi getTransactionManagerJndi() {
+ return this.transactionManagerJndi;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java b/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java
new file mode 100644
index 0000000000..eeaf3f3491
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/TransactionManagerJndi.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <transaction-manager-jndi> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class TransactionManagerJndi {
+
+ private final String jndiServerName; // type = xs:string
+ private final String jndiName; // type = xs:string
+
+ public TransactionManagerJndi(Element element) throws GenericEntityConfException {
+ String jndiServerName = element.getAttribute("jndi-server-name").intern();
+ if (jndiServerName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ }
+ this.jndiServerName = jndiServerName;
+ String jndiName = element.getAttribute("jndi-name").intern();
+ if (jndiName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ }
+ this.jndiName = jndiName;
+ }
+
+ /** Returns the value of the jndi-server-name attribute. */
+ public String getJndiServerName() {
+ return this.jndiServerName;
+ }
+
+ /** Returns the value of the jndi-name attribute. */
+ public String getJndiName() {
+ return this.jndiName;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java b/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java
new file mode 100644
index 0000000000..b029d133d3
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/TyrexDataSource.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <tyrex-dataSource> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class TyrexDataSource {
+
+ private final String dataSourceName; // type = xs:string
+ private final String isolationLevel;
+
+ public TyrexDataSource(Element element) throws GenericEntityConfException {
+ String dataSourceName = element.getAttribute("dataSource-name").intern();
+ if (dataSourceName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element dataSource-name attribute is empty");
+ }
+ this.dataSourceName = dataSourceName;
+ this.isolationLevel = element.getAttribute("isolation-level").intern();
+ }
+
+ /** Returns the value of the dataSource-name attribute. */
+ public String getDataSourceName() {
+ return this.dataSourceName;
+ }
+
+ /** Returns the value of the isolation-level attribute. */
+ public String getIsolationLevel() {
+ return this.isolationLevel;
+ }
+}
diff --git a/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java b/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java
new file mode 100644
index 0000000000..3aec5822b7
--- /dev/null
+++ b/framework/entity/src/org/ofbiz/entity/config/model/UserTransactionJndi.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.base.lang.ThreadSafe;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.w3c.dom.Element;
+
+/**
+ * An object that models the <user-transaction-jndi> element.
+ *
+ * @see entity-config.xsd
+ */
+@ThreadSafe
+public final class UserTransactionJndi {
+
+ private final String jndiServerName; // type = xs:string
+ private final String jndiName; // type = xs:string
+
+ public UserTransactionJndi(Element element) throws GenericEntityConfException {
+ String jndiServerName = element.getAttribute("jndi-server-name").intern();
+ if (jndiServerName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-server-name attribute is empty");
+ }
+ this.jndiServerName = jndiServerName;
+ String jndiName = element.getAttribute("jndi-name").intern();
+ if (jndiName.isEmpty()) {
+ throw new GenericEntityConfException("<" + element.getNodeName() + "> element jndi-name attribute is empty");
+ }
+ this.jndiName = jndiName;
+ }
+
+ /** Returns the value of the jndi-server-name attribute. */
+ public String getJndiServerName() {
+ return this.jndiServerName;
+ }
+
+ /** Returns the value of the jndi-name attribute. */
+ public String getJndiName() {
+ return this.jndiName;
+ }
+}