You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ja...@hotwaxmedia.com> on 2009/02/01 17:43:37 UTC

Re: Adding more flexibility for the definition of entity-data-readers

Implemented in rev. 739782

Jacopo

On Jan 31, 2009, at 7:41 PM, David E Jones wrote:

>
> If you haven't done so already then yeah, that would be the way to  
> go (ie a new/different constructor).
>
> -David
>
>
> On Jan 31, 2009, at 1:50 AM, Jacopo Cappellato wrote:
>
>> This is a good idea... I had a look at the code  
>> (EntityDataReaderInfo that extends ResourceInfo that extends  
>> NamedInfo) but I couldn't find an easy way to get an instance of a  
>> EntityDataReaderInfo without an org.w3c.dom.Element. Should I  
>> simply add a new constructor that accepts a string (the reader's  
>> name)?
>>
>> Jacopo
>>
>>
>> On Jan 30, 2009, at 11:26 PM, David E Jones wrote:
>>
>>>
>>> This sounds fine. Why is the "default" reader needed? Couldn't we  
>>> just add readers on the fly if referenced in ofbiz-component.xml  
>>> files just like if they were specified in the entityengine.xml file?
>>>
>>> I guess the only downside to this would be that if someone was  
>>> trying to use an existing reader and had a typo then it would  
>>> create a new reader instead of giving them an error, but for  
>>> flexibility's sake it is probably worth it.
>>>
>>> -David
>>>
>>>
>>> On Jan 30, 2009, at 7:23 AM, Jacopo Cappellato wrote:
>>>
>>>> Hi all,
>>>>
>>>> I have a proposal and a question about entity-data-readers (seed,  
>>>> seed-initial, demo, ext, ext-test, ext-demo).
>>>>
>>>> *Question*
>>>> what is the meaning of specifying the readers in the datasource  
>>>> element? Is it not enough to define them and then just use them  
>>>> in the ofbiz-component files?
>>>>
>>>> *Proposal*
>>>> I would like to give more flexibility in the way data files are  
>>>> defined in custom (hot-deploy) ofbiz-component.xml files; for  
>>>> example, if I define:
>>>>
>>>> <entity-resource type="data" reader-name="production"  
>>>> loader="main" location="data/CustomSeedData.xml"/>
>>>> <entity-resource type="data" reader-name="test" loader="main"  
>>>> location="data/CustomSeedData.xml"/>
>>>> <entity-resource type="data" reader-name="test" loader="main"  
>>>> location="data/CustomDemoData.xml"/>
>>>> <entity-resource type="data" reader-name="test2" loader="main"  
>>>> location="data/CustomSeedData.xml"/>
>>>> <entity-resource type="data" reader-name="test2" loader="main"  
>>>> location="data/CustomDemoData2.xml"/>
>>>>
>>>> I would like to load them with an ant command like:
>>>>
>>>> ant run-install -Dreaders=test
>>>>
>>>> (to load CustomSeedData.xml and CustomDemoData.xml)
>>>>
>>>> but *without* the need to add the readers test, test2 and  
>>>> production into the entityengine.xml file).
>>>>
>>>> The trick is the following: in the entityengine.xml file a  
>>>> catchall reader is added (named "default"):
>>>>
>>>> <entity-data-reader name="default"/>
>>>>
>>>> and then use it for all the readers referenced in ofbiz- 
>>>> component.xml but not found in entityengine.xml.
>>>>
>>>> I have a working patch right now, that I can cleanup and submit  
>>>> soon.
>>>>
>>>> What do you think?
>>>>
>>>> Jacopo
>>>>
>>>
>>
>