svn commit: r585810 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config: DatasourceInfo.java DelegatorInfo.java EntityConfigUtil.java ResourceInfo.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585810 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config: DatasourceInfo.java DelegatorInfo.java EntityConfigUtil.java ResourceInfo.java

doogie-3
Author: doogie
Date: Wed Oct 17 20:08:36 2007
New Revision: 585810

URL: http://svn.apache.org/viewvc?rev=585810&view=rev
Log:
Java 1.5 markup for entity config classes.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?rev=585810&r1=585809&r2=585810&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java Wed Oct 17 20:08:36 2007
@@ -35,8 +35,8 @@
     public String name;
     public String helperClass;
     public String fieldTypeName;
-    public List sqlLoadPaths = new LinkedList();
-    public List readDatas = new LinkedList();
+    public List<? extends Element> sqlLoadPaths;
+    public List<? extends Element> readDatas;
     public Element datasourceElement;
     
     public static final int TYPE_JNDI_JDBC = 1;        

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java?rev=585810&r1=585809&r2=585810&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java Wed Oct 17 20:08:36 2007
@@ -42,7 +42,7 @@
     public String distributedCacheClearClassName;
     public String distributedCacheClearUserLoginId;
     public String sequencedIdPrefix;
-    public Map groupMap = new HashMap();
+    public Map<String, String> groupMap = new HashMap<String, String>();
 
     public DelegatorInfo(Element element) {
         super(element);
@@ -64,11 +64,7 @@
 
         this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix");
         
-        List groupMapList = UtilXml.childElementList(element, "group-map");
-        Iterator groupMapIter = groupMapList.iterator();
-
-        while (groupMapIter.hasNext()) {
-            Element groupMapElement = (Element) groupMapIter.next();
+        for (Element groupMapElement: UtilXml.childElementList(element, "group-map")) {
             groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name"));
         }
     }

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=585810&r1=585809&r2=585810&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 Wed Oct 17 20:08:36 2007
@@ -50,14 +50,14 @@
     protected static String txFactoryTxMgrJndiServerName;
     protected static String connFactoryClass;
 
-    protected static Map resourceLoaderInfos = FastMap.newInstance();
-    protected static Map delegatorInfos = FastMap.newInstance();
-    protected static Map entityModelReaderInfos = FastMap.newInstance();
-    protected static Map entityGroupReaderInfos = FastMap.newInstance();
-    protected static Map entityEcaReaderInfos = FastMap.newInstance();
-    protected static Map entityDataReaderInfos = FastMap.newInstance();
-    protected static Map fieldTypeInfos = FastMap.newInstance();
-    protected static Map datasourceInfos = FastMap.newInstance();
+    protected static Map<String, ResourceLoaderInfo> resourceLoaderInfos = FastMap.newInstance();
+    protected static Map<String, DelegatorInfo> delegatorInfos = FastMap.newInstance();
+    protected static Map<String, EntityModelReaderInfo> entityModelReaderInfos = FastMap.newInstance();
+    protected static Map<String, EntityGroupReaderInfo> entityGroupReaderInfos = FastMap.newInstance();
+    protected static Map<String, EntityEcaReaderInfo> entityEcaReaderInfos = FastMap.newInstance();
+    protected static Map<String, EntityDataReaderInfo> entityDataReaderInfos = FastMap.newInstance();
+    protected static Map<String, FieldTypeInfo> fieldTypeInfos = FastMap.newInstance();
+    protected static Map<String, DatasourceInfo> datasourceInfos = FastMap.newInstance();
 
     protected static Element getXmlRootElement() throws GenericEntityConfException {
         try {
@@ -128,77 +128,51 @@
         connFactoryClass = connectionFactoryElement.getAttribute("class");
 
         // not load all of the maps...
-        List childElements = null;
-        Iterator elementIter = null;
 
         // resource-loader - resourceLoaderInfos
-        childElements = UtilXml.childElementList(rootElement, "resource-loader");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "resource-loader")) {
             ResourceLoaderInfo resourceLoaderInfo = new ResourceLoaderInfo(curElement);
             resourceLoaderInfos.put(resourceLoaderInfo.name, resourceLoaderInfo);
         }
 
         // delegator - delegatorInfos
-        childElements = UtilXml.childElementList(rootElement, "delegator");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "delegator")) {
             DelegatorInfo delegatorInfo = new DelegatorInfo(curElement);
             delegatorInfos.put(delegatorInfo.name, delegatorInfo);
         }
 
         // entity-model-reader - entityModelReaderInfos
-        childElements = UtilXml.childElementList(rootElement, "entity-model-reader");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "entity-model-reader")) {
             EntityModelReaderInfo entityModelReaderInfo = new EntityModelReaderInfo(curElement);
             entityModelReaderInfos.put(entityModelReaderInfo.name, entityModelReaderInfo);
         }
 
         // entity-group-reader - entityGroupReaderInfos
-        childElements = UtilXml.childElementList(rootElement, "entity-group-reader");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "entity-group-reader")) {
             EntityGroupReaderInfo entityGroupReaderInfo = new EntityGroupReaderInfo(curElement);
             entityGroupReaderInfos.put(entityGroupReaderInfo.name, entityGroupReaderInfo);
         }
 
         // entity-eca-reader - entityEcaReaderInfos
-        childElements = UtilXml.childElementList(rootElement, "entity-eca-reader");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "entity-eca-reader")) {
             EntityEcaReaderInfo entityEcaReaderInfo = new EntityEcaReaderInfo(curElement);
             entityEcaReaderInfos.put(entityEcaReaderInfo.name, entityEcaReaderInfo);
         }
 
         // entity-data-reader - entityDataReaderInfos
-        childElements = UtilXml.childElementList(rootElement, "entity-data-reader");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "entity-data-reader")) {
             EntityDataReaderInfo entityDataReaderInfo = new EntityDataReaderInfo(curElement);
             entityDataReaderInfos.put(entityDataReaderInfo.name, entityDataReaderInfo);
         }
 
         // field-type - fieldTypeInfos
-        childElements = UtilXml.childElementList(rootElement, "field-type");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "field-type")) {
             FieldTypeInfo fieldTypeInfo = new FieldTypeInfo(curElement);
             fieldTypeInfos.put(fieldTypeInfo.name, fieldTypeInfo);
         }
 
         // datasource - datasourceInfos
-        childElements = UtilXml.childElementList(rootElement, "datasource");
-        elementIter = childElements.iterator();
-        while (elementIter.hasNext()) {
-            Element curElement = (Element) elementIter.next();
+        for (Element curElement: UtilXml.childElementList(rootElement, "datasource")) {
             DatasourceInfo datasourceInfo = new DatasourceInfo(curElement);
             datasourceInfos.put(datasourceInfo.name, datasourceInfo);
         }
@@ -229,38 +203,38 @@
     }
 
     public static ResourceLoaderInfo getResourceLoaderInfo(String name) {
-        return (ResourceLoaderInfo) resourceLoaderInfos.get(name);
+        return resourceLoaderInfos.get(name);
     }
 
     public static DelegatorInfo getDelegatorInfo(String name) {
-        return (DelegatorInfo) delegatorInfos.get(name);
+        return delegatorInfos.get(name);
     }
 
     public static EntityModelReaderInfo getEntityModelReaderInfo(String name) {
-        return (EntityModelReaderInfo) entityModelReaderInfos.get(name);
+        return entityModelReaderInfos.get(name);
     }
 
     public static EntityGroupReaderInfo getEntityGroupReaderInfo(String name) {
-        return (EntityGroupReaderInfo) entityGroupReaderInfos.get(name);
+        return entityGroupReaderInfos.get(name);
     }
 
     public static EntityEcaReaderInfo getEntityEcaReaderInfo(String name) {
-        return (EntityEcaReaderInfo) entityEcaReaderInfos.get(name);
+        return entityEcaReaderInfos.get(name);
     }
 
     public static EntityDataReaderInfo getEntityDataReaderInfo(String name) {
-        return (EntityDataReaderInfo) entityDataReaderInfos.get(name);
+        return entityDataReaderInfos.get(name);
     }
 
     public static FieldTypeInfo getFieldTypeInfo(String name) {
-        return (FieldTypeInfo) fieldTypeInfos.get(name);
+        return fieldTypeInfos.get(name);
     }
 
     public static DatasourceInfo getDatasourceInfo(String name) {
-        return (DatasourceInfo) datasourceInfos.get(name);
+        return datasourceInfos.get(name);
     }
     
-    public static Map getDatasourceInfos() {
+    public static Map<String, DatasourceInfo> getDatasourceInfos() {
         return datasourceInfos;
     }
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java?rev=585810&r1=585809&r2=585810&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java Wed Oct 17 20:08:36 2007
@@ -23,15 +23,17 @@
 import org.w3c.dom.Element;
 import org.ofbiz.base.util.UtilXml;
 
+import javolution.util.FastList;
+
 /**
  * Misc. utility method for dealing with the entityengine.xml file
  *
  */
 public abstract class ResourceInfo extends NamedInfo {
-    public List resourceElements;
+    public List<Element> resourceElements = FastList.newInstance();
 
     public ResourceInfo(Element element) {
         super(element);
-        resourceElements = UtilXml.childElementList(element, "resource");
+        resourceElements.addAll(UtilXml.childElementList(element, "resource"));
     }
 }