FWIW I've just checked in a FlatpackDataFormat; which is a tad easier
to use. The downside is the data format kinda has to turn the DataSet
into a List of Maps to make it easier to work with; but at least the
routes are a bit simpler. e.g. this is from the
DelimitedWithUnmarshalTest (the convertBodyTo is not required
currently)

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
    <route>
      <from uri="file://src/test/data/delim?noop=true"/>
      <unmarshal ref="delimitedFormat"/>
      <splitter>
        <simple>in.body</simple>
        <convertBodyTo type="java.util.Map"/>
        <to uri="mock:results"/>
      </splitter>
    </route>
  </camelContext>

  <bean id="delimitedFormat"
class="org.apache.camel.component.flatpack.FlatpackDataFormat">
    <property name="definition" value="INVENTORY-Delimited.pzmap.xml"/>
  </bean>

2008/7/15 James Strachan <[EMAIL PROTECTED]>:
> Yeah - I did ponder if it should be a dataformat or a component; or
> maybe even both. The bit I wasn't sure about was flatpack really just
> provides an iterator over rows of the file; I wasn't sure if this
> properly matched the dataformat model of marshalling or unmarshalling
> a payload (which currently assumes that unmarshalling generates a
> single result).
>
> Maybe we need to enhance the dataformat concept to work with this use case 
> too?
>
> So maybe if we want to process each row of a file we do something like...
>
> from("file://whatnot").
>  unmarshall().flatpack().fixed("locationOftheXMLConfigurationfile.pzmap.xml").
>  split().body().
>  to("whatever");
>
> where the split().body() would do the iteration over each DataSet?
>
>
> 2008/7/15 Claus Ibsen <[EMAIL PROTECTED]>:
>> Hi
>>
>> Yes I thought also at first it was a dataformat ;) But how James created it 
>> it works as if it is a dataformat. You just have to do it in to..from 
>> from..to steps.
>>
>>
>> from("file://c:/test").to("flatpack:foo: 
>> locationOftheXMLConfigurationfile.pzmap.xml");
>>
>> from("flatpack:foo").to("whatever you want");
>>
>> As a component it gets more attention, as people can find it on the 
>> component list. The dataformats are kinda hidden in the wiki documentation.
>> Maybe they need a "dataformat" top menu as well ;)
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>>
>> -----Original Message-----
>> From: cmoulliard [mailto:[EMAIL PROTECTED]
>> Sent: 15. juli 2008 09:32
>> To: [email protected]
>> Subject: Re: Component to read FixedLength file ?
>>
>>
>> Many thanks.
>>
>> I will test the integration of this component within Camel.
>>
>> Remark : I'm a little confused about how Flatpack has been integrated. The
>> project has been integrated like a component but from my point of view, it
>> should be integrated (for consistency reason) like a Dataformat. Because
>> like the other framework/technology implemented in Camel (JAXB, Artix,
>> XStream, ....), they transform the content from a format (XML, CSV, ...)
>> into another format (Collection of Java objects)
>>
>> E.g.
>>
>> DataFormat flatpack = new
>> DataFormat("locationOftheXMLConfigurationfile.pzmap.xml.xml")
>>
>> from("file:///c:/test")
>> .unmarshall(flatpack)
>> .to("whatever you want")
>>
>> Regards,
>>
>> Charles
>>
>>
>>
>> James.Strachan wrote:
>>>
>>> BTW trunk has an early spike of a flatpack component. Needs more work,
>>> but there's a basic fixed-width reader example there for the curious
>>>
>>> 2008/7/14 James Strachan <[EMAIL PROTECTED]>:
>>>> I've raised a JIRA to track this...
>>>> https://issues.apache.org/activemq/browse/CAMEL-717
>>>>
>>>> 2008/7/14 James Strachan <[EMAIL PROTECTED]>:
>>>>> 2008/7/14 cmoulliard <[EMAIL PROTECTED]>:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is there a component expected to read fixedlength files in Camel like
>>>>>> flatpack (http://flatpack.sourceforge.net/) allow to do it ?
>>>>>
>>>>> It should be pretty easy to write a flatpack component.
>>>>>
>>>>> there's a commercial tool called Artix Data Services which comes with
>>>>> a nice design UI that does this with Camel...
>>>>> http://activemq.apache.org/camel/artix-data-services.html
>>>>>
>>>>> but it'd be nice to have an OSS option :)
>>>>>
>>>>> --
>>>>> James
>>>>> -------
>>>>> http://macstrac.blogspot.com/
>>>>>
>>>>> Open Source Integration
>>>>> http://open.iona.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>>
>>>> Open Source Integration
>>>> http://open.iona.com
>>>>
>>>
>>>
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://open.iona.com
>>>
>>>
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : [EMAIL PROTECTED]
>> web site : www.xpectis.com
>> --
>> View this message in context: 
>> http://www.nabble.com/Component-to-read-FixedLength-file---tp18444614s22882p18459545.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to