New models for the entityengine.xml file. These will be used to replace the DOM caching/parsing code in the same way as the service engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1490187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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 <code>entityengine.xml</code> file is reloaded.
|
||||
*/
|
||||
public interface EntityConfigListener {
|
||||
|
||||
/**
|
||||
* Processes <code>entityengine.xml</code> changes.
|
||||
*
|
||||
* @param entityConfig The new <code>EntityConfig</code> instance.
|
||||
*/
|
||||
void onEntityConfigChange(EntityConfig entityConfig);
|
||||
|
||||
}
|
||||
@@ -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<String, EntityConfig> entityConfigCache = UtilCache.createUtilCache("entity.EntityConfig", 0, 0, false);
|
||||
private static final List<EntityConfigListener> configListeners = new CopyOnWriteArrayList<EntityConfigListener>();
|
||||
|
||||
/**
|
||||
* Returns the <code>EntityConfig</code> 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<EntityConfigUtil> configRef = new AtomicReference<EntityConfigUtil>();
|
||||
|
||||
|
||||
@@ -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 <code><connection-factory></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>class</code> attribute. */
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><datasource></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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<SqlLoadPath> sqlLoadPathList; // <sql-load-path>
|
||||
private final List<ReadData> readDataList; // <read-data>
|
||||
|
||||
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<SqlLoadPath> sqlLoadPathList = new ArrayList<SqlLoadPath>(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<ReadData> readDataList = new ArrayList<ReadData>(readDataElementList.size());
|
||||
for (Element readDataElement : readDataElementList) {
|
||||
readDataList.add(new ReadData(readDataElement));
|
||||
}
|
||||
this.readDataList = Collections.unmodifiableList(readDataList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>helper-class</code> attribute. */
|
||||
public String getHelperClass() {
|
||||
return this.helperClass;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>field-type-name</code> attribute. */
|
||||
public String getFieldTypeName() {
|
||||
return this.fieldTypeName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-schemas</code> attribute. */
|
||||
public String getUseSchemas() {
|
||||
return this.useSchemas;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>schema-name</code> attribute. */
|
||||
public String getSchemaName() {
|
||||
return this.schemaName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>check-on-start</code> attribute. */
|
||||
public String getCheckOnStart() {
|
||||
return this.checkOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>add-missing-on-start</code> attribute. */
|
||||
public String getAddMissingOnStart() {
|
||||
return this.addMissingOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-pk-constraint-names</code> attribute. */
|
||||
public String getUsePkConstraintNames() {
|
||||
return this.usePkConstraintNames;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>check-pks-on-start</code> attribute. */
|
||||
public String getCheckPksOnStart() {
|
||||
return this.checkPksOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>constraint-name-clip-length</code> attribute. */
|
||||
public String getConstraintNameClipLength() {
|
||||
return this.constraintNameClipLength;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-proxy-cursor</code> attribute. */
|
||||
public String getUseProxyCursor() {
|
||||
return this.useProxyCursor;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>proxy-cursor-name</code> attribute. */
|
||||
public String getProxyCursorName() {
|
||||
return this.proxyCursorName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>result-fetch-size</code> attribute. */
|
||||
public String getResultFetchSize() {
|
||||
return this.resultFetchSize;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-foreign-keys</code> attribute. */
|
||||
public String getUseForeignKeys() {
|
||||
return this.useForeignKeys;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-foreign-key-indices</code> attribute. */
|
||||
public String getUseForeignKeyIndices() {
|
||||
return this.useForeignKeyIndices;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>check-fks-on-start</code> attribute. */
|
||||
public String getCheckFksOnStart() {
|
||||
return this.checkFksOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>check-fk-indices-on-start</code> attribute. */
|
||||
public String getCheckFkIndicesOnStart() {
|
||||
return this.checkFkIndicesOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>fk-style</code> attribute. */
|
||||
public String getFkStyle() {
|
||||
return this.fkStyle;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-fk-initially-deferred</code> attribute. */
|
||||
public String getUseFkInitiallyDeferred() {
|
||||
return this.useFkInitiallyDeferred;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-indices</code> attribute. */
|
||||
public String getUseIndices() {
|
||||
return this.useIndices;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-indices-unique</code> attribute. */
|
||||
public String getUseIndicesUnique() {
|
||||
return this.useIndicesUnique;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>check-indices-on-start</code> attribute. */
|
||||
public String getCheckIndicesOnStart() {
|
||||
return this.checkIndicesOnStart;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>join-style</code> attribute. */
|
||||
public String getJoinStyle() {
|
||||
return this.joinStyle;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>alias-view-columns</code> attribute. */
|
||||
public String getAliasViewColumns() {
|
||||
return this.aliasViewColumns;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>always-use-constraint-keyword</code> attribute. */
|
||||
public String getAlwaysUseConstraintKeyword() {
|
||||
return this.alwaysUseConstraintKeyword;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>drop-fk-use-foreign-key-keyword</code> attribute. */
|
||||
public String getDropFkUseForeignKeyKeyword() {
|
||||
return this.dropFkUseForeignKeyKeyword;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-binary-type-for-blob</code> attribute. */
|
||||
public String getUseBinaryTypeForBlob() {
|
||||
return this.useBinaryTypeForBlob;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>use-order-by-nulls</code> attribute. */
|
||||
public String getUseOrderByNulls() {
|
||||
return this.useOrderByNulls;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>offset-style</code> attribute. */
|
||||
public String getOffsetStyle() {
|
||||
return this.offsetStyle;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>table-type</code> attribute. */
|
||||
public String getTableType() {
|
||||
return this.tableType;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>character-set</code> attribute. */
|
||||
public String getCharacterSet() {
|
||||
return this.characterSet;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>collate</code> attribute. */
|
||||
public String getCollate() {
|
||||
return this.collate;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>max-worker-pool-size</code> attribute. */
|
||||
public String getMaxWorkerPoolSize() {
|
||||
return this.maxWorkerPoolSize;
|
||||
}
|
||||
|
||||
/** Returns the <code><sql-load-path></code> child elements. */
|
||||
public List<SqlLoadPath> getSqlLoadPathList() {
|
||||
return this.sqlLoadPathList;
|
||||
}
|
||||
|
||||
/** Returns the <code><read-data></code> child elements. */
|
||||
public List<ReadData> getReadDataList() {
|
||||
return this.readDataList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><debug-xa-resources></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>value</code> attribute. */
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><delegator></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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<GroupMap> groupMapList; // <group-map>
|
||||
|
||||
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 <group-map> are missing");
|
||||
} else {
|
||||
List<GroupMap> groupMapList = new ArrayList<GroupMap>(groupMapElementList.size());
|
||||
for (Element groupMapElement : groupMapElementList) {
|
||||
groupMapList.add(new GroupMap(groupMapElement));
|
||||
}
|
||||
this.groupMapList = Collections.unmodifiableList(groupMapList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>entity-model-reader</code> attribute. */
|
||||
public String getEntityModelReader() {
|
||||
return this.entityModelReader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>entity-group-reader</code> attribute. */
|
||||
public String getEntityGroupReader() {
|
||||
return this.entityGroupReader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>entity-eca-reader</code> attribute. */
|
||||
public String getEntityEcaReader() {
|
||||
return this.entityEcaReader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>entity-eca-enabled</code> attribute. */
|
||||
public String getEntityEcaEnabled() {
|
||||
return this.entityEcaEnabled;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>entity-eca-handler-class-name</code> attribute. */
|
||||
public String getEntityEcaHandlerClassName() {
|
||||
return this.entityEcaHandlerClassName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>distributed-cache-clear-enabled</code> attribute. */
|
||||
public String getDistributedCacheClearEnabled() {
|
||||
return this.distributedCacheClearEnabled;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>distributed-cache-clear-class-name</code> attribute. */
|
||||
public String getDistributedCacheClearClassName() {
|
||||
return this.distributedCacheClearClassName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>distributed-cache-clear-user-login-id</code> attribute. */
|
||||
public String getDistributedCacheClearUserLoginId() {
|
||||
return this.distributedCacheClearUserLoginId;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>sequenced-id-prefix</code> attribute. */
|
||||
public String getSequencedIdPrefix() {
|
||||
return this.sequencedIdPrefix;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>default-group-name</code> attribute. */
|
||||
public String getDefaultGroupName() {
|
||||
return this.defaultGroupName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>key-encrypting-key</code> attribute. */
|
||||
public String getKeyEncryptingKey() {
|
||||
return this.keyEncryptingKey;
|
||||
}
|
||||
|
||||
/** Returns the <code><group-map></code> child elements. */
|
||||
public List<GroupMap> getGroupMapList() {
|
||||
return this.groupMapList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><entity-config></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@ThreadSafe
|
||||
public final class EntityConfig {
|
||||
|
||||
private final List<ResourceLoader> resourceLoaderList; // <resource-loader>
|
||||
private final TransactionFactory transactionFactory; // <transaction-factory>
|
||||
private final ConnectionFactory connectionFactory; // <connection-factory>
|
||||
private final DebugXaResources debugXaResources; // <debug-xa-resources>
|
||||
private final List<Delegator> delegatorList; // <delegator>
|
||||
private final List<EntityModelReader> entityModelReaderList; // <entity-model-reader>
|
||||
private final List<EntityGroupReader> entityGroupReaderList; // <entity-group-reader>
|
||||
private final List<EntityEcaReader> entityEcaReaderList; // <entity-eca-reader>
|
||||
private final List<EntityDataReader> entityDataReaderList; // <entity-data-reader>
|
||||
private final List<FieldType> fieldTypeList; // <field-type>
|
||||
private final List<Datasource> datasourceList; // <datasource>
|
||||
|
||||
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 <resource-loader> are missing");
|
||||
} else {
|
||||
List<ResourceLoader> resourceLoaderList = new ArrayList<ResourceLoader>(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 <transaction-factory> 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 <connection-factory> 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 <debug-xa-resources> 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 <delegator> are missing");
|
||||
} else {
|
||||
List<Delegator> delegatorList = new ArrayList<Delegator>(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 <entity-model-reader> are missing");
|
||||
} else {
|
||||
List<EntityModelReader> entityModelReaderList = new ArrayList<EntityModelReader>(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 <entity-group-reader> are missing");
|
||||
} else {
|
||||
List<EntityGroupReader> entityGroupReaderList = new ArrayList<EntityGroupReader>(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<EntityEcaReader> entityEcaReaderList = new ArrayList<EntityEcaReader>(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<EntityDataReader> entityDataReaderList = new ArrayList<EntityDataReader>(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 <field-type> are missing");
|
||||
} else {
|
||||
List<FieldType> fieldTypeList = new ArrayList<FieldType>(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 <datasource> are missing");
|
||||
} else {
|
||||
List<Datasource> datasourceList = new ArrayList<Datasource>(datasourceElementList.size());
|
||||
for (Element datasourceElement : datasourceElementList) {
|
||||
datasourceList.add(new Datasource(datasourceElement));
|
||||
}
|
||||
this.datasourceList = Collections.unmodifiableList(datasourceList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the <code><resource-loader></code> child elements. */
|
||||
public List<ResourceLoader> getResourceLoaderList() {
|
||||
return this.resourceLoaderList;
|
||||
}
|
||||
|
||||
/** Returns the <code><transaction-factory></code> child element, or <code>null</code> if no child element was found. */
|
||||
public TransactionFactory getTransactionFactory() {
|
||||
return this.transactionFactory;
|
||||
}
|
||||
|
||||
/** Returns the <code><connection-factory></code> child element, or <code>null</code> if no child element was found. */
|
||||
public ConnectionFactory getConnectionFactory() {
|
||||
return this.connectionFactory;
|
||||
}
|
||||
|
||||
/** Returns the <code><debug-xa-resources></code> child element, or <code>null</code> if no child element was found. */
|
||||
public DebugXaResources getDebugXaResources() {
|
||||
return this.debugXaResources;
|
||||
}
|
||||
|
||||
/** Returns the <code><delegator></code> child elements. */
|
||||
public List<Delegator> getDelegatorList() {
|
||||
return this.delegatorList;
|
||||
}
|
||||
|
||||
/** Returns the <code><entity-model-reader></code> child elements. */
|
||||
public List<EntityModelReader> getEntityModelReaderList() {
|
||||
return this.entityModelReaderList;
|
||||
}
|
||||
|
||||
/** Returns the <code><entity-group-reader></code> child elements. */
|
||||
public List<EntityGroupReader> getEntityGroupReaderList() {
|
||||
return this.entityGroupReaderList;
|
||||
}
|
||||
|
||||
/** Returns the <code><entity-eca-reader></code> child elements. */
|
||||
public List<EntityEcaReader> getEntityEcaReaderList() {
|
||||
return this.entityEcaReaderList;
|
||||
}
|
||||
|
||||
/** Returns the <code><entity-data-reader></code> child elements. */
|
||||
public List<EntityDataReader> getEntityDataReaderList() {
|
||||
return this.entityDataReaderList;
|
||||
}
|
||||
|
||||
/** Returns the <code><field-type></code> child elements. */
|
||||
public List<FieldType> getFieldTypeList() {
|
||||
return this.fieldTypeList;
|
||||
}
|
||||
|
||||
/** Returns the <code><datasource></code> child elements. */
|
||||
public List<Datasource> getDatasourceList() {
|
||||
return this.datasourceList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><entity-data-reader></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@ThreadSafe
|
||||
public final class EntityDataReader {
|
||||
|
||||
private final String name; // type = xs:string
|
||||
private final List<Resource> resourceList; // <resource>
|
||||
|
||||
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<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
this.resourceList = Collections.unmodifiableList(resourceList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the <code><resource></code> child elements. */
|
||||
public List<Resource> getResourceList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><entity-eca-reader></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@ThreadSafe
|
||||
public final class EntityEcaReader {
|
||||
|
||||
private final String name; // type = xs:string
|
||||
private final List<Resource> resourceList; // <resource>
|
||||
|
||||
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<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
this.resourceList = Collections.unmodifiableList(resourceList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the <code><resource></code> child elements. */
|
||||
public List<Resource> getResourceList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><entity-group-reader></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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<Resource> resourceList; // <resource>
|
||||
|
||||
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<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
this.resourceList = Collections.unmodifiableList(resourceList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>loader</code> attribute. */
|
||||
public String getLoader() {
|
||||
return this.loader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>location</code> attribute. */
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
/** Returns the <code><resource></code> child elements. */
|
||||
public List<Resource> getResourceList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><entity-model-reader></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@ThreadSafe
|
||||
public final class EntityModelReader {
|
||||
|
||||
private final String name; // type = xs:string
|
||||
private final List<Resource> resourceList; // <resource>
|
||||
|
||||
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<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
this.resourceList = Collections.unmodifiableList(resourceList);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the <code><resource></code> child elements. */
|
||||
public List<Resource> getResourceList() {
|
||||
return this.resourceList;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><field-type></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>loader</code> attribute. */
|
||||
public String getLoader() {
|
||||
return this.loader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>location</code> attribute. */
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><group-map></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>group-name</code> attribute. */
|
||||
public String getGroupName() {
|
||||
return this.groupName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>datasource-name</code> attribute. */
|
||||
public String getDatasourceName() {
|
||||
return this.datasourceName;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><inline-jdbc></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>jdbc-driver</code> attribute. */
|
||||
public String getJdbcDriver() {
|
||||
return this.jdbcDriver;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jdbc-uri</code> attribute. */
|
||||
public String getJdbcUri() {
|
||||
return this.jdbcUri;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jdbc-username</code> attribute. */
|
||||
public String getJdbcUsername() {
|
||||
return this.jdbcUsername;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jdbc-password</code> attribute. */
|
||||
public String getJdbcPassword() {
|
||||
return this.jdbcPassword;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jdbc-password-lookup</code> attribute. */
|
||||
public String getJdbcPasswordLookup() {
|
||||
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() {
|
||||
return this.poolMaxsize;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-minsize</code> attribute. */
|
||||
public String getPoolMinsize() {
|
||||
return this.poolMinsize;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>idle-maxsize</code> attribute. */
|
||||
public String getIdleMaxsize() {
|
||||
return this.idleMaxsize;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>time-between-eviction-runs-millis</code> attribute. */
|
||||
public String getTimeBetweenEvictionRunsMillis() {
|
||||
return this.timeBetweenEvictionRunsMillis;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-sleeptime</code> attribute. */
|
||||
public String getPoolSleeptime() {
|
||||
return this.poolSleeptime;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-lifetime</code> attribute. */
|
||||
public String getPoolLifetime() {
|
||||
return this.poolLifetime;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-deadlock-maxwait</code> attribute. */
|
||||
public String getPoolDeadlockMaxwait() {
|
||||
return this.poolDeadlockMaxwait;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-deadlock-retrywait</code> attribute. */
|
||||
public String getPoolDeadlockRetrywait() {
|
||||
return this.poolDeadlockRetrywait;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-jdbc-test-stmt</code> attribute. */
|
||||
public String getPoolJdbcTestStmt() {
|
||||
return this.poolJdbcTestStmt;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>pool-xa-wrapper-class</code> attribute. */
|
||||
public String getPoolXaWrapperClass() {
|
||||
return this.poolXaWrapperClass;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><jndi-jdbc></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>jndi-server-name</code> attribute. */
|
||||
public String getJndiServerName() {
|
||||
return this.jndiServerName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jndi-name</code> attribute. */
|
||||
public String getJndiName() {
|
||||
return this.jndiName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>isolation-level</code> attribute. */
|
||||
public String getIsolationLevel() {
|
||||
return this.isolationLevel;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><read-data></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>reader-name</code> attribute. */
|
||||
public String getReaderName() {
|
||||
return this.readerName;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><resource></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>loader</code> attribute. */
|
||||
public String getLoader() {
|
||||
return this.loader;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>location</code> attribute. */
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><resource-loader></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>name</code> attribute. */
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>class</code> attribute. */
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>prepend-env</code> attribute. */
|
||||
public String getPrependEnv() {
|
||||
return this.prependEnv;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>prefix</code> attribute. */
|
||||
public String getPrefix() {
|
||||
return this.prefix;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><sql-load-path></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>path</code> attribute. */
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>prepend-env</code> attribute. */
|
||||
public String getPrependEnv() {
|
||||
return this.prependEnv;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><transaction-factory></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@ThreadSafe
|
||||
public final class TransactionFactory {
|
||||
|
||||
private final String className; // type = xs:string
|
||||
private final UserTransactionJndi userTransactionJndi; // <user-transaction-jndi>
|
||||
private final TransactionManagerJndi transactionManagerJndi; // <transaction-manager-jndi>
|
||||
|
||||
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 <code>class</code> attribute. */
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
/** Returns the <code><user-transaction-jndi></code> child element, or <code>null</code> if no child element was found. */
|
||||
public UserTransactionJndi getUserTransactionJndi() {
|
||||
return this.userTransactionJndi;
|
||||
}
|
||||
|
||||
/** Returns the <code><transaction-manager-jndi></code> child element, or <code>null</code> if no child element was found. */
|
||||
public TransactionManagerJndi getTransactionManagerJndi() {
|
||||
return this.transactionManagerJndi;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><transaction-manager-jndi></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>jndi-server-name</code> attribute. */
|
||||
public String getJndiServerName() {
|
||||
return this.jndiServerName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jndi-name</code> attribute. */
|
||||
public String getJndiName() {
|
||||
return this.jndiName;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><tyrex-dataSource></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <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;
|
||||
}
|
||||
}
|
||||
@@ -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 <code><user-transaction-jndi></code> element.
|
||||
*
|
||||
* @see <code>entity-config.xsd</code>
|
||||
*/
|
||||
@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 <code>jndi-server-name</code> attribute. */
|
||||
public String getJndiServerName() {
|
||||
return this.jndiServerName;
|
||||
}
|
||||
|
||||
/** Returns the value of the <code>jndi-name</code> attribute. */
|
||||
public String getJndiName() {
|
||||
return this.jndiName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user