ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Bacon <jba...@magmic.com>
Subject Re: recursive expansion of property names
Date Fri, 25 Jun 2004 15:02:49 GMT
yeah. It's a weird thing.  I'd think being a 'chain' of property 
handlers that Ant would start at the bottom of the chain and each link 
would pass the request UP the chain but instead it looks like each 
request is passed DOWN the chain which means each link must implement 
the FULL functionality of the parent instead of just the functionality 
they need to modify.
--
Jeffrey Bacon
jbacon@magmic.com
Creative Developer
http://www.magmic.com


Wascally Wabbit wrote:
> At 10:29 AM 6/25/2004, you wrote:
> 
>> I think it must be that since I'm encapsulating the default property 
>> handler, I need to pass EVERY get/set method to the encapsulated 
>> property handler and also run them through my recursive resolution 
>> algorithm to get them to resolve.
>> -- 
>> Jeffrey Bacon
>> jbacon@magmic.com
>> Creative Developer
>> http://www.magmic.com
> 
> 
> Correct. Think of your class as a simple proxy for the real thing.
> Your sample works for my test because I have wrapped *ALL* the methods to
> delegate to the Ant helper except the replace method.
> 
> Here is a snip:
> 
> --- [ snip (.java) ] ---
> 
>     public String replaceProperties(String ns, String value, Hashtable 
> keys) throws BuildException {
>         return replacePropertiesRecursively(ns, value, keys);
>     }
> 
>     public Object getProperty(String ns, String name)
>     {
>         return defImpl.getProperty(ns,name);
>     }
> 
>     public Object getUserProperty(String ns, String name)
>     {
>         return defImpl.getUserProperty(ns,name);
>     }
> 
>     public boolean setProperty(String ns, String name, Object value, 
> boolean verbose)
>     {
>         return defImpl.setProperty(ns,name,value,verbose);
>     }
> 
>     public void setNewProperty(String ns, String name, Object value)
>     {
>         defImpl.setNewProperty(ns,name,value);
>     }
> 
>     public void setUserProperty(String ns, String name, Object value)
>     {
>         defImpl.setUserProperty(ns,name,value);
>     }
> 
>     public void setInheritedProperty(String ns, String name,  Object value)
>     {
>         defImpl.setInheritedProperty(ns,name,value);
>     }
> 
>     public Object getPropertyHook(String ns, String name, boolean userOnly)
>     {
>         return defImpl.getPropertyHook(ns,name,userOnly);
>     }
> 
>     public Hashtable getProperties()
>     {
>         return defImpl.getProperties();
>     }
> 
>     public Hashtable getUserProperties()
>     {
>         return defImpl.getUserProperties();
>     }
> 
>     public  void copyInheritedProperties(Project other)
>     {
>         defImpl.copyInheritedProperties(other);
>     }
> 
>     public void copyUserProperties(Project other)
>     {
>         defImpl.copyUserProperties(other);
>     }
> 
> --- [[ snip (test...works too) ]] ---
> 
> <?xml version="1.0"?>
> 
> <project name="RPH-verify" basedir="." default="default">
> 
>   <taskdef name="rph" classname="tests.RecursivePropertyHelperInstaller"/>
> 
>   <macrodef name="echoEEHome">
>     <sequential>
>       <echo message="'ee.HOME(macro)': ${ee.HOME}"/>
>     </sequential>
>   </macrodef>
> 
>   <macrodef name="echop">
>     <attribute name="pn"/>
>     <sequential>
>       <echo message="'@{pn}(macro)': ${@{pn}}"/>
>     </sequential>
>   </macrodef>
> 
>   <target name="default">
> 
>         <property name="afN" value=".file"/>
>     <property name="_dot" value ="."/>
>     <property name="_ant" value="ant"/>
>     <property name="_file" value="file"/>
> 
>     <echo message="Plain 'HOME': ${HOME}"/>
> 
>     <property environment="ee"/>
>     <echo message="'ee.HOME(0)': ${ee.HOME}"/>
>     <echoEEHome/>
> 
>         <rph action="install"/>
> 
>         <echo message="'ant.file(0)': ${ant${afN}}"/>
>         <echo message="'ant.file(1)': ${${_ant}${_dot}${_file}}"/>
>         <echo message="'ee.HOME(1)': ${ee.HOME}"/>
>         <echoEEHome/>
> 
>         <property environment="pp"/>
>         <echo message="'pp.HOME(0)':${pp.HOME}"/>
> 
>         <property file="in.in"/>
>         <echo message="'longname(file)': ${longname}"/>
> 
>         <echop pn="longname"/>
>         <echop pn="name"/>
>         <echop pn="ant.file"/>
> 
>   </target>
> 
> </project>
> 
> 
> 
> 
> The Wabbit
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message