You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nicolasduminil <ni...@simplex-software.fr> on 2016/06/08 09:46:45 UTC

Trying to use the TarSplitter ...

Hello,

I need to process a .tar.gz file in a route and, after some googling, I came
at something like the following:

...
    from("direct:unzip").unmarshal().gzip()
    .split(new TarSplitter()).process("debug")
...

I didn't find much documentation concerning TarSplitter and I'm wondering
whether it is a fully supported component. Also, in the "debug" processor, I
display inMessage.getBody().getClass().getName() which displays:

org.apache.camel.dataformat.tarfile.TarElementInputStreamWrapper

So, my question is how can I get either the file or its content out of this
?

Many thanks in advance.

Nicolas



--
View this message in context: http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Trying to use the TarSplitter ...

Posted by Pontus Ullgren <ul...@gmail.com>.
No sorry none of the work-arounds I tested seemed to work.
To be honest I've never used the TarSplitter myself in any project.
My initial answer was simply based on the class hierarchy of
TarElementInputStreamWrapper and expericne from the ZipFile component.

Any way for reference could you post a link to the Jira issue here.


On Thu, 9 Jun 2016 at 10:22 nicolasduminil <
nicolas.duminil@simplex-software.fr> wrote:

> Waiting for the Jira, how could I work-around this issue ? Do you have any
> suggestion ?
>
> Many thanks in advance,
>
> Nicolas DUMINIL
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658p5783749.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Trying to use the TarSplitter ...

Posted by nicolasduminil <ni...@simplex-software.fr>.
Waiting for the Jira, how could I work-around this issue ? Do you have any
suggestion ?

Many thanks in advance,

Nicolas DUMINIL



--
View this message in context: http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658p5783749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Trying to use the TarSplitter ...

Posted by Pontus Ullgren <ul...@gmail.com>.
Yes agree,

I also get the same behaviour from a similare route when running Camel
2.17.1.

Could you create a issue in Jira for this.

// Pontus

On Wed, 8 Jun 2016 at 17:23 nicolasduminil <
nicolas.duminil@simplex-software.fr> wrote:

> Hello,
>
> Thanks for your reply. So, what you're saying is that
> org.apache.camel.dataformat.tarfile.TarElementInputStreamWrapper would be
> an
> input stream, right ? In this case I don't need to convert it, just could
> read from it. But I tried the following:
>
>     from("direct:unzip").unmarshal().gzip()
>     .split(new TarSplitter())
>     .to("file:{{file.unzip.path}}?fileName=${file:name}");
>
> The file-system structure gets correctly created, I mean folders,
> sub-folders, etc., until the file level. But all the files are created with
> 0 blocks, i.e. empty. Do you have any idea of what might happening here ?
>
> Many thanks in advance,
>
> Nicolas
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658p5783722.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Trying to use the TarSplitter ...

Posted by nicolasduminil <ni...@simplex-software.fr>.
Hello,

Thanks for your reply. So, what you're saying is that
org.apache.camel.dataformat.tarfile.TarElementInputStreamWrapper would be an
input stream, right ? In this case I don't need to convert it, just could
read from it. But I tried the following:

    from("direct:unzip").unmarshal().gzip()
    .split(new TarSplitter())
    .to("file:{{file.unzip.path}}?fileName=${file:name}");

The file-system structure gets correctly created, I mean folders,
sub-folders, etc., until the file level. But all the files are created with
0 blocks, i.e. empty. Do you have any idea of what might happening here ?

Many thanks in advance,

Nicolas




--
View this message in context: http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658p5783722.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Trying to use the TarSplitter ...

Posted by Pontus Ullgren <ul...@gmail.com>.
You can try to convert the input stream to the desired format using
convertBodyTo before the debug processor.

http://camel.apache.org/convertbodyto.html

Best regards
Pontus

On Wed, 8 Jun 2016, 11:46 nicolasduminil, <
nicolas.duminil@simplex-software.fr> wrote:

> Hello,
>
> I need to process a .tar.gz file in a route and, after some googling, I
> came
> at something like the following:
>
> ...
>     from("direct:unzip").unmarshal().gzip()
>     .split(new TarSplitter()).process("debug")
> ...
>
> I didn't find much documentation concerning TarSplitter and I'm wondering
> whether it is a fully supported component. Also, in the "debug" processor,
> I
> display inMessage.getBody().getClass().getName() which displays:
>
> org.apache.camel.dataformat.tarfile.TarElementInputStreamWrapper
>
> So, my question is how can I get either the file or its content out of this
> ?
>
> Many thanks in advance.
>
> Nicolas
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Trying-to-use-the-TarSplitter-tp5783658.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>