ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: ReferenceHelper - interceptor
Date Thu, 23 Jan 2003 15:57:02 GMT

Wannheden, Knut wrote:
>>>Cool!  I suppose the version of Ant included with version 
>>
>>1.0.0 beta4 of
>>
>>>Centipede is new enough to use the PropertyHelper, right?
>>
>>Yup.
> 
> I downloaded the centipede distribution.  But there is only a bin
> distribution, no src.  But since there's no Javadoc coming with the
> distribution and the included ant-sax2.jar is kind of out of date with
> respect to the CVS it's hard to see how I should actually use the
> PropertyHelper feature.

Ah, ok. krysalis-centipede in CVS now uses the latest Ant, compiled some 
days ago, with all the new PropertyHelper features. The Centipede tasks 
are in the krysalis-ant-tasks repository, but since you asked for the 
Ant stuff, I reckoned you didn't need to see them.

the krysalis-centipede CVS repo and distro have no java source because 
there isn't any. There are Ant scripts in src/core/, but the Java tasks 
are in krysalis-ant-tasks.

To use the version from CVS, just do 
(http://www.krysalis.org/centipede/viewcvs.html):

cvs -d:pserver:anonymous@cvs.krysalis.sourceforge.net:/cvsroot/krysalis 
login

cvs -z3 
-d:pserver:anonymous@cvs.krysalis.sourceforge.net:/cvsroot/krysalis co 
modulename


This is a working Centipede, no build needed. Just set ANT_HOME to this 
CVS module dir, and add the bin dir to the path and you're set to go.

> I'd like to use the embed features with Ant 1.5.1.  Should I build the
> current embed proposal from CVS and use that jar or what do you recommend?

Using the last Centipede CVS you get the last Ant. The embed jar is no 
longer needed since the classes are now in HEAD. Only implementations of 
the dynamic properties are from embed, and those too are included.

Here is the ViewCVS listing of the dir than contains these implementations:

http://cvs.apache.org/viewcvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/

>>>One more question:  The properties seem to have a namespace 
>>
>>like syntax.
>>
>>>Can I plug in my own PropertyHelper and register it with 
>>
>>one namespace or is
>>
>>>the same PropertyHelper used for all properties?
>>
>>Yup can plug in yours, actually as many as you like. And you don't 
>>necessarily have to use namespaces, you can use any syntax. A 
>>registered 
>>PropertyHelper gets a shot at giving the result to the user, 
>>in any way 
>>it wants to. If it cannot, it just passes the request on to the next 
>>PropertyHelper that was registered (like servlet filters ).
> 
> It looks like the PropertyHelpers aren't dynamically registered.

Correct.

>  So I
> suppose I'll have to do that with a separate task for each project, right?

Err, you have to launch a task that registers it.
For example, to set up the jxpath propertyhelper, you have to do 
(http://cvs.apache.org/viewcvs/jakarta-ant/proposal/embed/test.xml?rev=HEAD&content-type=text/vnd.viewcvs-markup):

     <!-- load the JXpath task-->
     <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath"
              name="jxpath" />

     <!-- Run the task that registers the interceptor -->
     <jxpath/>

     <!-- Use it -->
     <echo>{jxpath:/blahblah</echo>


In the code this is what happens in executing that task 
(http://cvs.apache.org/viewcvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/optional/JXPath.java?rev=1.8&only_with_tag=MAIN&content-type=text/vnd.viewcvs-markup):

   public void execute() {
     //Create the property helper
     JXPathPropertyHelper helper=new JXPathPropertyHelper();

          ...snipped jxpath init stuff...

     //get the current propertyhelper
     PropertyHelper phelper=PropertyHelper.getPropertyHelper( project );

     //initialize the phelper
     helper.setProject( project );

     //and register this helper just after the first one in the chain
     helper.setNext( phelper.getNext() );
     phelper.setNext( helper );

   }


Centipede uses a centipede task to load this and other stuff 
automatically BTW, but that's another topic on another list.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message