How-to specify tab delimiter for flatpack

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

How-to specify tab delimiter for flatpack

prossman
Hi,

I'm receiving a tab-delimited file which I intend to parse with camel-flatpack. My <to> URI is:
<to
        uri="flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'" />

I'm trying to specify the tab using the delimiter option, but I get the following error:

org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route17 at: >>> To[flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'] <<< in route: Route[[From[file://c:/temp/tsisb/rvs-in?include=IMPAUT_IMPER... because of Failed to resolve endpoint: flatpack://delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter=%27%5Ct%27 due to: Could not find a suitable setter for property: delimiter as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: char with value '\t'

I tried different ways of specifying the delimiter:
?delimiter='\t'
?delimiter=\t
?delimiter='\u0009'
?delimiter=\u0009

results in an illegal character. I checked the JavaDoc of the DelimitedEndpoint, and the setDelimiter method only accepts char as parameter.

As parsing a tab-separated file seems to be a rather common use case, I'm wondering:
Did anyone come across this?
Is there a way to indicate in the component URI that \t is to be treated as char?
Is there any other way how this can be solved?

Thanks,
Ciao, Philipp
Reply | Threaded
Open this post in threaded view
|

Re: How-to specify tab delimiter for flatpack

Claus Ibsen-2
Hi

I have created a ticket
https://issues.apache.org/jira/browse/CAMEL-3710

You need to add a String -> char type converter, then it should work.


On Wed, Feb 23, 2011 at 5:39 PM, prossman
<[hidden email]> wrote:

>
> Hi,
>
> I'm receiving a tab-delimited file which I intend to parse with
> camel-flatpack. My <to> URI is:
> <to
>        uri="flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'"
> />
>
> I'm trying to specify the tab using the delimiter option, but I get the
> following error:
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> route17 at: >>>
> To[flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'] <<< in
> route: Route[[From[file://c:/temp/tsisb/rvs-in?include=IMPAUT_IMPER...
> because of Failed to resolve endpoint:
> flatpack://delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter=%27%5Ct%27 due
> to: Could not find a suitable setter for property: delimiter as there isn't
> a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type: java.lang.String
> to the required type: char with value '\t'
>
> I tried different ways of specifying the delimiter:
> ?delimiter='\t'
> ?delimiter=\t
> ?delimiter='\u0009'
> ?delimiter=\u0009
>
> &#9; results in an illegal character. I checked the
> http://fusesource.com/docs/router/2.5/apidoc/org/apache/camel/component/flatpack/DelimitedEndpoint.html
> JavaDoc of the DelimitedEndpoint , and the setDelimiter method only accepts
> char as parameter.
>
> As parsing a tab-separated file seems to be a rather common use case, I'm
> wondering:
> Did anyone come across this?
> Is there a way to indicate in the component URI that \t is to be treated as
> char?
> Is there any other way how this can be solved?
>
> Thanks,
> Ciao, Philipp
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-specify-tab-delimiter-for-flatpack-tp3397320p3397320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|

Re: How-to specify tab delimiter for flatpack

Claus Ibsen-2
In reply to this post by prossman
Hi

Its fact already reported and fixed. See
https://issues.apache.org/jira/browse/CAMEL-3045

Also you should always details what version of Camel you are using!
And try upgrading to never version to see if its fixed.

So in your case you need Camel 2.5 or better.


On Wed, Feb 23, 2011 at 5:39 PM, prossman
<[hidden email]> wrote:

>
> Hi,
>
> I'm receiving a tab-delimited file which I intend to parse with
> camel-flatpack. My <to> URI is:
> <to
>        uri="flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'"
> />
>
> I'm trying to specify the tab using the delimiter option, but I get the
> following error:
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> route17 at: >>>
> To[flatpack:delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter='\t'] <<< in
> route: Route[[From[file://c:/temp/tsisb/rvs-in?include=IMPAUT_IMPER...
> because of Failed to resolve endpoint:
> flatpack://delim:flatpack/IMPAUT_IMPERR.fpmap.xml?delimiter=%27%5Ct%27 due
> to: Could not find a suitable setter for property: delimiter as there isn't
> a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type: java.lang.String
> to the required type: char with value '\t'
>
> I tried different ways of specifying the delimiter:
> ?delimiter='\t'
> ?delimiter=\t
> ?delimiter='\u0009'
> ?delimiter=\u0009
>
> &#9; results in an illegal character. I checked the
> http://fusesource.com/docs/router/2.5/apidoc/org/apache/camel/component/flatpack/DelimitedEndpoint.html
> JavaDoc of the DelimitedEndpoint , and the setDelimiter method only accepts
> char as parameter.
>
> As parsing a tab-separated file seems to be a rather common use case, I'm
> wondering:
> Did anyone come across this?
> Is there a way to indicate in the component URI that \t is to be treated as
> char?
> Is there any other way how this can be solved?
>
> Thanks,
> Ciao, Philipp
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-specify-tab-delimiter-for-flatpack-tp3397320p3397320.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|

Re: How-to specify tab delimiter for flatpack

prossman
Hi,

thanks for the quick reply, and sorry for not mentioning the version. I'm using Camel inside Fuse 4.3.0 (apache-servicemix-4.3.0-fuse-03-00), so I'm bound to what is used there: <camel.version>2.4.0-fuse-02-00</camel.version>

I'll try to look for another workaround, then...

Ciao, Philipp
Reply | Threaded
Open this post in threaded view
|

Re: How-to specify tab delimiter for flatpack

Claus Ibsen-2
On Wed, Feb 23, 2011 at 5:56 PM, prossman
<[hidden email]> wrote:
>
> Hi,
>
> thanks for the quick reply, and sorry for not mentioning the version. I'm
> using Camel inside Fuse 4.3.0 (apache-servicemix-4.3.0-fuse-03-00), so I'm
> bound to what is used there: <camel.version>2.4.0-fuse-02-00</camel.version>
>
> I'll try to look for another workaround, then...

If you use Java DSL then you can do as follows in the configure() method

// eg grab the endpoint using the uri, WITHOUT that delimiter
FlatpackEndpoint flatpack = context.getEndpoint("flatpatck:xxxx");
// and then set the delimiter in java code
flatpack.setDelimter('\t');

from(flatpack)...


Fuse ESB 4.3.1 has been released and it ships with Camel 2.6.


>
> Ciao, Philipp
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-specify-tab-delimiter-for-flatpack-tp3397320p3397353.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/