Return-Path: X-Original-To: apmail-ant-user-archive@www.apache.org Delivered-To: apmail-ant-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30AD3E552 for ; Tue, 4 Dec 2012 18:09:35 +0000 (UTC) Received: (qmail 19362 invoked by uid 500); 4 Dec 2012 18:09:34 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 19328 invoked by uid 500); 4 Dec 2012 18:09:34 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 19316 invoked by uid 99); 4 Dec 2012 18:09:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2012 18:09:34 +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 (athena.apache.org: domain of lewis.mcgibbney@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qa0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2012 18:09:30 +0000 Received: by mail-qa0-f45.google.com with SMTP id j15so1117335qaq.4 for ; Tue, 04 Dec 2012 10:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vpI/dBMSM4oPPHSglFiLmUU+sWHuEJIuXNuU1RLqvlc=; b=QQ6ELJgo6w+ItuxYZPNCpPsRR/BOZyM2m7UEG6BPWOWj5Cgy24+5sLILGnTdwwLYaM AtBUI2QEdJMD317Ev2CI+yY69WmwEDCHcvUOtgz3XH0idAd372KDKHl5eHpoMOk6mM8T OZVc9kenjVVMItSh/wXYn1hVRdTYUrzhrI4CQcLMfuK3AyikUR3uM09NRfRCnvfznvPR 4+vnX/bgYGAd1XPP/Fu/vZhUOxkHldRRxI/90aYeIV9odbEC4e0e7HUUJ3ECLR5t0QQH FTgaW1Acgl/t6r95FJHQgM87OWFwq4VplTLspBTZXVIQvq9zWTUPhwruoGagMGLdbE20 Hr/g== MIME-Version: 1.0 Received: by 10.224.72.202 with SMTP id n10mr23924304qaj.94.1354644548838; Tue, 04 Dec 2012 10:09:08 -0800 (PST) Received: by 10.49.105.9 with HTTP; Tue, 4 Dec 2012 10:09:08 -0800 (PST) In-Reply-To: References: Date: Tue, 4 Dec 2012 18:09:08 +0000 Message-ID: Subject: Re: Correct configuration for reading a list into a Java class From: Lewis John Mcgibbney To: Ant Users List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi, Thanks so much for the heads up on this. I'll be getting back to it shortly. Much appreciated, I'll be back on list to give the update. Best Lewis On Tue, Dec 4, 2012 at 4:37 PM, Scot P. Floess wrote: > > OK - I get it now... > > I think Lewis was onto the correct solution to begin with... > > Lewis, the issue you had with the file not found I suspect has to do with > the way you did your pathconvert. I believe you will want to use the > pathsep attribute of pathconvert and set it to space: > > > ... > > > And use the child elements as you originally did > > So > > > > ... > > > > On Mon, 3 Dec 2012, Martin Gainty wrote: > >> >> this is a bit overly complex so Im looking for any suggestions to slim >> down the code GoraCompiler main method will need an argument of Collection >> base class //args[1] list of String arguments consisting of names of >> absolute path for each asvc//args[2] name of the schema (schema name)from >> asvc >> //args[3] name of the document (document name) from asvc >> //args[4] namespace see the prefix in the asvc and round back up to >> xlmns:name=namespace to obtain namespace >> org.apache.gora.compiler.GoraCompiler contains a main method >> >> >> http://www.jarvana.com/jarvana/view/org/apache/gora/gora-core/0.1-incubating/gora-core-0.1-incubating-javadoc.jar!/org/apache/gora/compiler/GoraCompiler.html >> public static void main(String []args) >> { >> //assuming args[1] is a collection of strings representing the names of >> the asvc filesArrayList array=args[1]; >> //construct a Names objectorg.apache.avro.Schema.Names >> names=org.apache.avro.Schema.Names(); >> String space=" "; while (array.iterator().hasNext() ) >> {String name=(String)array.iterator().next(); org.apache.avro.Schema.Name >> schema_name=new org.apache.avro.Schema.Name( name, space) ; >> org.apache.avro.Schema schema=names.put(schema_name, Schema schema) >> } // end loop //getting the schema is a bit of a challenge since we will >> be expected to know both the schema_name and the document_name >> String schema_nm = args[2]; >> String document_name=args[3]; String namespace=args[4]; >> /** Create an enum schema. */ >> org.apache.avro.Schema schema=org.apache.avro.Schema >> .createEnum(schema_nm,document_name, namespace,(List)array) ; >> //construct a JsonNode from the schema element called "fields" >> org.codehaus.jackson.JsonNode fieldsJsonNode = schema.get("fields"); >> //call Schema parse method with JsonNode fieldsJsonNode and >> constructedNames argument >> schema=org.apache.avro.Schema.parse(fieldsJsonNode, names) } >> >> http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.avro/avro/1.7.2/org/apache/avro/Schema.java/?v=source >> >> HTH >> Martin >> ______________________________________________ >> Catherine Zeta Jones:...I didn't know Porsche made things like this. >> Sean Connery:........ they don't... >> >> > Date: Mon, 3 Dec 2012 16:28:27 +0000 >>> >>> Subject: Re: Correct configuration for reading a list into a Java class >>> From: lewis.mcgibbney@gmail.com >>> To: user@ant.apache.org >>> >>> Hi Martin, >>> >>> Yes, I need a List[] of avro schemas. I need to compile the lot. >>> >>> I am curious as to an Apache Ant problem or a GoraCompiler problem >>> >>> I have a spade and I am digging >>> >>> On Mon, Dec 3, 2012 at 4:06 PM, Martin Gainty >>> wrote: >>>> >>>> >>>> MG>GoraCompiler main method calls compileSchema with one input src and >>>> output dest MG>nearest i can tell GoraCompiler compileSchema references one >>>> src file >>>> >>>> >>>> MG>http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.gora/gora-core/0.2.1/org/apache/gora/compiler/GoraCompiler.java/?v=source >>>> >>>> MG>this Factory.parse is expecting 1 file input to parse method >>>> MG>http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.avro/avro/1.7.2/org/apache/avro/Schema.java/?v=source >>>> MG>in order to parse a collection the op would need to tweak GoraCompiler to >>>> call compileSchema and pass in a constructed JSONNode and Names as in >>>> MG>static Schema parse(JsonNode schema, Names names) MG>where Names is >>>> a LinkedHashMap >>>> MG>http://grepcode.com/file/repo1.maven.org/maven2/org.apache.avro/avro/1.7.2/org/apache/avro/Schema.java#Schema.Names >>>> MG>Lewis..does this conform to your understanding? >>>> >>>> Martin Gainty >>>> >>>> ______________________________________________ >>>> Please do not alter or disrupt this transmission..Thank You >>>> >>>> > Date: Mon, 3 Dec 2012 08:44:24 -0500 >>>>> >>>>> From: sfloess@nc.rr.com >>>>> To: user@ant.apache.org >>>>> Subject: RE: Correct configuration for reading a list into a Java class >>>>> >>>>> >>>>> Lewis, >>>>> >>>>> By command line params, I mean what params does GoraCompiler require >>>>> (can >>>>> I see examples as if you'd manually execute from command line)... >>>>> >>>>> On Mon, 3 Dec 2012, Scot P. Floess wrote: >>>>> >>>>>> >>>>>> Martin, >>>>>> >>>>>> I don't know the GoraCompiler at all. Again, I was just guessing what >>>>>> he >>>>>> might need to do :) >>>>>> >>>>>> >>>>>> Lewis, >>>>>> >>>>>> Can you provide either a doc link or some of the command line params >>>>>> that you >>>>>> need? >>>>>> >>>>>> >>>>>> >>>>>> On Sun, 2 Dec 2012, Martin Gainty wrote: >>>>>> >>>>>>> >>>>>>> MG>scott do you know the default folder delimiter GoraCompiler >>>>>>> expectsMG>if >>>>>>> lewis implements the arg element with space delimiter in his line >>>>>>> attribute as inMG>MG>can we >>>>>>> assume >>>>>>> GoraCompiler should implement space delimiter for folders instead of >>>>>>> colon >>>>>>> (:)> Date: Sun, 2 Dec 2012 12:43:05 -0500 >>>>>>>> >>>>>>>> From: sfloess@nc.rr.com >>>>>>>> To: lewis.mcgibbney@gmail.com >>>>>>>> CC: user@ant.apache.org >>>>>>>> Subject: Re: Correct configuration for reading a list into a Java >>>>>>>> class >>>>>>>> >>>>>>>> >>>>>>>> I don't know the GoraCompiler nor any of its command line >>>>>>>> arguments... >>>>>>>> >>>>>>>> But have you tried the java sub element? I don't know >>>>>>>> if it >>>>>>>> will help you but this may work: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> I did a minor bit of googling - but didn't quickly find the command >>>>>>>> line >>>>>>>> options or I may have had a firmer "I think this will work" >>>>>>>> statement :) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Sat, 1 Dec 2012, Lewis John Mcgibbney wrote: >>>>>>>> >>>>>>>>> Hi All, >>>>>>>>> >>>>>>>>> I've done a fiar bit of digging on this one on user@ archives and >>>>>>>>> there have been various threads on the topic. I understand that the >>>>>>>>> solution to reading in multiple files an executing them with the >>>>>>>>> java >>>>>>>>> element is a custom solution. The problem is pretty simple. I have >>>>>>>>> a >>>>>>>>> directory of avro schemas which I would like to pass to a >>>>>>>>> GoraCompiler >>>>>>>>> class to be compiled. >>>>>>>>> >>>>>>>>> So far I've got >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> description="> generate the Java files from the Gora schema(s) in >>>>>>>>> src/gora/*.avsc"> >>>>>>>>> >>>>>>>> fork="true"> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> When I execute I get >>>>>>>>> >>>>>>>>> generate-gora-src: >>>>>>>>> [java] 12/12/01 16:22:09 INFO compiler.GoraCompiler: Compiling >>>>>>>>> schema file: >>>>>>>>> >>>>>>>>> /home/lewismc/ASF/2.x/src/gora/host.avsc:/home/lewismc/ASF/2.x/src/gora/webpage.avsc >>>>>>>>> to: ./src/java >>>>>>>>> [java] Exception in thread "main" >>>>>>>>> java.io.FileNotFoundException: >>>>>>>>> >>>>>>>>> /home/lewismc/ASF/2.x/src/gora/host.avsc:/home/lewismc/ASF/2.x/src/gora/webpage.avsc >>>>>>>>> (No such file or directory) >>>>>>>>> [java] at java.io.FileInputStream.open(Native Method) >>>>>>>>> [java] at >>>>>>>>> java.io.FileInputStream.(FileInputStream.java:120) >>>>>>>>> [java] at >>>>>>>>> >>>>>>>>> org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:325) >>>>>>>>> [java] at org.apache.avro.Schema.parse(Schema.java:794) >>>>>>>>> [java] at >>>>>>>>> >>>>>>>>> org.apache.gora.compiler.GoraCompiler.compileSchema(GoraCompiler.java:87) >>>>>>>>> [java] at >>>>>>>>> org.apache.gora.compiler.GoraCompiler.main(GoraCompiler.java:509) >>>>>>>>> [java] Java Result: 1 >>>>>>>>> >>>>>>>>> BUILD SUCCESSFUL >>>>>>>>> Total time: 6 seconds >>>>>>>>> >>>>>>>>> If someone could please help me to understand how to separate the >>>>>>>>> files into the required File [] list then that would be great. I >>>>>>>>> should make it clear that I've discovered pathconvert's pathsep >>>>>>>>> attribute but it still seems to be a string being passed as oppose >>>>>>>>> to >>>>>>>>> a separated list of files. >>>>>>>>> I should also note that making the target accept a single explicit >>>>>>>>> file works perfectly, so I know my configuration is in the way I'm >>>>>>>>> constructing the mappings. >>>>>>>>> >>>>>>>>> Thanks very much in advance >>>>>>>>> >>>>>>>>> Lewis >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Lewis >>>>>>>>> >>>>>>>>> >>>>>>>>> --------------------------------------------------------------------- >>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>>>>>>>> For additional commands, e-mail: user-help@ant.apache.org >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> Scot P. Floess RHCT (Certificate Number >>>>>>>> 605010084735240) >>>>>>>> Chief Architect FlossWare http://sourceforge.net/projects/flossware >>>>>>>> http://flossware.sourceforge.net >>>>>>>> >>>>>>>> https://github.com/organizations/FlossWare >>>>>>>> >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>>>>>>> For additional commands, e-mail: user-help@ant.apache.org >>>>>>>> >>>>>>> >>>>>> >>>>>> Scot P. Floess RHCT (Certificate Number 605010084735240) >>>>>> Chief Architect FlossWare http://sourceforge.net/projects/flossware >>>>>> http://flossware.sourceforge.net >>>>>> https://github.com/organizations/FlossWare >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>>>>> For additional commands, e-mail: user-help@ant.apache.org >>>>>> >>>>>> >>>>> >>>>> Scot P. Floess RHCT (Certificate Number 605010084735240) >>>>> Chief Architect FlossWare http://sourceforge.net/projects/flossware >>>>> http://flossware.sourceforge.net >>>>> https://github.com/organizations/FlossWare >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>>>> For additional commands, e-mail: user-help@ant.apache.org >>>>> >>>> >>> >>> >>> >>> -- >>> Lewis >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>> For additional commands, e-mail: user-help@ant.apache.org >>> >> > > Scot P. Floess RHCT (Certificate Number 605010084735240) > Chief Architect FlossWare http://sourceforge.net/projects/flossware > http://flossware.sourceforge.net > https://github.com/organizations/FlossWare > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > -- Lewis --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org