ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wolfgang haefelinger <whaefelin...@gmail.com>
Subject API question on properties
Date Wed, 10 Nov 2010 13:23:12 GMT
Hello Ant Developers,

I believe the API regarding properties is incomplete (at least from a
performance point of view).

A bit of background information:
I make use of the new property API (1.8.1) which allows me to evaluate
${..} in a different way. In my case, the body ${..} will be a Java
Unified Expression (EL), see [1].

Now, EL comes with it's own object storgage and with the help of
additional tasks,  a user can create "EL properties". Assume this task
would be "<elproperty /> similar to Ant's property task. Then there
could be something like

<elproperty name="p" value=".." />
<property name="p" value=".." />

At this point there is a property named "p" in EL's storage and a
property named "p" in Ant's default storage.

Then, assume that  there is this <echo /> task and that "handling of
EL" has been enabled.

<echo>
   ${p}
   ${property.p}
</echo>

The first embedded ${p} resolves to the object in EL's storage, cause
PropertyEvaluators are added in LIFO order. In my case, that is
exactly what I want (in general, I believe it is better to let the
user determine the order).

However, I also want to give my users the chance to explicitly
reference the object in Ant's storage, i.e. the Ant "string" property.
That's what the second embedded reference, ${property.p} is all about.

My question is how to access to Ant property 'p' in a given project?

Obviously (?) I can't make use of Project.getUserProperty(String
propertyName) cause this would invoke my own EL property evaluator.

All I found is

 Project p = ...
 String name = 'p';
 p.getProperties().get(name);

However, a closer look to getProperties() reveals that this method is
essentially implemented as

public Hashtable getProperties() {
        //avoid concurrent modification:
        synchronized (properties) {
            return new Hashtable(properties);
        }
        // There is a better way to save the context. This shouldn't
        // delegate to next, it's for backward compatibility only.
    }

========================================================
So my question is essentially how to retrieve an Ant property in Ant's storage?
========================================================

Greetz,
Wolfgang.


[1] http://en.wikipedia.org/wiki/Unified_Expression_Language







-- 
Wolfgang Häfelinger
häfelinger IT - Applied Software Architecture
http://www.haefelinger.it
+31 648 27 61 59

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


Mime
View raw message