Hi Gunnar,
very nice article. I think the DataFormat aproach could not be used for
extracting a zip file with several files.
I guess a solution has to create one Exchange for each file in the zip
and send it along the rest of the route.
Though I am not sure what is the best way to implement this.
In our case we simply extracted to files and read them with a second
route but in many cases this is probably not what you want.
Greetings
Christian
Gunnar Hillert schrieb:
Hi,
Accidentally I was dealing with the same issue over the weekend (have been
unaware of this thread until today :-).
I created a custom dataformat class to deal for zipping/unzipping. I got it
to work with one file (And in case a file contained multiple ZipEntries I am
throwing an exception...).
Thus, I would be interested to learn more about a solution that could deal
with multiple files at once.
I wrote a small blog entry about my experience:
http://hillert.blogspot.com/2009/10/camellos-iii-zipping-files-with-apache.html
The source code (incl. the custom dataformat class):
http://jrecruiter.googlecode.com/svn/trunk/camellos/
Cheers,
Gunnar Hillert
hzbarcea wrote:
Hi Vladimir,
Thanks for pointing this out. Would you care to submit a patch for this?
On the custom data format topic, of course you can. You'd have to
write your own component with your data format code (class extending
org.apache.camel.spi.DataFormat). You can find a more isolated
example in the camel-hl7 component.
Cheers,
Hadrian
On Oct 2, 2009, at 6:29 PM, Vladimir Okhotnikov wrote:
Hi
first of all, thanks for the great framework. The learning curve is
a bit,
steep, but the possibilities are surely worth it.
Apparently I have a small problem with a ZIP data format. In my
project, I
have to download zipped files from FTP, uncompress and process them.
So, I
guess the route should be like:
from("ftp://...").unmarshal().zip().to(...)
While writing a test for that particular route, I've created a small
test
zip file and tried to process it - with no luck - all I got was the
ZipException "unknown compression method"
I also tried feeding the actual zip file from the FTP, with the same
result.
Eventually I looked at the code, and found that zip data format
processing
is being done by org.apache.camel.impl.ZipDataFormat class. What's
strange
is that the class uses java.zip.InflaterOutputStream (and its
DeflaterOutputStream counterpart). Now, by no means I'm an expert in
compression methods, but the java API docs claims that those classes
use
"deflate" method, not "zip". For "zip" method I think ZipInputStream
must be
used instead?
As a side note, can anyone give me an advice whether it is possible
to add a
custom data format without modifying/recompiling camel code?
Regards,
Vladimir Okhotnikov
--
View this message in context:
http://www.nabble.com/Zip-format-problem-tp25723682p25723682.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Christian Schneider
---
http://www.liquid-reality.de