Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 78284 invoked from network); 12 Jul 2004 06:52:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 12 Jul 2004 06:52:25 -0000 Received: (qmail 46978 invoked by uid 500); 12 Jul 2004 06:52:17 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 46741 invoked by uid 500); 12 Jul 2004 06:52:15 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 46727 invoked by uid 99); 12 Jul 2004 06:52:15 -0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=HTML_50_60,HTML_MESSAGE,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [193.109.238.66] (HELO dnsinet.rzf-nrw.de) (193.109.238.66) by apache.org (qpsmtpd/0.27.1) with ESMTP; Sun, 11 Jul 2004 23:52:14 -0700 Received: from z011104.bk.fin.local (z011104.bk.fin.local [193.109.238.140]) by dnsinet.rzf-nrw.de (8.12.10/8.12.10) with ESMTP id i6C6qAZY012060 for ; Mon, 12 Jul 2004 08:52:10 +0200 Received: by z011104.bk.fin.local with Internet Mail Service (5.5.2657.72) id <3WH8TKRF>; Mon, 12 Jul 2004 08:52:11 +0200 Message-ID: <879A5AD5DD0ED511891F0003473A9B560E23F32A@Z011004> From: Jan.Materne@rzf.fin-nrw.de To: user@ant.apache.org Subject: AW: Creating custom InputHandler Date: Mon, 12 Jul 2004 08:52:10 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C467DC.C16515F0" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C467DC.C16515F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable BTW using such a task isnt my idea :-) Have seen that in the ant proposal section on the JXPath property = handler. Jan > -----Urspr=FCngliche Nachricht----- > Von: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] > Gesendet am: Montag, 12. Juli 2004 08:51 > An: user@ant.apache.org > Betreff: AW: Creating custom InputHandler >=20 > Indeed, seems to be a problem. >=20 > The initialization procedure for InputHandlers doesnt store a project > reference (and=20 > couldnt do it, because the IH-Interface doesnt requires a > setProject(Project) method). >=20 > So only a workaround comes into my mind: > - your InputHandler has to provide the setProject method > - set the reference for yourself before using the handler by=20 > using a Task: > (code not tested - even compiled): > public class SetProjectReferenceOnInputHandler extends Task { > public void execute() { > InputHandler ih =3D getProject().getInputHandler(); > if (ih instanceof MyInputHandler) { > ((MyInputHandler)ih).setProject(getProject()); > } > } > } > =20 >=20 > Maybe we should check if the InputHandler is a=20 > ProjectComponent and set the > project > reference then ...=20 >=20 >=20 > Jan >=20 >=20 >=20 > Input.java:0100: public void execute () throws BuildException { > Input.java:0116: > getProject().getInputHandler().handleInput(request); >=20 > Project.java:0239: public Project() { > Project.java:0240: fileUtils =3D FileUtils.newFileUtils(); > Project.java:0241: inputHandler =3D new = DefaultInputHandler(); > Project.java:0242: } >=20 > Main.java:0736: private void addInputHandler(Project=20 > project) throws > BuildException { > Main.java:0737: InputHandler handler =3D null; > Main.java:0738: if (inputHandlerClassname =3D=3D null) { > Main.java:0739: handler =3D new DefaultInputHandler(); > Main.java:0740: } else { > Main.java:0741: try { > Main.java:0742: handler =3D (InputHandler) > Main.java:0743: > (Class.forName(inputHandlerClassname).newInstance()); > Main.java:0744: if (project !=3D null) { > Main.java:0745: =20 > project.setProjectReference(handler); > Main.java:0746: } > Main.java:0759: project.setInputHandler(handler); > Main.java:0760: } >=20 >=20 >=20 >=20 >=20 > > -----Urspr=FCngliche Nachricht----- > > Von: Ivan Ivanov [mailto:rambiusparkisanius@yahoo.com] > > Gesendet am: Montag, 12. Juli 2004 08:34 > > An: user@ant.apache.org > > Betreff: Creating custom InputHandler > >=20 > > Dear Colleagues, > >=20 > > Some time ago I was playing with task and I > > noticed that if you input a string, that contains a > > property in it, the property is not expanded to its > > value. Jan Mat=E8rne adviced me in this list that I > > should implement an InputHandler to do this. > >=20 > > I created one that is reading the input correctly, but > > I ran into the problem how should I expand the > > properties in the string that is inputted. When > > writing a custom task it is easy with > > getProject.replaceProperties(String). However I do not > > see a way to get the current Project in an > > InputHandler. > >=20 > > Any ideas how I can resolve the input? > >=20 > > Thanks in advance > > Ivan > >=20 > >=20 > > =09 > > __________________________________ > > Do you Yahoo!? > > New and Improved Yahoo! Mail - Send 10MB messages! > > http://promotions.yahoo.com/new_mail=20 > >=20 > >=20 > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org > >=20 >=20 ------_=_NextPart_001_01C467DC.C16515F0--