Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B7EE7CCE3 for ; Thu, 7 Jun 2012 07:35:25 +0000 (UTC) Received: (qmail 37878 invoked by uid 500); 7 Jun 2012 07:35:25 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 37843 invoked by uid 500); 7 Jun 2012 07:35:25 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 37826 invoked by uid 99); 7 Jun 2012 07:35:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 07:35:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 07:35:19 +0000 Received: by lbok6 with SMTP id k6so398373lbo.32 for ; Thu, 07 Jun 2012 00:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=Gf4wvvRcf0T0diZC/jVr9dpAlF5Eiehx44DEQBeNdx8=; b=ecpHIfK1VfpddcdkxmaiSGiKaosKKaWZ2QeyAYlocpGrGHabu1IYLiiQLE7yxTnTuU dTK7vsBoRFIzytuEXdy06PQ5P/KIuRedKwHFjp7WBgvwR008anpeR6ye8v3/96OMCav+ BPeKv5edsbuhAEKrz6PsBGOh1WlWSmHqigl6R48TpOIN2aJgCC+3qEVVvmUT95SCv4fX GB8PzwW5JEPqLasE7+/b0fUVPTucHrb/4+N5MkAaFaZYvzYFaALqIAcWX49DLtT3rmpF cPxCtUT3UTodGIul6V0c26LnLY39qPj8X03wJsmTu468jNnHB0eTTGX7nCjNQNzpGO2j np3g== Received: by 10.152.108.178 with SMTP id hl18mr1237955lab.11.1339054498887; Thu, 07 Jun 2012 00:34:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.49.73 with HTTP; Thu, 7 Jun 2012 00:34:38 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Thu, 7 Jun 2012 09:34:38 +0200 Message-ID: Subject: Re: zip file best practices To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, May 28, 2012 at 5:55 PM, Christian M=FCller wrote: > What do you think about the following proposal: > > 1) Add a type converter which supports a conversion from InputStream -> > ZipFile and from InputStream -> ZipInputStream > 2) Implement a splitter which extract the (multiple) ZipEntry, add some > header to each of them (name of the entry, number of entries, size, ...) > and put them into its own exchange. > Yeah that sounds reasonable. A prototype is usually a good idea to try it out and see what works. > For the other way (create a zip archive which contain multiple entries), > you could provide an Aggregator (AggregationStrategy) which work with > ZipEntries... > I wonder if its not easier to allow to append to an existing file, which is a .zip file as well? > My 0.02$, > Christian > > On Fri, May 25, 2012 at 1:29 PM, Tyler Durvik wrote= : > >> I am working on a solution for this that I can contribute to Camel. =A0I >> have the files being unzipped in a processor. =A0The processor then sets >> a header value which is a comma-separated string listing the files. >> The problem I see is that I want the splitter to generate a new Camel >> Message object for each file in zip file. =A0Then in each Message object >> I set a filename header for each the file that message represents. >> The problem is that the splitter generates 2 messages, each with the >> same file header value. =A0So here is my flow: >> >> Zip File >> >> | >> >> Unzip Processor - uncompress zip which is contained in body, then set >> header. =A0key =3D filenames, values=3Dfile1,file2 >> >> | >> >> Splitter - based on "filenames" header, =A0set new key =3D filename >> >> | >> >> Message 1 - key =3D filename, value =3D file1 >> Message 2 - key =3D filename, value =3D file1 >> >> >> What I want is the header of Message 2 to contain file2. =A0I will write >> unit test to verify this if anyone does not understand or know how to >> help. >> >> Thank you for your help, >> Tyler >> >> >> >> On Thu, May 24, 2012 at 1:18 AM, Claus Ibsen >> wrote: >> > On Wed, May 23, 2012 at 10:43 PM, Tyler Durvik >> wrote: >> >> I am receiving data message from client and the body of the message i= s >> >> a zip file containing multiple files. =A0What is the best method to >> >> process the zip data? =A0I assume that I should use a StreamMessage. = =A0Is >> >> there support for Camel to unzip the body as I receive it like >> >> marshaling or do I need to write an unzip processor or splitter. >> >> >> >> Thank you for your time, >> >> Tyler >> > >> > You would need to write code to unzip that yourself. >> > >> > The zip/gzip data formats is for compressing/decompression message >> > bodies, not zip files. >> > >> > There is a JIRA ticket to see if we can add support for zip files as >> well. >> > Contributions is as always welcome. >> > >> > For example maybe a iterator that can walk the zip file entries, which >> > you can then use with the Splitter EIP to process each file by file. >> > >> > >> > >> > -- >> > Claus Ibsen >> > ----------------- >> > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> > FuseSource >> > Email: cibsen@fusesource.com >> > Web: http://fusesource.com >> > Twitter: davsclaus, fusenews >> > Blog: http://davsclaus.blogspot.com/ >> > Author of Camel in Action: http://www.manning.com/ibsen/ >> --=20 Claus Ibsen ----------------- FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen