svn commit: r739782 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: config/EntityDataReaderInfo.java config/ResourceInfo.java util/EntityDataLoader.java

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

svn commit: r739782 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: config/EntityDataReaderInfo.java config/ResourceInfo.java util/EntityDataLoader.java

jacopoc
Author: jacopoc
Date: Sun Feb  1 16:43:05 2009
New Revision: 739782

URL: http://svn.apache.org/viewvc?rev=739782&view=rev
Log:
Added ability to define entity-data-readers on the fly.
For example, if in a custom ofbiz-component.xml file you have:

<entity-resource type="data" reader-name="prod1" loader="main" location="data/ProdData1.xml"/>

you can load it running the ant task:

ant run-install-readers -Ddata-readers=prod1

even if the reader is not defined in entityengine.xml.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java?rev=739782&r1=739781&r2=739782&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java Sun Feb  1 16:43:05 2009
@@ -29,4 +29,8 @@
     public EntityDataReaderInfo(Element element) {
         super(element);
     }
+
+    public EntityDataReaderInfo(String name) {
+        super(name);
+    }
 }

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=739782&r1=739781&r2=739782&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 Sun Feb  1 16:43:05 2009
@@ -36,4 +36,8 @@
         super(element);
         resourceElements.addAll(UtilXml.childElementList(element, "resource"));
     }
+
+    public ResourceInfo(String name) {
+        super(name);
+    }
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=739782&r1=739781&r2=739782&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Sun Feb  1 16:43:05 2009
@@ -102,6 +102,11 @@
 
                 // get all of the main resource model stuff, ie specified in the entityengine.xml file
                 EntityDataReaderInfo entityDataReaderInfo = EntityConfigUtil.getEntityDataReaderInfo(readerName);
+
+                if (entityDataReaderInfo == null) {
+                    Debug.logInfo("Could not find entity-data-reader named: " + readerName + ". Creating a new reader with this name. ", module);
+                    entityDataReaderInfo = new EntityDataReaderInfo(readerName);
+                }
                 
                 if (entityDataReaderInfo != null) {
                     for (Element resourceElement: entityDataReaderInfo.resourceElements) {
@@ -127,7 +132,7 @@
                         }
                     }
                 } else {
-                    String errorMsg = "Could not find entity-date-reader named: " + readerName;
+                    String errorMsg = "Could not find entity-data-reader named: " + readerName;
                     Debug.logWarning(errorMsg, module);
                 }
             }