You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/06/08 11:34:47 UTC
svn commit: r1490938 - in /ofbiz/trunk/framework:
entity/src/org/ofbiz/entity/ entity/src/org/ofbiz/entity/config/
entity/src/org/ofbiz/entity/config/model/
entity/src/org/ofbiz/entity/model/ entityext/src/org/ofbiz/entityext/eca/
service/src/org/ofbiz...
Author: adrianc
Date: Sat Jun 8 09:34:47 2013
New Revision: 1490938
URL: http://svn.apache.org/r1490938
Log:
Third pass at removing cached DOM tree code from EntityConfigUtil.java. I converted some of the code to use the new thread-safe models.
Added:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DelegatorElement.java
- copied, changed from r1490535, ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
Removed:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sat Jun 8 09:34:47 2013
@@ -48,9 +48,9 @@ import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.cache.Cache;
import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.config.DelegatorInfo;
import org.ofbiz.entity.config.EntityConfigUtil;
import org.ofbiz.entity.config.model.Datasource;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.datasource.GenericHelper;
import org.ofbiz.entity.datasource.GenericHelperFactory;
import org.ofbiz.entity.datasource.GenericHelperInfo;
@@ -98,7 +98,7 @@ public class GenericDelegator implements
protected String delegatorTenantId = null;
private String originalDelegatorName = null;
- protected DelegatorInfo delegatorInfo = null;
+ protected DelegatorElement delegatorInfo = null;
protected Cache cache = null;
@@ -206,7 +206,7 @@ public class GenericDelegator implements
protected GenericDelegator(String delegatorFullName) throws GenericEntityException {
//if (Debug.infoOn()) Debug.logInfo("Creating new Delegator with name \"" + delegatorFullName + "\".", module);
this.setDelegatorNames(delegatorFullName);
- this.delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorBaseName);
+ this.delegatorInfo = EntityConfigUtil.getDelegator(delegatorBaseName);
String kekText;
// before continuing, if there is a tenantId use the base delegator to see if it is valid
@@ -222,10 +222,10 @@ public class GenericDelegator implements
if (kekValue != null) {
kekText = kekValue.getString("kekText");
} else {
- kekText = this.delegatorInfo.kekText;
+ kekText = this.delegatorInfo.getKeyEncryptingKey();
}
} else {
- kekText = this.delegatorInfo.kekText;
+ kekText = this.delegatorInfo.getKeyEncryptingKey();
}
this.modelReader = ModelReader.getModelReader(delegatorBaseName);
@@ -315,11 +315,11 @@ public class GenericDelegator implements
return;
}
// If useEntityEca is false do nothing: the entityEcaHandler member field with a null value would cause its code to do nothing
- if (getDelegatorInfo().useEntityEca) {
+ if (this.delegatorInfo.getEntityEcaEnabled()) {
//time to do some tricks with manual class loading that resolves circular dependencies, like calling services
ClassLoader loader = Thread.currentThread().getContextClassLoader();
// initialize the entity eca handler
- String entityEcaHandlerClassName = getDelegatorInfo().entityEcaHandlerClassName;
+ String entityEcaHandlerClassName = this.delegatorInfo.getEntityEcaHandlerClassName();
try {
Class<?> eecahClass = loader.loadClass(entityEcaHandlerClassName);
@@ -368,10 +368,6 @@ public class GenericDelegator implements
return this.originalDelegatorName == null ? this.delegatorFullName : this.originalDelegatorName;
}
- protected DelegatorInfo getDelegatorInfo() {
- return this.delegatorInfo;
- }
-
/* (non-Javadoc)
* @see org.ofbiz.entity.Delegator#getModelReader()
*/
@@ -411,11 +407,11 @@ public class GenericDelegator implements
public Map<String, ModelEntity> getModelEntityMapByGroup(String groupName) throws GenericEntityException {
Set<String> entityNameSet = getModelGroupReader().getEntityNamesByGroup(groupName);
- if (this.getDelegatorInfo().defaultGroupName.equals(groupName)) {
+ if (this.delegatorInfo.getDefaultGroupName().equals(groupName)) {
// add all entities with no group name to the Set
Set<String> allEntityNames = this.getModelReader().getEntityNames();
for (String entityName: allEntityNames) {
- if (this.getDelegatorInfo().defaultGroupName.equals(getModelGroupReader().getEntityGroupName(entityName, this.delegatorBaseName))) {
+ if (this.delegatorInfo.getDefaultGroupName().equals(getModelGroupReader().getEntityGroupName(entityName, this.delegatorBaseName))) {
entityNameSet.add(entityName);
}
}
@@ -452,7 +448,7 @@ public class GenericDelegator implements
* @see org.ofbiz.entity.Delegator#getGroupHelperName(java.lang.String)
*/
public String getGroupHelperName(String groupName) {
- return this.getDelegatorInfo().groupMap.get(groupName);
+ return this.delegatorInfo.getGroupDataSource(groupName);
}
public GenericHelperInfo getGroupHelperInfo(String entityGroupName) {
@@ -2452,8 +2448,8 @@ public class GenericDelegator implements
throw new IllegalArgumentException("Could not get next sequenced ID for sequence name: " + seqName);
}
- if (UtilValidate.isNotEmpty(this.getDelegatorInfo().sequencedIdPrefix)) {
- return this.getDelegatorInfo().sequencedIdPrefix + nextSeqLong.toString();
+ if (UtilValidate.isNotEmpty(this.delegatorInfo.getSequencedIdPrefix())) {
+ return this.delegatorInfo.getSequencedIdPrefix() + nextSeqLong.toString();
} else {
return nextSeqLong.toString();
}
@@ -2531,7 +2527,7 @@ public class GenericDelegator implements
*/
public void setNextSubSeqId(GenericValue value, String seqFieldName, int numericPadding, int incrementBy) {
if (value != null && UtilValidate.isEmpty(value.getString(seqFieldName))) {
- String sequencedIdPrefix = this.getDelegatorInfo().sequencedIdPrefix;
+ String sequencedIdPrefix = this.delegatorInfo.getSequencedIdPrefix();
value.remove(seqFieldName);
GenericValue lookupValue = this.makeValue(value.getEntityName());
@@ -2896,12 +2892,12 @@ public class GenericDelegator implements
//time to do some tricks with manual class loading that resolves circular dependencies, like calling services
ClassLoader loader = Thread.currentThread().getContextClassLoader();
// initialize the distributedCacheClear mechanism
- String distributedCacheClearClassName = getDelegatorInfo().distributedCacheClearClassName;
+ String distributedCacheClearClassName = this.delegatorInfo.getDistributedCacheClearClassName();
try {
Class<?> dccClass = loader.loadClass(distributedCacheClearClassName);
this.distributedCacheClear = UtilGenerics.cast(dccClass.newInstance());
- this.distributedCacheClear.setDelegator(this, getDelegatorInfo().distributedCacheClearUserLoginId);
+ this.distributedCacheClear.setDelegator(this, this.delegatorInfo.getDistributedCacheClearUserLoginId());
} catch (ClassNotFoundException e) {
Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " was not found, distributed cache clearing will be disabled", module);
} catch (InstantiationException e) {
@@ -2917,7 +2913,7 @@ public class GenericDelegator implements
}
public boolean useDistributedCacheClear() {
- return this.getDelegatorInfo().useDistributedCacheClear;
+ return this.delegatorInfo.getDistributedCacheClearEnabled();
}
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Sat Jun 8 09:34:47 2013
@@ -20,12 +20,9 @@ package org.ofbiz.entity.config;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilURL;
@@ -33,8 +30,8 @@ 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.Datasource;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.config.model.EntityConfig;
import org.ofbiz.entity.config.model.EntityDataReader;
import org.ofbiz.entity.config.model.EntityEcaReader;
@@ -52,7 +49,7 @@ import org.w3c.dom.Element;
* Misc. utility method for dealing with the entityengine.xml file
*
*/
-public class EntityConfigUtil {
+public final class EntityConfigUtil {
public static final String module = EntityConfigUtil.class.getName();
public static final String ENTITY_ENGINE_XML_FILENAME = "entityengine.xml";
@@ -114,48 +111,6 @@ public class EntityConfigUtil {
return configListeners;
}
- private static volatile AtomicReference<EntityConfigUtil> configRef = new AtomicReference<EntityConfigUtil>();
-
- // ========== engine info fields ==========
- private final Map<String, DelegatorInfo> delegatorInfos = new HashMap<String, DelegatorInfo>();
-
- private static Element getXmlRootElement() throws GenericEntityConfException {
- try {
- return org.ofbiz.base.config.ResourceLoader.getXmlRootElement(ENTITY_ENGINE_XML_FILENAME);
- } catch (GenericConfigException e) {
- throw new GenericEntityConfException("Could not get entity engine XML root element", e);
- }
- }
-
- static {
- try {
- initialize(getXmlRootElement());
- } catch (Exception e) {
- Debug.logError(e, "Error loading entity config XML file " + ENTITY_ENGINE_XML_FILENAME, module);
- }
- }
-
- public static void reinitialize() throws GenericEntityException {
- try {
- org.ofbiz.base.config.ResourceLoader.invalidateDocument(ENTITY_ENGINE_XML_FILENAME);
- initialize(getXmlRootElement());
- } catch (Exception e) {
- throw new GenericEntityException("Error reloading entity config XML file " + ENTITY_ENGINE_XML_FILENAME, e);
- }
- }
-
- public static void initialize(Element rootElement) throws GenericEntityException {
- configRef.set(new EntityConfigUtil(rootElement));
- }
-
- private EntityConfigUtil(Element rootElement) throws GenericEntityException {
- // delegator - delegatorInfos
- for (Element curElement: UtilXml.childElementList(rootElement, "delegator")) {
- DelegatorInfo delegatorInfo = new DelegatorInfo(curElement);
- delegatorInfos.put(delegatorInfo.name, delegatorInfo);
- }
- }
-
public static String getTxFactoryClass() throws GenericEntityConfException {
return getEntityConfig().getTransactionFactory().getClassName();
}
@@ -192,8 +147,8 @@ public class EntityConfigUtil {
return getEntityConfig().getResourceLoader(name);
}
- public static DelegatorInfo getDelegatorInfo(String name) {
- return configRef.get().delegatorInfos.get(name);
+ public static DelegatorElement getDelegator(String name) throws GenericEntityConfException {
+ return getEntityConfig().getDelegator(name);
}
public static EntityModelReader getEntityModelReader(String name) throws GenericEntityConfException {
@@ -250,4 +205,6 @@ public class EntityConfigUtil {
}
return jdbcPassword;
}
+
+ private EntityConfigUtil() {}
}
Copied: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DelegatorElement.java (from r1490535, ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DelegatorElement.java?p2=ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DelegatorElement.java&p1=ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java&r1=1490535&r2=1490938&rev=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/Delegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/DelegatorElement.java Sat Jun 8 09:34:47 2013
@@ -21,6 +21,8 @@ package org.ofbiz.entity.config.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
import org.ofbiz.base.lang.ThreadSafe;
import org.ofbiz.base.util.UtilXml;
@@ -34,23 +36,24 @@ import org.w3c.dom.Element;
* @see <code>entity-config.xsd</code>
*/
@ThreadSafe
-public final class Delegator {
+public final class DelegatorElement {
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 boolean entityEcaEnabled;
private final String entityEcaHandlerClassName; // type = xs:string
- private final String distributedCacheClearEnabled;
+ private final boolean 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>
+ private final Map<String, String> groupMapMap; // <group-map>
- public Delegator(Element element) throws GenericEntityConfException {
+ public DelegatorElement(Element element) throws GenericEntityConfException {
String lineNumberText = EntityConfigUtil.createConfigFileLineNumberText(element);
String name = element.getAttribute("name").intern();
if (name.isEmpty()) {
@@ -68,21 +71,13 @@ public final class Delegator {
}
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;
+ this.entityEcaEnabled = !"false".equalsIgnoreCase(element.getAttribute("entity-eca-enabled"));
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;
+ this.distributedCacheClearEnabled = "true".equalsIgnoreCase(element.getAttribute("distributed-cache-clear-enabled"));
String distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name").intern();
if (distributedCacheClearClassName.isEmpty()) {
distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices";
@@ -105,10 +100,14 @@ public final class Delegator {
throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements <group-map> are missing" + lineNumberText);
} else {
List<GroupMap> groupMapList = new ArrayList<GroupMap>(groupMapElementList.size());
+ Map<String, String> groupMapMap = new HashMap<String, String>();
for (Element groupMapElement : groupMapElementList) {
- groupMapList.add(new GroupMap(groupMapElement));
+ GroupMap groupMap = new GroupMap(groupMapElement);
+ groupMapList.add(groupMap);
+ groupMapMap.put(groupMap.getGroupName(), groupMap.getDatasourceName());
}
this.groupMapList = Collections.unmodifiableList(groupMapList);
+ this.groupMapMap = Collections.unmodifiableMap(groupMapMap);
}
}
@@ -133,7 +132,7 @@ public final class Delegator {
}
/** Returns the value of the <code>entity-eca-enabled</code> attribute. */
- public String getEntityEcaEnabled() {
+ public boolean getEntityEcaEnabled() {
return this.entityEcaEnabled;
}
@@ -143,7 +142,7 @@ public final class Delegator {
}
/** Returns the value of the <code>distributed-cache-clear-enabled</code> attribute. */
- public String getDistributedCacheClearEnabled() {
+ public boolean getDistributedCacheClearEnabled() {
return this.distributedCacheClearEnabled;
}
@@ -176,4 +175,10 @@ public final class Delegator {
public List<GroupMap> getGroupMapList() {
return this.groupMapList;
}
+
+ /** Returns the specified <code><group-map> datasource-name</code> attribute value,
+ * or <code>null</code> if the <code><group-map></code> element does not exist . */
+ public String getGroupDataSource(String groupName) {
+ return this.groupMapMap.get(groupName);
+ }
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/model/EntityConfig.java Sat Jun 8 09:34:47 2013
@@ -42,7 +42,8 @@ public final class EntityConfig {
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<DelegatorElement> delegatorList; // <delegator>
+ private final Map<String, DelegatorElement> delegatorMap; // <delegator>
private final List<EntityModelReader> entityModelReaderList; // <entity-model-reader>
private final Map<String, EntityModelReader> entityModelReaderMap; // <entity-model-reader>
private final List<EntityGroupReader> entityGroupReaderList; // <entity-group-reader>
@@ -93,11 +94,15 @@ public final class EntityConfig {
if (delegatorElementList.isEmpty()) {
throw new GenericEntityConfException("<" + element.getNodeName() + "> element child elements <delegator> are missing");
} else {
- List<Delegator> delegatorList = new ArrayList<Delegator>(delegatorElementList.size());
+ List<DelegatorElement> delegatorList = new ArrayList<DelegatorElement>(delegatorElementList.size());
+ Map<String, DelegatorElement> delegatorMap = new HashMap<String, DelegatorElement>();
for (Element delegatorElement : delegatorElementList) {
- delegatorList.add(new Delegator(delegatorElement));
+ DelegatorElement delegator = new DelegatorElement(delegatorElement);
+ delegatorList.add(delegator);
+ delegatorMap.put(delegator.getName(), delegator);
}
this.delegatorList = Collections.unmodifiableList(delegatorList);
+ this.delegatorMap = Collections.unmodifiableMap(delegatorMap);
}
List<? extends Element> entityModelReaderElementList = UtilXml.childElementList(element, "entity-model-reader");
if (entityModelReaderElementList.isEmpty()) {
@@ -212,8 +217,13 @@ public final class EntityConfig {
return this.debugXaResources;
}
+ /** Returns the specified <code><delegator></code> child element, or <code>null</code> if no child element was found. */
+ public DelegatorElement getDelegator(String name) {
+ return this.delegatorMap.get(name);
+ }
+
/** Returns the <code><delegator></code> child elements. */
- public List<Delegator> getDelegatorList() {
+ public List<DelegatorElement> getDelegatorList() {
return this.delegatorList;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Sat Jun 8 09:34:47 2013
@@ -37,8 +37,8 @@ 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.config.DelegatorInfo;
import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.config.model.EntityGroupReader;
import org.ofbiz.entity.config.model.Resource;
import org.w3c.dom.Document;
@@ -62,13 +62,13 @@ public class ModelGroupReader implements
public List<ResourceHandler> entityGroupResourceHandlers = new LinkedList<ResourceHandler>();
public static ModelGroupReader getModelGroupReader(String delegatorName) throws GenericEntityConfException {
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorName);
+ DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
- String tempModelName = delegatorInfo.entityGroupReader;
+ String tempModelName = delegatorInfo.getEntityGroupReader();
ModelGroupReader reader = readers.get(tempModelName);
if (reader == null) {
@@ -169,11 +169,16 @@ public class ModelGroupReader implements
if (gc != null) {
String groupName = gc.get(entityName);
if (groupName == null) {
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorBaseName);
+ DelegatorElement delegatorInfo = null;
+ try {
+ delegatorInfo = EntityConfigUtil.getDelegator(delegatorBaseName);
+ } catch (GenericEntityConfException e) {
+ Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
+ }
if (delegatorInfo == null) {
throw new RuntimeException("Could not find DelegatorInfo for delegatorBaseName [" + delegatorBaseName + "]");
}
- groupName = delegatorInfo.defaultGroupName;
+ groupName = delegatorInfo.getDefaultGroupName();
}
return groupName;
} else {
@@ -188,11 +193,14 @@ public class ModelGroupReader implements
if (delegatorBaseName.indexOf('#') >= 0) {
delegatorBaseName = delegatorBaseName.substring(0, delegatorBaseName.indexOf('#'));
}
-
getGroupCache();
if (this.groupNames == null) return null;
Set<String> newSet = new HashSet<String>();
- newSet.add(EntityConfigUtil.getDelegatorInfo(delegatorBaseName).defaultGroupName);
+ try {
+ newSet.add(EntityConfigUtil.getDelegator(delegatorBaseName).getDefaultGroupName());
+ } catch (GenericEntityConfException e) {
+ Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
+ }
newSet.addAll(this.groupNames);
return newSet;
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Sat Jun 8 09:34:47 2013
@@ -42,8 +42,8 @@ import org.ofbiz.base.util.cache.UtilCac
import org.ofbiz.entity.GenericEntityConfException;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericModelException;
-import org.ofbiz.entity.config.DelegatorInfo;
import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.config.model.EntityModelReader;
import org.ofbiz.entity.config.model.Resource;
import org.w3c.dom.Document;
@@ -80,13 +80,13 @@ public class ModelReader implements Seri
protected Map<String, ResourceHandler> entityResourceHandlerMap;
public static ModelReader getModelReader(String delegatorName) throws GenericEntityException {
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorName);
+ DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
- String tempModelName = delegatorInfo.entityModelReader;
+ String tempModelName = delegatorInfo.getEntityModelReader();
ModelReader reader = readers.get(tempModelName);
if (reader == null) {
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java Sat Jun 8 09:34:47 2013
@@ -38,7 +38,6 @@ import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityConfException;
-import org.ofbiz.entity.config.DelegatorInfo;
import org.ofbiz.entity.config.EntityConfigUtil;
import org.ofbiz.entity.config.model.*;
import org.w3c.dom.Element;
@@ -63,12 +62,17 @@ public class EntityEcaUtil {
}
public static String getEntityEcaReaderName(String delegatorName) {
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorName);
+ DelegatorElement delegatorInfo = null;
+ try {
+ delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
+ } catch (GenericEntityConfException e) {
+ Debug.logWarning(e, "Exception thrown while getting field type config: ", module);
+ }
if (delegatorInfo == null) {
Debug.logError("BAD ERROR: Could not find delegator config with name: " + delegatorName, module);
return null;
}
- return delegatorInfo.entityEcaReader;
+ return delegatorInfo.getEntityEcaReader();
}
protected static void readConfig(String entityEcaReaderName, Map<String, Map<String, List<EntityEcaRule>>> ecaCache) {
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Sat Jun 8 09:34:47 2013
@@ -37,17 +37,16 @@ import org.ofbiz.base.config.GenericConf
import org.ofbiz.base.config.MainResourceHandler;
import org.ofbiz.base.config.ResourceHandler;
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.GenericEntityConfException;
import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.security.Security;
import org.ofbiz.service.config.ServiceConfigUtil;
import org.ofbiz.service.config.model.GlobalServices;
import org.ofbiz.service.eca.ServiceEcaUtil;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
* Dispatcher Context
@@ -83,9 +82,14 @@ public class DispatchContext implements
if (this.dispatcher != null) {
Delegator delegator = dispatcher.getDelegator();
if (delegator != null) {
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegator.getDelegatorBaseName());
+ DelegatorElement delegatorInfo = null;
+ try {
+ delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName());
+ } catch (GenericEntityConfException e) {
+ Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
+ }
if (delegatorInfo != null) {
- modelName = delegatorInfo.entityModelReader;
+ modelName = delegatorInfo.getEntityModelReader();
}
}
}
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Sat Jun 8 09:34:47 2013
@@ -43,7 +43,7 @@ import org.ofbiz.base.util.GeneralExcept
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.config.EntityConfigUtil;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelReader;
@@ -127,10 +127,10 @@ public class ArtifactInfoFactory {
protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
this.delegatorName = delegatorName;
this.entityModelReader = ModelReader.getModelReader(delegatorName);
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorName);
+ DelegatorElement delegatorInfo = EntityConfigUtil.getDelegator(delegatorName);
String modelName;
if (delegatorInfo != null) {
- modelName = delegatorInfo.entityModelReader;
+ modelName = delegatorInfo.getEntityModelReader();
} else {
modelName = "main";
}
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java?rev=1490938&r1=1490937&r2=1490938&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java Sat Jun 8 09:34:47 2013
@@ -34,12 +34,14 @@ import javolution.util.FastList;
import javolution.util.FastSet;
import org.ofbiz.base.component.ComponentConfig;
+import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.FileUtil;
import org.ofbiz.base.util.UtilFormatOut;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.GenericEntityConfException;
+import org.ofbiz.entity.config.model.DelegatorElement;
import org.ofbiz.entity.config.EntityConfigUtil;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelField;
@@ -69,10 +71,15 @@ public class LabelReferences {
public LabelReferences(Delegator delegator, LabelManagerFactory factory) {
this.delegator = delegator;
this.labels = factory.getLabels();
- DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegator.getDelegatorBaseName());
+ DelegatorElement delegatorInfo = null;
+ try {
+ delegatorInfo = EntityConfigUtil.getDelegator(delegator.getDelegatorBaseName());
+ } catch (GenericEntityConfException e) {
+ Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
+ }
String modelName;
if (delegatorInfo != null) {
- modelName = delegatorInfo.entityModelReader;
+ modelName = delegatorInfo.getEntityModelReader();
} else {
modelName = "main";
}