You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Erik Hatcher <ja...@ehatchersolutions.com> on 2002/01/05 01:56:11 UTC

IntrospectionHelper request

While inquiring about some issues I was having with my attempts to get
XDoclet custom templates working (very cool, by the way!), I got this
request for Ant:

"Please make IntrospectionHelper an interface with a default/derivable
impl. I want to extend it and add a new kind of introspection, but
everything seems to be concrete and utility class. Specifically I want
to create my own AttributeSetter and instead of invoking a setter method
in the target task/element, set a config param value in a hashtable
field of the target element, or in other words I want to add a more
dynamic approach so the user can add config params without having to
create a DocletTask-derived class and getter/setter there."

I don't quite have the bandwidth or intimate know-how of IntrospectionHelper
yet to give a good response.  Thoughts??

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 09:50, Erik Hatcher wrote:
> I've just started trying to wrap my head around aspects. I believe these
> are proposed for Ant2, right?  Could elaborate a bit more on the types of
> aspects you envision?

Well we wont really know what they are useful for until we end up trying 
them. The only over-whelmingly fitting use is for things like GUMP that 
manage the Classpath for a whole build and force the tasks to ignore the 
Classpath specified in the xml file.

Some other things that have been considered include allowing a 
1. universal handling of fail-on-error. So that everytask is can have its 
failure ignored by adding an ant:fail-on-error="false" to it's list of 
attributes. No task would have to do it internally anymore
2. universal handling of logging. ie do you want to squash this 
task/target/whatevers logging, or maybe put it into a file or maybe send it 
to a website or whatever
3. universal handling of standard output/input/error - similar to 2 but 
slight different tact.
4. A way to implement a preferences system (ie always use jikes except when 
otherwise specified)


There has also been some more outlandish suggestions that we could try like
5. files become an aspect and you apply tasks to these files (very lisp-y)
6. task templating be implemented via this (ie think of transforming one task 
into a set of tasks via xsl or similar)

But none of these ideas has really seen enough playing with to see if they 
would be successful.

> I think the ability to just define things more clearly
> (dynamicProp="someval" versus <property name="dynamicProp" value="someval")
> adds a bit of value, 

I would see xdoclet as just another type that participates in the DocletInfo 
role (see other mail lfor further explanation).

>and the dynamic element capability has even more
> dramatic potential to allow a task to be "pluggable".

I don't see the functionality you suggested as supplying this.

> I know you made the
> comparison to a task container here, but a task container still has to have
> all the tasks contained within defined specifically either as
> builtin/optional or as <taskdef>.

Not sure what you mean here.

> I'm not quite sure how this compares/contrasts to what we could do with
> aspects, 

little to compare with each other. In fact an aspect could be used to do the 
validation based on the MetaInfo.

> but it could also do things like specify that certain attributes
> are required, what their meaning is, and other such metadata. Not only
> could documentation be generated, but so could actual Java code.  I'm not
> sure about generating code yet, but the main reason its useful is so that
> metadata is only specified in a single place (in the task itself) which
> then propogates into documentation and anywhere else that is needed.

+1

> Again, I think aspects are probably a viable solution to solve some of
> these issues but I'm not familiar enough with them yet to comment further. 
> I'd love to hear more about how aspects could (or couldn't) apply to Ant2's
> architecture.

See above for partial explanation but if you need more exaplanation feel free 
to ask questions ;)

-- 
Cheers,

Pete

*---------------------------------------------------------*
| Contrary to popular belief, UNIX is user-friendly. It   |
| just happens to be selective on who it makes friendship |
| with.                                                   |
|                       - Richard Cook                    |
*---------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 23:04, Erik Hatcher wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> > > I still don't get it.  :/
> >
> > Well I will put it in clearer terms. I think the way you are doing it
>
> sucks
>
> > ;) The way you should do it I have already described.
>
> You mean the way you should do it for Ant2, right?

mostly

> Is there another way to accomplish the same effect in Ant1.x that you could
> descibe and approve of?

Well I have already described one method. I haven't really thought about 
other mechanisms to do it - whats the problem of backporting that style 
architecture into Ant1?

-- 
Cheers,

Pete

----------------------------------
   "Don't play dumb with me. 
I happen to be an expert at that" 
           - Maxwell Smart
----------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>
> > I still don't get it.  :/
>
> Well I will put it in clearer terms. I think the way you are doing it
sucks
> ;) The way you should do it I have already described.

You mean the way you should do it for Ant2, right?

Is there another way to accomplish the same effect in Ant1.x that you could
descibe and approve of?

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 01:07, Erik Hatcher wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> > > When will Ant2 (1.9?) be
> > > released?  Why should <ejbjar>/XDoclet, and others have to live in
> > > agony until then when my patch alleviates it until the new architecture
> > > is released?
> >
> > preferably. That would maybe motivate some other committers or develoeprs
>
> to
>
> > help with Ant2 ...
>
> I don't really think thats a reasonable argument... motivation by
> constraining the current product is negative reinforcement.  Anyone with
> children knows that doesn't work!  :)

maybe I should have put a smiley at the end ;)

> > pretty much for the same reasons I -1'ed it last time.
>
> You -1'd it before because lack of use-cases, I thought.  I provided
> several.
>
> *sigh*
>
> I still don't get it.  :/

Well I will put it in clearer terms. I think the way you are doing it sucks 
;) The way you should do it I have already described. 

-- 
Cheers,

Pete

The avalanche has already started. It is too late for 
the pebbles to vote.  -Ambassador Kosh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 10 Jan 2002, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> From: "Stefan Bodewig" <bo...@apache.org>
>> > No point in asking for other committers feedback,
>>
>> Why not?
> 
> Well, I guess I did....  :))

The whole discussion had reached such a late point when I came back
from my Xmas vacation that it was more than a little difficult to
follow or even throw in my opinion (and don't ask about the general
lust 8-).

> I prefer the interface method and Ant should be defining the
> interfaces that vendors adhere to

I don't have a problem with them, but the FSF may have, that's all.

> I think we should be making life easier for task writers rather than
> tougher.

There is a certain balance to keep though.  "Keep the core simple and
push complexity into the tasks" has been heard a lot around here and I
still follow it.

We could as well provide an implementation for

>>   <usercondition classname="...">
>>     <classpath ... />
>>     <param name="..." value="..." />
>>   </usercondition>

as a utility class, something like

PluggableComponent {

    void setClassname(String name);
    void addParam(Param p);
    Path createClasspath();

    Object getElement();
}

and anybody who wants pluggable elements would have to support a
nested element of that type - the whole find that class and configure
it logic could be hidden there.

This would make the live easier for task writers without making any
changes to the container.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs FixCRLF.java

Posted by Magesh Umasankar <um...@apache.org>.
----- Original Message -----
From: bodewig@apache.org


>   - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
>   + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights

I do not know if the following would be a proper/legal copyright header,
but if we have

  * Copyright (c) 2000-$Date$ The Apache Software Foundation.  All rights

CVS will take care of date substitution for us and we can afford to
forget having to make such changes manually ;-)  Of course the problem is
the copyright would then read:

  * Copyright (c) 2000-$Date: 2002/01/10 16:50:32  $ The Apache Software
Foundation.  All rights

which may not be appealing to others...  Anyway, please don't look at this
very seriously - it is just my code cruncher mind speaking out ;-)

Cheers,
Magesh



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
From: "Stefan Bodewig" <bo...@apache.org>
> > No point in asking for other committers feedback,
>
> Why not?

Well, I guess I did....  :))

> Using a reflection based implementation may have been superior over
> interfaces and if it only way so that people who want to put their
> stuff under GPL can use this functionality without violating their own
> license 8-).

I prefer the interface method and Ant should be defining the interfaces that
vendors adhere to - this gives us a tighter contract with vendors and forces
them to adhere to it to tightly couple with Ant.  Seems like a win-win
situation.

> OK, seriously: I don't really follow the "pluggable attributes" use
> case, as you only save yourself from typing a couple of setter - and
> lose Ant's conversion service (for Files for example) as the price for
> it.

Yes, fair enough counterpoint, and one I had thought of myself, but figured
a task writer that wanted dynamic attributes would be willing to deal with
types on their own.

> Pluggable elements is a different story - of course all tasks that
> want to support such pluggability could do so now with some extra
> effort without needing the support you want to add to
> IntrospectionHelper.
>
> Something like
>
> <condition>
>   <usercondition classname="...">
>     <classpath ... />
>     <param name="..." value="..." />
>   </usercondition>
> </condition>
>
> could easily be implemented without your enhancement.

Agreed.

I think we should be making life easier for task writers rather than
tougher.  I'm sure this is a common goal of the committers: create a more
open and extensible build tool so that Ant itself doesn't have to maintain
as many tasks as it currently does.  The vendors should maintain them and
adhere to our contracts.

Given that the capability to dynamic stuff can already be achieved but in a
far clunkier manner, I don't see why it hurts to make it less clunky.

> What you propose just makes it simpler (and pushes part of the
> responsibility from tasks to the container), but it is not as if it
> would be impossible right now.
>
> I don't have a really strong opinion here, but I'm certainly not -1 on
> your changes.

Thanks.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 10 Jan 2002, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> I don't agree with that argument.  The world is stuck with Ant 1.x
> for the near future, and it certainly will live on for a while after
> Ant2 is released as well.

Agreed.

> No point in asking for other committers feedback,

Why not?

Using a reflection based implementation may have been superior over
interfaces and if it only way so that people who want to put their
stuff under GPL can use this functionality without violating their own
license 8-).

OK, seriously: I don't really follow the "pluggable attributes" use
case, as you only save yourself from typing a couple of setter - and
lose Ant's conversion service (for Files for example) as the price for
it.

Pluggable elements is a different story - of course all tasks that
want to support such pluggability could do so now with some extra
effort without needing the support you want to add to
IntrospectionHelper.  

Something like

<condition>
  <usercondition classname="...">
    <classpath ... />
    <param name="..." value="..." />
  </usercondition>
</condition>

could easily be implemented without your enhancement.

What you propose just makes it simpler (and pushes part of the
responsibility from tasks to the container), but it is not as if it
would be impossible right now.

I don't have a really strong opinion here, but I'm certainly not -1 on
your changes.

> Peter's argument that it encourages committers to stick with Ant1.x
> longer doesn't really seem applicable to me.

I don't buy it either.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by cm...@yahoo.com.
On Thu, 10 Jan 2002, Erik Hatcher wrote:

> I don't agree with that argument.  The world is stuck with Ant 1.x for the
> near future, and it certainly will live on for a while after Ant2 is
> released as well.

IMHO: it may (or should) stick a very long time.

So far ant1 solves all my 'itches', I use the current build.xml and the
current task interfaces in many projects and custom tasks. I can't
imagine any technical reason to switch to ant2 and spend the time to
change code and build files.

And if ant2 will have stricter contracts - it'll also probably have
less flexibility and more rules to follow - an extra reason to stick
with ant1 as long as a copy will be available somewhere on the web.

As more projects and tasks are using ant, the harder and unlikely
will be to get people to use ant2 - unless it is backward compatible on
both build.xml and task interface. Which can be done if the new 'cool'
interface is added as a separate package, and a 'backward compat'
layer is maintained ( which could be the current code ).

> Making Ant1.x more usable and extensible in the short term only seems like a
> *good thing* to me.  So many benefits, and no negatives that I can see.

+1 - the negative is fewer reasons to switch to ant2, but that's not
bad ( for many people who have existing projects ).

Costin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> > When will Ant2 (1.9?) be
> > released?  Why should <ejbjar>/XDoclet, and others have to live in agony
> > until then when my patch alleviates it until the new architecture is
> > released?
>
> preferably. That would maybe motivate some other committers or develoeprs
to
> help with Ant2 ...

I don't really think thats a reasonable argument... motivation by
constraining the current product is negative reinforcement.  Anyone with
children knows that doesn't work!  :)

> didn't you agree a bit back that we shouldn't be adding cruft to ant we
know
> is wrong and we wont be suporting in the future? What has changed your
mind?

I agree completely with that statement, although not sure I said it or not.
But, I don't believe DynamicConfigurator is wrong for Ant1.x so this
enhancement doesn't fit into that argument.  :)

All of the createX, addX, and setters are being morphed in Ant2 anyway, so
nothing in that realm of Ant1.x fits in Ant2, so its not like we're adding
flexibility that won't be present in Ant2.  Its already been decided that
Ant2 is not going to have the same ways of doing things that Ant1.x has and
that build.xml format will likely change dramatically too.

> > I assume we'll have an Ant 1.5 release in the near future.  With this
kind
> > of extensibility capability it could perhaps extend Ant 1.5's lifespan
and
> > reduce the number of Ant 1.x releases we need to get to Ant2 - and we as
> > committers could devote more attention to the new architecture.
>
> thats one way of looking at it. Very few people are actually willing to
put
> in the work to create Ant2 as far as I can tell. Adding more and more
things
> onto ant1.x just raises the difficulty of actually getting an ant2

I don't agree with that argument.  The world is stuck with Ant 1.x for the
near future, and it certainly will live on for a while after Ant2 is
released as well.

Making Ant1.x more usable and extensible in the short term only seems like a
*good thing* to me.  So many benefits, and no negatives that I can see.

> > Are you -1'ing my enhancement?  Or just -0?  I've given my best examples
of
> > use-cases, so time for a decision I suppose.  :))
>
> Still -1 sorry - ;)
>
> pretty much for the same reasons I -1'ed it last time.

You -1'd it before because lack of use-cases, I thought.  I provided
several.

*sigh*

I still don't get it.  :/

No point in asking for other committers feedback, I suppose, but certainly
I'd be interested to hear if others support my enhancement or disagree with
it.  I'd especially be interested in more arguments against it since Peter's
argument that it encourages committers to stick with Ant1.x longer doesn't
really seem applicable to me.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 00:14, Erik Hatcher wrote:
> I'll have to ponder the container needing to do the lookup rather than the
> task since the method of lookup desired may be different between tasks....
> some might want JNDI lookup, and others via properties files.  Your
> proposed container would allow for this extensibility?

If you really wanted - but why on earth would wou want something like that? 
See discussions on role vs type in other thread.

> But how long are we going to be using Ant 1.x? 

untill we are not.

> When will Ant2 (1.9?) be
> released?  Why should <ejbjar>/XDoclet, and others have to live in agony
> until then when my patch alleviates it until the new architecture is
> released?

preferably. That would maybe motivate some other committers or develoeprs to 
help with Ant2 ...

> It doesn't break backwards compatibility and only will enhance new tasks
> that desire to take advantage of it, not hurt older tasks. 

that could be said of many a feature.

> Isn't it
> detrimental to Ant's progress to not allow extensibility within our current
> architecture just because its not perfect and needs overhauling in the
> future?

didn't you agree a bit back that we shouldn't be adding cruft to ant we know 
is wrong and we wont be suporting in the future? What has changed your mind?

>  I realize that Ant2's (1.9?) architecture is dramatically
> different and the best route from here to there is to gut it and start from
> scratch in a lot of areas, but why restrict Ant1.x's progress just because
> something better is in the works?

see above. 

> I assume we'll have an Ant 1.5 release in the near future.  With this kind
> of extensibility capability it could perhaps extend Ant 1.5's lifespan and
> reduce the number of Ant 1.x releases we need to get to Ant2 - and we as
> committers could devote more attention to the new architecture.

thats one way of looking at it. Very few people are actually willing to put 
in the work to create Ant2 as far as I can tell. Adding more and more things 
onto ant1.x just raises the difficulty of actually getting an ant2 

> > > Seem reasonable?
> >
> > no ;)
>
> *arg*  :))   *shrug* - I don't get it.  *sigh*
>
> Are you -1'ing my enhancement?  Or just -0?  I've given my best examples of
> use-cases, so time for a decision I suppose.  :))

Still -1 sorry - ;)

pretty much for the same reasons I -1'ed it last time.

-- 
Cheers,

Pete

The big mistake that men make is that when they turn thirteen or fourteen and
all of a sudden they've reached puberty, they believe that they like women.
Actually, you're just horny. It doesn't mean you like women any more at
twenty-one than you did at ten.                --Jules Feiffer (cartoonist)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> Im not disgreeing with the need but as I said I disagree with the method
and
> consider it a workaround for limitations in Ant1.x model. The
> lookup/registry/factory etc for new implementations of interfaces should
NOT
> be done by the task but should be done by the container.

I'll have to ponder the container needing to do the lookup rather than the
task since the method of lookup desired may be different between tasks....
some might want JNDI lookup, and others via properties files.  Your proposed
container would allow for this extensibility?

> They are workarounds for ant1.x failings and thus I don't consider them
valid
> usecases at all ;)

But how long are we going to be using Ant 1.x?  When will Ant2 (1.9?) be
released?  Why should <ejbjar>/XDoclet, and others have to live in agony
until then when my patch alleviates it until the new architecture is
released?

It doesn't break backwards compatibility and only will enhance new tasks
that desire to take advantage of it, not hurt older tasks.  Isn't it
detrimental to Ant's progress to not allow extensibility within our current
architecture just because its not perfect and needs overhauling in the
future?  I realize that Ant2's (1.9?) architecture is dramatically different
and the best route from here to there is to gut it and start from scratch in
a lot of areas, but why restrict Ant1.x's progress just because something
better is in the works?

I assume we'll have an Ant 1.5 release in the near future.  With this kind
of extensibility capability it could perhaps extend Ant 1.5's lifespan and
reduce the number of Ant 1.x releases we need to get to Ant2 - and we as
committers could devote more attention to the new architecture.

We had this very issue just crop up with the JOnAS patch:
    http://marc.theaimsgroup.com/?l=ant-dev&m=101057195911657&w=2

With <ejbjar> refactored to implement DynamicConfigurator, this would not
have been an issue at all.

> > Seem reasonable?
>
> no ;)

*arg*  :))   *shrug* - I don't get it.  *sigh*

Are you -1'ing my enhancement?  Or just -0?  I've given my best examples of
use-cases, so time for a decision I suppose.  :))

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Thu, 10 Jan 2002 23:10, Erik Hatcher wrote:
> Have a look at org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java.
> Notice that it createIplanet, createWeblogic, createWebsphere, etc.  Thats
> got zero extensibility to plug in a new vendor.  By adding a dynamic lookup
> of EJBDeploymentTool implementing classes all that vendor-specific stuff
> could be pulled into a properties file embedded in the Ant distribution for
> the Ant provided ones, and then dynamically add them by having some kind of
> add-on lookup.... plugins="newejb.properties"
> newejb.properties has newvendor=com.newvendor.OurDeploymentTool and then
> <ejbjar> could use <newvendor> (the properties lookup is just my
> home-brewed idea, and isn't the only way or the best way)

Im not disgreeing with the need but as I said I disagree with the method and 
consider it a workaround for limitations in Ant1.x model. The 
lookup/registry/factory etc for new implementations of interfaces should NOT 
be done by the task but should be done by the container.

> So, which is uglier?  Lack of extensibility in the current hard-coded way
> of having sub-elements for tasks?  Or the DynamicConfigurator way of
> allowing pluggable sub-elements and attributes?

Both are equally ugly IMHO. I would prefer the approach I have outlined in 
the other threads ;)

> Are those use-cases enough?  :)

They are workarounds for ant1.x failings and thus I don't consider them valid 
usecases at all ;)

> As for dynamic attributes, the same kind of stuff applies, but more
> specifically I'm working on a custom task (soon to be seen by Jakarta) that
> has an attribute to specify a 'handler' class,
> handler="com.whatever.MyHandler".  I want to be able to pass configuration
> data to a handler, and via a Map would be best (or Properties).  It would
> be nicer to say:
>    <mytask prop1="some stuff" prop2="some more stuff">
> rather than
>    <mytask>
>       <data name="prop1" value="some stuff"> .....
>
> Seem reasonable?

no ;)

-- 
Cheers,

Pete

*-----------------------------------------------------------------------*
PROGRAM: n.  a magic spell cast over a computer allowing it to turn
one's input into error messages.  v.t.  to engage in a pastime similar
to banging one's head against a wall, but with fewer opportunities for 
reward.
*-----------------------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
From: "Peter Donald" <pe...@apache.org>

> implementation is fine and yay you used an interface - everyone else here
> seems to prefer reflection.

:)

Don't hold it against me, but I used the interface that Jose provided - my
original thoughts were just for attributes, but the elements really adds
life to it.

> > Peter - thoughts?  What kind of potential beasts are we unleashing if we
> > accept this?
>
> a whole bunch of uglies ;)

Ok, see below for all the uglies that it could remove....

> Well the negative is mainly that as yet you haven't been able to give me a
> real use case. It wouldn't even help in the case of the DocletInfo or
> whatever it was due to the way javadoc works and besides I consider it a
> workaround for the limitations of Ant1.x rather than a good features.
>
> So probably the best idea is to come up with a valid use case :)

Have a look at org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java.
Notice that it createIplanet, createWeblogic, createWebsphere, etc.  Thats
got zero extensibility to plug in a new vendor.  By adding a dynamic lookup
of EJBDeploymentTool implementing classes all that vendor-specific stuff
could be pulled into a properties file embedded in the Ant distribution for
the Ant provided ones, and then dynamically add them by having some kind of
add-on lookup.... plugins="newejb.properties"
newejb.properties has newvendor=com.newvendor.OurDeploymentTool and then
<ejbjar> could use <newvendor> (the properties lookup is just my home-brewed
idea, and isn't the only way or the best way)

Now, look at the same situation on the XDoclet side of things:
<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xdoclet/xdoclet/core/src/xdo
clet/ejb/EjbDocletTask.java?annotate=1.25>  (sorry if the URL wraps and
breaks)

So, which is uglier?  Lack of extensibility in the current hard-coded way of
having sub-elements for tasks?  Or the DynamicConfigurator way of allowing
pluggable sub-elements and attributes?

Are those use-cases enough?  :)

As for dynamic attributes, the same kind of stuff applies, but more
specifically I'm working on a custom task (soon to be seen by Jakarta) that
has an attribute to specify a 'handler' class,
handler="com.whatever.MyHandler".  I want to be able to pass configuration
data to a handler, and via a Map would be best (or Properties).  It would be
nicer to say:
   <mytask prop1="some stuff" prop2="some more stuff">
rather than
   <mytask>
      <data name="prop1" value="some stuff"> .....

Seem reasonable?

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Wed, 9 Jan 2002 23:17, Erik Hatcher wrote:
> DynamicConfigurator has been implemented.  Attached is a .zip file with all
> the pieces (although sorry the directory structure didn't get embedded).
> The test case, of course, passes.  I didn't really intend to implement it
> fully, I was just investigating the possibilities, and it was easy enough
> to go all the way with it.
>
> The two pieces added to IntrospectionHelper are pretty small.  The change
> to createElement could have been done a bit cleaner by refactoring the
> entire method slightly, but I wanted to get the functionality reviewed
> cleanly rather than the refactoring getting in the way of review.

implementation is fine and yay you used an interface - everyone else here 
seems to prefer reflection.

> This isn't a representative task, but illustrates the pluggable capability
> that has been added.

yep.

> Peter - thoughts?  What kind of potential beasts are we unleashing if we
> accept this?

a whole bunch of uglies ;)

> Personally I'm +1 on it, obviously!  :)  But I'm eager to hear the
> negatives to this implementation as well.

Well the negative is mainly that as yet you haven't been able to give me a 
real use case. It wouldn't even help in the case of the DocletInfo or 
whatever it was due to the way javadoc works and besides I consider it a 
workaround for the limitations of Ant1.x rather than a good features.

So probably the best idea is to come up with a valid use case :)


-- 
Cheers,

Pete

"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Ta da!

DynamicConfigurator has been implemented.  Attached is a .zip file with all
the pieces (although sorry the directory structure didn't get embedded).
The test case, of course, passes.  I didn't really intend to implement it
fully, I was just investigating the possibilities, and it was easy enough to
go all the way with it.

The two pieces added to IntrospectionHelper are pretty small.  The change to
createElement could have been done a bit cleaner by refactoring the entire
method slightly, but I wanted to get the functionality reviewed cleanly
rather than the refactoring getting in the way of review.

Here's the details from the test case, so you won't have to open the .zip to
see how it works:

    <taskdef name="dyna"
             classname="org.apache.tools.ant.taskdefs.DynamicTask">
      <classpath refid="testclasses" />
    </taskdef>
    <dyna prop1="1" prop2="2">
      <sub prop3="3"/>
      <anything prop4="4"/>
    </dyna>

DynamicTask is simply:

public class DynamicTask extends Task implements DynamicConfigurator {

    public void execute() {
    }

    public void setDynamicAttribute(String name, String value) {
        project.setNewProperty(name, value);
    }

    public Object createDynamicElement(String name) {
        return new Sub();
    }

    public class Sub implements DynamicConfigurator {
        public void setDynamicAttribute(String name, String value) {
            project.setNewProperty(name, value);
        }

        public Object createDynamicElement(String name) {
            return null;
        }
    }
}

This isn't a representative task, but illustrates the pluggable capability
that has been added.

I envision that we could have an abstract helper class or two that implement
DynamicConfigurator and provide the 'return null' of createDynamicElement so
a task or sub-element wouldn't have to provide it, or have an implementation
of setDynamicAttribute that throws a BuildException stating that the
attribute is not supported.  But that is just icing.

Peter - thoughts?  What kind of potential beasts are we unleashing if we
accept this?

Personally I'm +1 on it, obviously!  :)  But I'm eager to hear the negatives
to this implementation as well.

Thanks,
    Erik


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> Theres plenty of things - will have a look and tell you if I don't like.
> However the main reason I would -1 is because it is only a workaround for
a
> limitation of ant and I don't want to be supporting more ugly hack
> workarounds into the future ;)

Neither do I.  :)

I'll ensure it won't be ugly.

> We already have oodles more "join points" (ie places where we are
flexible)
> than we actually need if it had designed it properly from the start.

No argument there.

I've just started trying to wrap my head around aspects. I believe these are
proposed for Ant2, right?  Could elaborate a bit more on the types of
aspects you envision?

> > > When these limitations are removed there would be no need for
DynaTask.
> > > So besides the specified case have you got another example ?
> >
> > The XDoclet use-case is the only use-case I have in mind now.
>
> That makes me less inclined to support it if anything ;)

I think the ability to just define things more clearly
(dynamicProp="someval" versus <property name="dynamicProp" value="someval")
adds a bit of value, and the dynamic element capability has even more
dramatic potential to allow a task to be "pluggable".  I know you made the
comparison to a task container here, but a task container still has to have
all the tasks contained within defined specifically either as
builtin/optional or as <taskdef>.

> > Keep in mind that I'm of the opinion that Ant probably should be using
> > XDoclet in the future to allow a lot of a tasks configuration to be
> > specified in meta-data allowing documentation to be generated as well as
> > any other artifacts needed (configurator Java classes perhaps?).
>
> Sounds kool Could you give us an example of what something like that would
> look like? and have you played with any of it yet?

Yes, I've been playing with XDoclet a bit.  Its to-do list generator is a
great way to get introduced to it, but here's a different simple example:

/**
 * ant:taskname mytask
 */
public class MyCustomTask extends Task...

Running XDoclet can build a properties file:

    mytask=com.foobar.MyCustomTask

And then load with <taskdef>.  The advantage is that many tasks can be
defined in one properties file and defined in a build file all at once.
Ant's own tasks could use this to build the embedded task definition
properties file.  I'd be willing to demonstrate that more explicitly if it
is deemed useful by putting a target into Ant's build that does this, and
modifying a handful of tasks to have that Javadoc comment.

I'm not quite sure how this compares/contrasts to what we could do with
aspects, but it could also do things like specify that certain attributes
are required, what their meaning is, and other such metadata. Not only could
documentation be generated, but so could actual Java code.  I'm not sure
about generating code yet, but the main reason its useful is so that
metadata is only specified in a single place (in the task itself) which then
propogates into documentation and anywhere else that is needed.

Again, I think aspects are probably a viable solution to solve some of these
issues but I'm not familiar enough with them yet to comment further.  I'd
love to hear more about how aspects could (or couldn't) apply to Ant2's
architecture.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 11:39, Conor MacNeill wrote:
> > -----Original Message-----
> > From: Adam Murdoch [mailto:adammurdoch_ml@yahoo.com]
> > Sent: Monday, 7 January 2002 10:31 AM
> > To: Ant Developers List
> > Subject: RE: IntrospectionHelper request
> >
> > > Where we have numerous patterns for things like
> > >
> > > addX
> > > createX
> > > addConfiguredX
> > > setX
> > >
> > > we could have probably gotten away with just
> > >
> > > addX
> > > setX
> > >
> > > or even just
> > >
> > > setX
> >
> > Good idea (for Ant 2, at least).  The current distinction between
> > attributes and elements on the task interface is kinda artifical.
>
> Adam,
>
> Have you considered the difference between createX and addX. This is not
> about attribute/elements. It is about who knows how to create an object. If
> we just have setX, then the implication is that all nested element objects
> are created by the core and not by the task. Are you suggesting that the
> ability for a task to create its nested elements should be removed?

Hell yes !

-- 
Cheers,

Pete

---------------------------------------------
 We shall not cease from exploration, and the 
  end of all our exploring will be to arrive 
 where we started and know the place for the 
        first time -- T.S. Eliot
---------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> -----Original Message-----
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> Sent: Monday, 7 January 2002 10:40 AM
> To: Ant Developers List
> Subject: RE: IntrospectionHelper request
> 
> 
> 
> 
> > -----Original Message-----
> > From: Adam Murdoch [mailto:adammurdoch_ml@yahoo.com]
> > Sent: Monday, 7 January 2002 10:31 AM
> > To: Ant Developers List
> > Subject: RE: IntrospectionHelper request
> > 
> > 
> > 
> > 
> > > Where we have numerous patterns for things like
> > > 
> > > addX
> > > createX
> > > addConfiguredX
> > > setX
> > > 
> > > we could have probably gotten away with just
> > > 
> > > addX
> > > setX
> > > 
> > > or even just
> > > 
> > > setX 
> > > 
> > 
> > Good idea (for Ant 2, at least).  The current distinction between 
> > attributes and elements on the task interface is kinda artifical. 
> 
> Adam,
> 
> Have you considered the difference between createX and addX. This 
> is not about attribute/elements. It is about who knows how to 
> create an object. If we just have setX, then the implication is 
> that all nested element objects are created by the core and not 
> by the task. Are you suggesting that the ability for a task to 
> create its nested elements should be removed?
> 

Not removed - though maybe less necessary.  The main uses I've seen for a create method are:

* To create an adaptor, or some other polymorphic type.  This is definitely something that is better done outside the task.

* To create nested Path elements, because Path doesn't have a no-args constructor.  Same for Mapper and a few others.

* For implicit file sets.

There are other other uses, of course, but these seem to be the main ones.  And none of them terribly compelling justifications.  It might be worth considering doing away with the create method for Ant 2.

The problem with a create method is that it gets in the way of the container doing stuff like type substitution or reference resolution.  The create method is responsible for both creation and setting the element value, so the container (or the user) can't override the creation.

Perhaps we change the semantics of the create method in Ant 2, so that it is only responsible for creation.  The container would not always call the create method  - it would call it instead of calling the no-args constructor of the nested type.  The container would always call the set method, with a fully configured object, regardless of where the object came from.


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.

> -----Original Message-----
> From: Adam Murdoch [mailto:adammurdoch_ml@yahoo.com]
> Sent: Monday, 7 January 2002 10:31 AM
> To: Ant Developers List
> Subject: RE: IntrospectionHelper request
> 
> 
> 
> 
> > Where we have numerous patterns for things like
> > 
> > addX
> > createX
> > addConfiguredX
> > setX
> > 
> > we could have probably gotten away with just
> > 
> > addX
> > setX
> > 
> > or even just
> > 
> > setX 
> > 
> 
> Good idea (for Ant 2, at least).  The current distinction between 
> attributes and elements on the task interface is kinda artifical. 

Adam,

Have you considered the difference between createX and addX. This is not about attribute/elements. It is about who knows how to create an object. If we just have setX, then the implication is that all nested element objects are created by the core and not by the task. Are you suggesting that the ability for a task to create its nested elements should be removed?

Conor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> Where we have numerous patterns for things like
> 
> addX
> createX
> addConfiguredX
> setX
> 
> we could have probably gotten away with just
> 
> addX
> setX
> 
> or even just
> 
> setX 
> 

Good idea (for Ant 2, at least).  The current distinction between attributes and elements on the task interface is kinda artifical.  As far as the task is concerned, they're all just parameters.  Maybe they get constructed from an attribute, maybe assembled from a nested element, maybe referenced from somewhere else, maybe entered at a prompt or selected in a list box - the task doesn't know or care.

Doing away with the distinction would give the container flexibility to do things like provide consistent build file shortcuts for data types that can be constructed from a string, and for references.

For example, both the following cases would be handled by the container; the <javac> task would have a single setClassPath(Path cp) method:

<javac classpath="...">

<javac>
   <classpath> ... </classpath>
</javac>

The container would also handle references, and call the same setClassPath() method.

<javac classpath-ref="some-path">

<javac>
    <classpath-ref id="some-path"/>
</javac>


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 06:40, Erik Hatcher wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> > Most likely I would -1 it but it would depend upon how it was implemented
> > essentially. I think it is really poor design of tasks that would require
> > this and would almost certainly reject any task that used it ;)
>
> I would implement it using the interface that I proposed, and that Jose
> refined.  Simple as that, and probably would only involve a few lines of
> code (at least it should :).

ok will actually have a proepr look at it tonight ;)

> Would you -1 that implementation?  I just want to know before I code it and
> get shot down!  :)

Theres plenty of things - will have a look and tell you if I don't like. 
However the main reason I would -1 is because it is only a workaround for a 
limitation of ant and I don't want to be supporting more ugly hack 
workarounds into the future ;)

> How does implementing this open the flood gates to bad things?

Increasing the "surface area" of a project always comes at a cost. If the 
cost can not be justified by added features etc or the cost is not offset 
somehow then it is probably a bad idea to add specific feature.

We already have oodles more "join points" (ie places where we are flexible) 
than we actually need if it had designed it properly from the start. Where we 
have numerous patterns for things like

addX
createX
addConfiguredX
setX

we could have probably gotten away with just

addX
setX

or even just

setX 

if we didn't want to make to much of a distinction between 
elements/attributes.


Think of it this way. Give ant 50 points for every minor feature and 100 
points for every major feature. Then subtract 5 points for every  "access 
point" (ie public/protected methods/attributes) and subtract 100 points for 
every structure/pattern required and 10 points for every public class.

The higher the result the better ant is from both a user and developers point 
of view. However I think ant would actually score rather low as it has a 
whole bunch of tasks written in an "interesting" manner. Some have public 
attributes (!!!), many include numerous protected/public methods that don't 
need to be public/protected, we have many replicated/redundent 
patterns/classes that come from different stages of ants evolution etc. 

> > So far I haven't actually seen a good use for it. Can you give me a good
>
> use
>
> > case ? The only one provided is directly due to limitations in Ant1.x
>
> model.
>
> > When these limitations are removed there would be no need for DynaTask.
> > So besides the specified case have you got another example ?
>
> The XDoclet use-case is the only use-case I have in mind now.

That makes me less inclined to support it if anything ;)

> Keep in mind that I'm of the opinion that Ant probably should be using
> XDoclet in the future to allow a lot of a tasks configuration to be
> specified in meta-data allowing documentation to be generated as well as
> any other artifacts needed (configurator Java classes perhaps?).

Sounds kool Could you give us an example of what something like that would 
look like? and have you played with any of it yet?

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Tue, 8 Jan 2002 22:34, Peter Donald wrote:
> On Tue, 8 Jan 2002 09:20, Jose Alberto Fernandez wrote:
> > There is still the issue on how to define which compiler to use (i.e.,
> > the current magic properties) and eventhough I do not fully like it, they
> > are quite flexible since its value can be taken from a property file and
> > do not require any hardcoding or manipulation of the build file itself. I
> > am not sure how aspects will compete with this degree of flexibility.

Oops - I forgot to answer this bit. Aspects would be one way of implementing 
it. You could specify preference javac.compiler="jikes" and then the aspect 
would try to set the compiler attribute to jikes in the javac task if it had 
not already been set. Thus there are no magic attributes as such but we still 
have a flexible system - actually it may be a bit too flexible ;)

-- 
Cheers,

Pete

--------------------------------------------------
"An intellectual is someone who has been educated 
beyond their intelligence."
--------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Sat, 12 Jan 2002 14:23, Jose Alberto Fernandez wrote:
> > Umm ... I have talked about this before - this wont be a problem if they
> > extend AbstractTaskContainer because they will never be exposed to low
> > level APIs.
>
> Well maybe I do not understand the code. Can you explain how this
> simplifies doing whatever one wants to do with configuration? The code seem
> to just provide the default Configurator and use it. But if that is the
> case then why did I needed to implement Configurable in the first place?

I don't recall what the code looks like at this point in time but I have said 
that it will eventually look like something such as

setAttribute( name, value );
addElement( name, value );
execTask( myTask );
etc. 

This should cover most of the normal stuff.

I guess we could make AbstractTaskContainer implement configurable and then 
allow subclasses to get config tree via getConfiguration() - that would be 
less work to them and expose less complexity. 

-- 
Cheers,

Pete

---------------------------------------------------
"If you don't know where you want to go, we'll make 
sure you get taken." 
Microsoft ad slogan, translated into Japanese.
---------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Sat, 12 Jan 2002 13:48, Jose Alberto Fernandez wrote:
> 
> I think it is a good rule to actually code/experiment with the things you are 
> talking about before talking about them - have you done that ?
> 
> > > This gives them a method to do whatever they want so instead of saying no
> > > you can't do X and we wont change it so that you can, we say we don't X
> > > but if you really want it you can write a container to do it and support
> > > it yourself.
> > >
> > > Sure it will be rarely used in regular tasks but useful for some
> > > oddballs.
> >
> > As I have said before, eventhough reflection is very powerful, it is not
> > the end all solution for everyone. What I cannot understand is why you
> > first define myrmidon with all this flexibility of having multiple
> > implementations of ObjectConfigurer (by using an interface instead of a
> > firm implementation) and then you provide no easy way of using it.
> 
> I didn't do that part ;) I left it as an interface because it may be possible 
> to experiment with these things and see how they work out. 
> 
> > The problem with Configurator and passing the buck to the task is that
> > since the job is not easy it will require either that task developers
> > reinvent the code that is already part of myrmidon or for them to use
> > internal myrmidon components in order to perform the configuration. The
> > result is that internal APIs will be exposed and therefore we will finish
> > having the same kind of backward compatibility problems that we have today
> > in ANT1 and that we were suppose to eliminate on ANT2.
> 
> Umm ... I have talked about this before - this wont be a problem if they 
> extend AbstractTaskContainer because they will never be exposed to low level 
> APIs.

Well maybe I do not understand the code. Can you explain how this simplifies
doing whatever one wants to do with configuration? The code seem to just
provide the default Configurator and use it. But if that is the case then why did I
needed to implement Configurable in the first place?

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Sat, 12 Jan 2002 13:48, Jose Alberto Fernandez wrote:
> > Which is why it will rarely be used. It is basically only there so that
> > people can do virtually anything they want - even if it is ludicrous.
> > Many people have asked for things like ability to define methods,
> > funcitons, for loops, various other containers and repeaters and so
> > forth. Now none of these is ever likely to be implemented or support by
> > ant-dev but people still want them.
>
> So you sre defining a whole mechanism whose one of its purposes is to be as
> dificult to use as possible?

errr .... love to hear of a simpler system that comes even vaguely close in 
flexability. Try coding the configurator approach and get back to me on which 
you think is easier.

> And whose goal is to not be used.

The goal is to be used - when people need to do things we are not willing to 
do they have the option of getting around us.

> I think that is not a good designing rule.

I think it is a good rule to actually code/experiment with the things you are 
talking about before talking about them - have you done that ?

> > This gives them a method to do whatever they want so instead of saying no
> > you can't do X and we wont change it so that you can, we say we don't X
> > but if you really want it you can write a container to do it and support
> > it yourself.
> >
> > Sure it will be rarely used in regular tasks but useful for some
> > oddballs.
>
> As I have said before, eventhough reflection is very powerful, it is not
> the end all solution for everyone. What I cannot understand is why you
> first define myrmidon with all this flexibility of having multiple
> implementations of ObjectConfigurer (by using an interface instead of a
> firm implementation) and then you provide no easy way of using it.

I didn't do that part ;) I left it as an interface because it may be possible 
to experiment with these things and see how they work out. 

> The problem with Configurator and passing the buck to the task is that
> since the job is not easy it will require either that task developers
> reinvent the code that is already part of myrmidon or for them to use
> internal myrmidon components in order to perform the configuration. The
> result is that internal APIs will be exposed and therefore we will finish
> having the same kind of backward compatibility problems that we have today
> in ANT1 and that we were suppose to eliminate on ANT2.

Umm ... I have talked about this before - this wont be a problem if they 
extend AbstractTaskContainer because they will never be exposed to low level 
APIs.

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Common sense is the collection of prejudices        |
|  acquired by age 18. " -Albert Einstein              |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> From: Jose Alberto Fernandez [mailto:j_a_fernandez@yahoo.com]
> 
> As I have said before, eventhough reflection is very powerful, it 
> is not the end all solution for everyone. What I cannot 
> understand is why you first define myrmidon with all this 
> flexibility of having multiple implementations of 
> ObjectConfigurer (by using an interface instead of a firm 
> implementation) and then you provide no easy way of using it. 
> 

That's my fault - it's not quite finished yet.  Being able to use it is on the list of things to try soon.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Fri, 11 Jan 2002 15:42, Adam Murdoch wrote:
> > I'm not a big fan of Configurable, for two reasons:  It's an all-or-nothing
> > approach, where the object has to do all the work.  Granted, there are
> > helpers, but the object is responsible for doing the work.  I think in
> > almost every case, the task doesn't want to use a completely non-standard
> > scheme for configuring itself.  Instead the task simply wants to change how
> > a particular element or attribute is handled, and use the standard scheme
> > for everything else.
> 
> How many tasks do you envision actually using this capability and which tasks 
> might they be ?
> 
> > The other reason is that Configurable is totally opaque.  You lose
> > meta-info about the object, and so can't do things like configure it in a
> > GUI, or generate doco for it.
> 
> Precisely ;)
> 
> Which is why it will rarely be used. It is basically only there so that 
> people can do virtually anything they want - even if it is ludicrous. Many 
> people have asked for things like ability to define methods, funcitons, for 
> loops, various other containers and repeaters and so forth. Now none of these 
> is ever likely to be implemented or support by ant-dev but people still want 
> them. 
> 

So you sre defining a whole mechanism whose one of its purposes is to be as dificult to use as possible? And whose goal is to not be used. I think that is not a good designing rule.

> This gives them a method to do whatever they want so instead of saying no you 
> can't do X and we wont change it so that you can, we say we don't X but if 
> you really want it you can write a container to do it and support it yourself.
> 
> Sure it will be rarely used in regular tasks but useful for some oddballs.

As I have said before, eventhough reflection is very powerful, it is not the end all solution for everyone. What I cannot understand is why you first define myrmidon with all this flexibility of having multiple implementations of ObjectConfigurer (by using an interface instead of a firm implementation) and then you provide no easy way of using it. 

The problem with Configurator and passing the buck to the task is that since the job is not easy it will require either that task developers reinvent the code that is already part of myrmidon or for them to use internal myrmidon components in order to perform the configuration. The result is that internal APIs will be exposed and therefore we will finish having the same kind of backward compatibility problems that we have today in ANT1 and that we were suppose to eliminate on ANT2.

The job of the container must be clear and must be always perorm by the container. The moment you pass the work to the Task writer you will finish with all kinds of problems and dependencies on the particuler implementation at the time their Task were written.

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 15:42, Adam Murdoch wrote:
> It becomes better once you start adding meta-info discovery methods to
> ObjectConfigurer (and rename it TypeInfo, say).

I think I have a different idea of what TypeInfo does than you do. I was 
thinking that TypeInfo was meta-data for type similar to how other component 
models have meta data for type (think BeanInfo and friends).

However you see to be idicating that TypeInfo should be a class used to 
configure - much more than data. In this case it may be better to use a 
designator that does not conflict with existing terminology in similar 
domains (ie it is isn't an info but maybe a configurer).

Infos (as traditionally defined) are not incompatible with whats already in 
myrmidon. And they can be used to enhance the reflection based introspection 
in all sorts of ways however that still does not alleviate the need for 
Configurables I don't think.

> I'm not a big fan of Configurable, for two reasons:  It's an all-or-nothing
> approach, where the object has to do all the work.  Granted, there are
> helpers, but the object is responsible for doing the work.  I think in
> almost every case, the task doesn't want to use a completely non-standard
> scheme for configuring itself.  Instead the task simply wants to change how
> a particular element or attribute is handled, and use the standard scheme
> for everything else.

How many tasks do you envision actually using this capability and which tasks 
might they be ?

> The other reason is that Configurable is totally opaque.  You lose
> meta-info about the object, and so can't do things like configure it in a
> GUI, or generate doco for it.

Precisely ;)

Which is why it will rarely be used. It is basically only there so that 
people can do virtually anything they want - even if it is ludicrous. Many 
people have asked for things like ability to define methods, funcitons, for 
loops, various other containers and repeaters and so forth. Now none of these 
is ever likely to be implemented or support by ant-dev but people still want 
them. 

This gives them a method to do whatever they want so instead of saying no you 
can't do X and we wont change it so that you can, we say we don't X but if 
you really want it you can write a container to do it and support it yourself.

Sure it will be rarely used in regular tasks but useful for some oddballs.

-- 
Cheers,

Pete

---------------------------------------------
 We shall not cease from exploration, and the 
  end of all our exploring will be to arrive 
 where we started and know the place for the 
        first time -- T.S. Eliot
---------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> From: Peter Donald [mailto:peter@apache.org]
> >
> > OK, I finally took a quick look at some of the interfaces of 
> Myrmidon and
> > here is a more concrete proposal. So what I am saying is to allow Tasks
> > to provide their own ObjectConfigurer to use by the DefaultConfigurer.
> >
> > Instead of passing the configuration to the object if the Task 
> implements
> > Configurable, what you do is ask the Task to provide an ObjectConfigurer
> > if the Task defines DynamiclyConfigurable (for example):
> >
> >     interface DynamiclyConfigurable {
> >         ObjectConfigurer getConfigurer();
> >     }
> >
> > For what I see of the the definition of ObjectConfigurable is should be
> > quite easy for an object to define its own methods, and if we 
> provide a few
> > predefined helper classes, the whole affair could be even more trivial.
> 
> I don't see how this is any better or worse than what is already there ? 
> Whats to stop a programmer doing evil things with this? Why is this any 
> inherently better than the way it is currently done?
> 

It becomes better once you start adding meta-info discovery methods to ObjectConfigurer (and rename it TypeInfo, say).

I'm not a big fan of Configurable, for two reasons:  It's an all-or-nothing approach, where the object has to do all the work.  Granted, there are helpers, but the object is responsible for doing the work.  I think in almost every case, the task doesn't want to use a completely non-standard scheme for configuring itself.  Instead the task simply wants to change how a particular element or attribute is handled, and use the standard scheme for everything else.

The other reason is that Configurable is totally opaque.  You lose meta-info about the object, and so can't do things like configure it in a GUI, or generate doco for it.


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 12:05, Jose Alberto Fernandez wrote:
> > > The problem I have with this is that it allows a Task to violate all
> > > and any rules.
> >
> > precisely. It is the "escape and do whatever you feel like" bit so that
> > people can do whatever they feel like doing and still run it inside ant
> > with out messing up the container for other tasks.
>
> I think I am against unbound flexibility. I would argue that the job of the
> Configurer (to give it a name) is to maintain a minimum set of rules of
> behaviour. Once you start given away control in an unbound way there is no
> way back. Remember, that part of the aim in ANT2 is to allow people to
> write and distribute their own tasks. We cannot just say that we would tr
> to keep a lit on it.

Perhaps but a lot of people have complained that they want to do X in ant. 
Where X is some new thing which the majority of ant-dev  dont want to 
support. ie you and foreach or other people and X.

This just gives them a route to do it - now ant-dev wont have to block it - 
the other people can support their own task fully and it will hopefully not 
cause us any issues.

So can bad stuff be done with this? definetly. 
Do some people want to do bad stuff ? yeppo
Does ant-dev need to support any of this bad stuff? nope.

So hopefully ant-dev are less likely to be thought-police and more likely to 
people providing a platform - if other people want to do things we consider 
absurd - fine - they will need to support themselves though ;)

Almost everything in myrmidon is designed to be pluggable and allow people to 
do whatever they want - the only exception being policy (ie are properties 
immutable etc) and that is mainly as I never got around to changing it ;)

> > >I think the container (via an enhanced Introspection) needs to
> > > be the one in control here. By enhanced I mean that the work is not
> > > only based on Class introspection, but the Task is allowed to say what
> > > is willing to accept (what we have been talking about DynamicTask
> > > providing their own introspector).
> >
> > I await your fleshed out proposal. I haven't found anything that is both
> > easy and as flexible as the described approach.
>
> OK, I finally took a quick look at some of the interfaces of Myrmidon and
> here is a more concrete proposal. So what I am saying is to allow Tasks
> to provide their own ObjectConfigurer to use by the DefaultConfigurer.
>
> Instead of passing the configuration to the object if the Task implements
> Configurable, what you do is ask the Task to provide an ObjectConfigurer
> if the Task defines DynamiclyConfigurable (for example):
>
>     interface DynamiclyConfigurable {
>         ObjectConfigurer getConfigurer();
>     }
>
> For what I see of the the definition of ObjectConfigurable is should be
> quite easy for an object to define its own methods, and if we provide a few
> predefined helper classes, the whole affair could be even more trivial.

I don't see how this is any better or worse than what is already there ? 
Whats to stop a programmer doing evil things with this? Why is this any 
inherently better than the way it is currently done?

> Well, this is one reason I do not like auto-installation of libraries. One
> should declare the libraries that one want to have available to the build.
> As with java extensions when you allow auto-installation, the result is
> unpredictable behaviour.
>
> As for clashes, there are several things that need to be done:
>
> 1) Buildfiles should execute on a stable environment i.e., no auto-install
> but all libraries (appart from core) should be declared on the buildfile.
>
> 2) The container should detect clashes by looking at all possible role
> registries that may apply. This can be done quite efficiently.

+1 to all above (though I believe other committers have -1'ed it in the past) 
- however this does not stop libraries adding types unless you do the 
equivelent of single imports for every type you use which may be somewhat 
painful.

> 3) A clash resolution mechanism should be provided, posibly using aspects
> to indicate the expected role to be used in a particular occurrance.

I can't see how this would work. Could you explain it ?

> We have voted for and against so many things that are now part of ANT that
> I do not think the issue should be the vote but the technical merit of the
> approach. And then we can vote again (the commiters I mean).

true the votes mean nothing but I don't think the vote on that particular item is likely to change ;)

> > Im not sure what the advantage of this. How is it any different to
> >
> > <role name="task" interface="org.apache.ant.TaskModel"/>
>
> The diference is that here you are indicating that all <task> should
> implement TaskModel, which is wrong. <task> implement Task, but the
> container needs to interpose a TaskModel between the two.
>

Still lost me - explain in code speak how you would write such a task.

> Well, what I am refering to is how the TaskModel captures the XML that
> defines it. We are probably talking about quite similar thins here. The
> only difference may be that for me TaskModel contains only the little piece
> of the XMLModel that corresponds to a particular Task (to each
> add(TaskModel) operation) and not one object for the entire Task being
> configured (which iswhat you do with Configurable).

Each COnfiguration object represents an XML fragment. It depends on the task 
to interpret it - it could be a task but it also could be a datatype or 
something else.

> I really do not thing Myrmidom is too far from what I am proposing.

I don't think so either except for that interspicing of TaskModel thing which 
I don't quite understand yet ;)

-- 
Cheers,

Pete

----------------------------------
   "Don't play dumb with me. 
I happen to be an expert at that" 
           - Maxwell Smart
----------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
 --- Peter Donald <pe...@apache.org> wrote: > On Fri,
11 Jan 2002 22:57, Jose Alberto Fernandez
> wrote:
> > OK, I may be using the term aspect wrongly. What I
> > meant was that the user could write something like
> > this to solve the conflict:
> >
> >  <task1>
> >    <a/>
> >    <b ant:role="task" />
> >  </task1>
> >
> > 'ant:role' is not an attribute for the task, but
> for
> > the confgurator to know how to resolve the
> conflict.
> > I thought this is a use of aspect, the same way we
> > have discussed how to deal with failonerror (i.e.,
> > ant:failonerror="true").
> 
> Thats one way of doing but then you are back to
> declaring roles of all 
> elements (because you never know when a clash can
> occur). 

Yes you do, becuase you would not have the
auto-install nonsense. You say what is available on
the buildfile and therefore you know on first run
which clashes occur (if any) and resolve them.

The only way to guarantee stable builds in to
guarantee stable environments (i.e., no auto-install).

Jose Alberto


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Fri, 11 Jan 2002 22:57, Jose Alberto Fernandez wrote:
> OK, I may be using the term aspect wrongly. What I
> meant was that the user could write something like
> this to solve the conflict:
>
>  <task1>
>    <a/>
>    <b ant:role="task" />
>  </task1>
>
> 'ant:role' is not an attribute for the task, but for
> the confgurator to know how to resolve the conflict.
> I thought this is a use of aspect, the same way we
> have discussed how to deal with failonerror (i.e.,
> ant:failonerror="true").

Thats one way of doing but then you are back to declaring roles of all 
elements (because you never know when a clash can occur). 

-- 
Cheers,

Pete

----------------------------------------------
Money is how people with no talent keep score.
----------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
 --- Adam Murdoch <ad...@yahoo.com> wrote: > 
> 
> > From: Jose Alberto Fernandez
> > As for clashes, there are several things that need
> to be done:
> > 
> > 1) Buildfiles should execute on a stable
> environment i.e., no auto-install
> > but all libraries (appart from core) should be
> declared on the buildfile.
> > 
> 
> This doesn't really solve the problem, just makes it
> less likely to happen.  Which just makes having to
> declare stuff an inconvenience.  The real solution
> is 2) and 3) below.
> 

The importance of (1) is that it allows you to make
sure your buildfile will work no matter what the
developer has installed in the machine. 
Remember buildfiles are a share resource for all the
developers in the project, it has to work correctly as
long as any required tasklib is available and even if
a developer has additional tasklibs for other
projects.

> Perhaps a good compromise would be no auto-install
> and an <import-all/> task.
> 

On a tipical buildfile, how many different tasklibs do
you think people will be using? 1, 2, 100? I bet the
number will be in the low range for most cases.
And if not, you can always import or include the file
containing the declarations. I do not see people
screeming about imports in Java.

> > 2) The container should detect clashes by looking
> at all possible 
> > role registries
> > that may apply. This can be done quite
> efficiently.
> > 
> 
> Definitely a good thing - the container should bail
> on a clash.
>
Yes! 
> > 3) A clash resolution mechanism should be
> provided, posibly using 
> > aspects to
> > indicate the expected role to be used in a
> particular occurrance.
> 
> Its really up to the user (build file writer) to
> sort out the ambiguity.  There's not much Ant
> (configurer, aspect, or otherwise) can do except try
> to guess.
> 

OK, I may be using the term aspect wrongly. What I
meant was that the user could write something like
this to solve the conflict:

 <task1>
   <a/>
   <b ant:role="task" />
 </task1>

'ant:role' is not an attribute for the task, but for
the confgurator to know how to resolve the conflict.
I thought this is a use of aspect, the same way we
have discussed how to deal with failonerror (i.e.,
ant:failonerror="true").

Jose Alberto



__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> From: Jose Alberto Fernandez [mailto:j_a_fernandez@yahoo.com]
>
> > Take the following
> > 
> > <blah>
> >  <a/>
> >  <b/>
> > </blah>
> > 
> > Now lets assume it has two adds. The first run we we look up 
> Role1 for "a" 
> > and it is found and so we add the reult instance to adder 1. We 
> look up "b" 
> > in Role1 but it is not found, we do find it in ROle2 and thus 
> we add the 
> > instance to adder 2.
> > 
> > Now some outsider comes along and registers a new type of Role1 
> named "b" 
> > (which is easy to do by just dropping librarys in right place). 
> Now when user 
> > reruns tasks both "a" and "b" will be added to adder1.
> > 
> 
> Well, this is one reason I do not like auto-installation of 
> libraries. One should declare
> the libraries that one want to have available to the build. As 
> with java extensions
> when you allow auto-installation, the result is unpredictable behaviour.
> 
> As for clashes, there are several things that need to be done:
> 
> 1) Buildfiles should execute on a stable environment i.e., no auto-install
> but all libraries (appart from core) should be declared on the buildfile.
> 

This doesn't really solve the problem, just makes it less likely to happen.  Which just makes having to declare stuff an inconvenience.  The real solution is 2) and 3) below.

Perhaps a good compromise would be no auto-install and an <import-all/> task.

> 2) The container should detect clashes by looking at all possible 
> role registries
> that may apply. This can be done quite efficiently.
> 

Definitely a good thing - the container should bail on a clash.

> 3) A clash resolution mechanism should be provided, posibly using 
> aspects to
> indicate the expected role to be used in a particular occurrance.

Its really up to the user (build file writer) to sort out the ambiguity.  There's not much Ant (configurer, aspect, or otherwise) can do except try to guess.

Better to provide a simple way for the user to specify exactly what type they intend to be used.  That is, the user needs be able to specify for an element, both a role name, and a type name.  Perhaps by using a qualified name "role.type", or perhaps using a role attribute.  Providing a role name would be optional, provided the type name is unambiguous.


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Thu, 10 Jan 2002 18:22, Jose Alberto Fernandez wrote:
> > From: "Peter Donald" <pe...@apache.org>
> >
> > > On Wed, 9 Jan 2002 19:40, Jose Alberto Fernandez wrote:
> > The problem I have with this is that it allows a Task to violate all and
> > any rules. 
> 
> precisely. It is the "escape and do whatever you feel like" bit so that 
> people can do whatever they feel like doing and still run it inside ant with 
> out messing up the container for other tasks. 
> 
I think I am against unbound flexibility. I would argue that the job of the Configurer
(to give it a name) is to maintain a minimum set of rules of behaviour.
Once you start given away control in an unbound way there is no way back.
Remember, that part of the aim in ANT2 is to allow people to write and distribute
their own tasks. We cannot just say that we would tr to keep a lit on it.

> In many ways this is bad but because of the somewhat higher barrier of entry 
> it is expected that it will very rarily be used except when most needed. 
> 

Never disregard the ability of programmers to make use of every opportunity
for mischief ;-)

> >I think the container (via an enhanced Introspection) needs to
> > be the one in control here. By enhanced I mean that the work is not only
> > based on Class introspection, but the Task is allowed to say what is
> > willing to accept (what we have been talking about DynamicTask providing
> > their own introspector).
> 
> I await your fleshed out proposal. I haven't found anything that is both easy 
> and as flexible as the described approach.
> 

OK, I finally took a quick look at some of the interfaces of Myrmidon and
here is a more concrete proposal. So what I am saying is to allow Tasks
to provide their own ObjectConfigurer to use by the DefaultConfigurer.

Instead of passing the configuration to the object if the Task implements
Configurable, what you do is ask the Task to provide an ObjectConfigurer
if the Task defines DynamiclyConfigurable (for example):

    interface DynamiclyConfigurable {
        ObjectConfigurer getConfigurer();
    }

For what I see of the the definition of ObjectConfigurable is should be quite easy
for an object to define its own methods, and if we provide a few predefined helper
classes, the whole affair could be even more trivial.

> > My point above should solve the "flexibility" problem. I would like you to
> > explain why you think add(MyInterface) is not reliable. If it isn't then we
> > have a more fundamental problem here because if it is unreliable for Tasks
> > then it is unreliable for the other roles also.
> 
> Essentially add() fails because you can not have two adds in the same 
> element. The whole question of order is one aspect of this - but even if you 
> work this out then there is still a greater problem.
> 
> Take the following
> 
> <blah>
>  <a/>
>  <b/>
> </blah>
> 
> Now lets assume it has two adds. The first run we we look up Role1 for "a" 
> and it is found and so we add the reult instance to adder 1. We look up "b" 
> in Role1 but it is not found, we do find it in ROle2 and thus we add the 
> instance to adder 2.
> 
> Now some outsider comes along and registers a new type of Role1 named "b" 
> (which is easy to do by just dropping librarys in right place). Now when user 
> reruns tasks both "a" and "b" will be added to adder1.
> 

Well, this is one reason I do not like auto-installation of libraries. One should declare
the libraries that one want to have available to the build. As with java extensions
when you allow auto-installation, the result is unpredictable behaviour.

As for clashes, there are several things that need to be done:

1) Buildfiles should execute on a stable environment i.e., no auto-install
but all libraries (appart from core) should be declared on the buildfile.

2) The container should detect clashes by looking at all possible role registries
that may apply. This can be done quite efficiently.

3) A clash resolution mechanism should be provided, posibly using aspects to
indicate the expected role to be used in a particular occurrance.

> > > In any case TaskContainers need to be treated differently as no task can
> > > ever get access to another Task instance - they only operate on the
> > > TaskModel. (They pass the TaskModel to the container which executes the
> > > Task).
> >
> > I really do not think special treatment is necessary.
> 
> well you are in the minority - most of the proposals have that idea and it 
> was voted on ages ago IIRC :)
> 

We have voted for and against so many things that are now part of ANT that I do not think
the issue should be the vote but the technical merit of the approach. And then we can
vote again (the commiters I mean).

> >
> >     <role name="task" interface="org.apache.ant.Task"
> >              proxy="org.apache.ant.TaskModel"/>
> >
> > So now, for a method of the form add(org.apache.ant.TaskModel), we would
> > know is role "task", we would create an instance of the Task, and use it to
> > construct a TaskModel which will keep the model information and then call
> > add(taskModel).
> 
> Im not sure what the advantage of this. How is it any different to 
> 
> <role name="task" interface="org.apache.ant.TaskModel"/>
> 

The diference is that here you are indicating that all <task> should implement
TaskModel, which is wrong. <task> implement Task, but the container needs
to interpose a TaskModel between the two.

> > Now TaskModel needs to be loaded with the XML model, so it can configure
> > its task at the right time, but that can be accomplish by generic behaviour
> > on the introspector and not by something special to TaskModels. That means
> > that other roles or proxies can do the same.
> 
> In myrmidon the Configuration is the TaskModel 
> 

Well, what I am refering to is how the TaskModel captures the XML that defines it.
We are probably talking about quite similar thins here. The only difference may be
that for me TaskModel contains only the little piece of the XMLModel that corresponds
to a particular Task (to each add(TaskModel) operation) and not one object for the
entire Task being configured (which iswhat you do with Configurable).

I really do not thing Myrmidom is too far from what I am proposing.

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Thu, 10 Jan 2002 18:22, Jose Alberto Fernandez wrote:
> From: "Peter Donald" <pe...@apache.org>
>
> > On Wed, 9 Jan 2002 19:40, Jose Alberto Fernandez wrote:
> > > In any case, when I write a Task that can have elements that are tasks
> > > (TaskContainer) or one that can have mappers, there should be no
> > > difference from the task writer point of view on how to write its
> > > set/add methods. Of course it may be that for a TaskContainer the
> > > argument is not ot type Task, but some other thing like a TaskModel
> > > that you mention and I am not sure I understand. But the point is that
> > > whtever it is, it should be based on the same discovery mechanism that
> > > you describe for the other <roles>: "based on the "add" method
> > > signature, reverse map to a role and then search on the role's registry
> > > for an entry for the corresponding element".
> >
> > Well what I am saying there is essentially two ways to get extensibility.
> >
> > 1. The first way is to get passed the TaskModel and interpret it yourself
> > (probably using the services from the container).
>
> The problem I have with this is that it allows a Task to violate all and
> any rules. 

precisely. It is the "escape and do whatever you feel like" bit so that 
people can do whatever they feel like doing and still run it inside ant with 
out messing up the container for other tasks. 

In many ways this is bad but because of the somewhat higher barrier of entry 
it is expected that it will very rarily be used except when most needed. 

>I think the container (via an enhanced Introspection) needs to
> be the one in control here. By enhanced I mean that the work is not only
> based on Class introspection, but the Task is allowed to say what is
> willing to accept (what we have been talking about DynamicTask providing
> their own introspector).

I await your fleshed out proposal. I haven't found anything that is both easy 
and as flexible as the described approach.

> My point above should solve the "flexibility" problem. I would like you to
> explain why you think add(MyInterface) is not reliable. If it isn't then we
> have a more fundamental problem here because if it is unreliable for Tasks
> then it is unreliable for the other roles also.

Essentially add() fails because you can not have two adds in the same 
element. The whole question of order is one aspect of this - but even if you 
work this out then there is still a greater problem.

Take the following

<blah>
 <a/>
 <b/>
</blah>

Now lets assume it has two adds. The first run we we look up Role1 for "a" 
and it is found and so we add the reult instance to adder 1. We look up "b" 
in Role1 but it is not found, we do find it in ROle2 and thus we add the 
instance to adder 2.

Now some outsider comes along and registers a new type of Role1 named "b" 
(which is easy to do by just dropping librarys in right place). Now when user 
reruns tasks both "a" and "b" will be added to adder1.

> > In any case TaskContainers need to be treated differently as no task can
> > ever get access to another Task instance - they only operate on the
> > TaskModel. (They pass the TaskModel to the container which executes the
> > Task).
>
> I really do not think special treatment is necessary.

well you are in the minority - most of the proposals have that idea and it 
was voted on ages ago IIRC :)

> Or in other words
> whatever special thing you need to do for Tasks, may need to be done for
> some other <role> that we come-up with in the future. So I would say the
> solution is to generalize instead of specialcase it. So here is my
> generalization (based on Adam's excelent explanations).
>
> The way I see it, what is required is to be able to interpose an extra
> indirection between the interface of a <role> and the type of the
> parameter. In the case of Task, this is TaskModel. So in the taskdesc.xml
> we are looking at things as following these definitions:
>
>     <role name="task" interface="org.apache.ant.Task" />
>
>     <task name="echo" class="org.apache.ant.taskdefs.Echo" />
>
> With this declarations, we would have to hand the Task instance directly to
> the including task because of the way introspection works. Instead what you
> want to say is that there is an additional intermediary here:
>
>     <role name="task" interface="org.apache.ant.Task"
>              proxy="org.apache.ant.TaskModel"/>
>
> So now, for a method of the form add(org.apache.ant.TaskModel), we would
> know is role "task", we would create an instance of the Task, and use it to
> construct a TaskModel which will keep the model information and then call
> add(taskModel).

Im not sure what the advantage of this. How is it any different to 

<role name="task" interface="org.apache.ant.TaskModel"/>

> Now TaskModel needs to be loaded with the XML model, so it can configure
> its task at the right time, but that can be accomplish by generic behaviour
> on the introspector and not by something special to TaskModels. That means
> that other roles or proxies can do the same.

In myrmidon the Configuration is the TaskModel 

> Hope I am not completely off mark,

Not sure I follow. 

-- 
Cheers,

Pete

*--------------------------------*
| Every rule has an exception,   |
| except the rule of exceptions. |
*--------------------------------*


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Wed, 9 Jan 2002 19:40, Jose Alberto Fernandez wrote:
> > In any case, when I write a Task that can have elements that are tasks
> > (TaskContainer) or one that can have mappers, there should be no difference
> > from the task writer point of view on how to write its set/add methods. Of
> > course it may be that for a TaskContainer the argument is not ot type Task,
> > but some other thing like a TaskModel that you mention and I am not sure I
> > understand. But the point is that whtever it is, it should be based on the
> > same discovery mechanism that you describe for the other <roles>: "based on
> > the "add" method signature, reverse map to a role and then search on the
> > role's registry for an entry for the corresponding element".
> 
> Well what I am saying there is essentially two ways to get extensibility. 
> 
> 1. The first way is to get passed the TaskModel and interpret it yourself 
> (probably using the services from the container). 
> 

The problem I have with this is that it allows a Task to violate all and any rules.
I think the container (via an enhanced Introspection) needs to be the one in control here.
By enhanced I mean that the work is not only based on Class introspection, but
the Task is allowed to say what is willing to accept (what we have been talking about
DynamicTask providing their own introspector).

> 2. The second way is via the normal reflection process where an element is 
> allowed to have a generic
> 
> void add( SomeInterface myInstance );
> 
> which can be used to add arbitrary subclasses of the interface 
> "SomeInterface". 
> 
> (1) is needed because (2) does not allow enough flexability and there is no 
> reliable way to have multiple add( MyInterface ) methods in an element. If 
> you can think of a way to get rid of (1) then I am all ears but I think you 
> would be hard press to.
> 

My point above should solve the "flexibility" problem. I would like you to explain 
why you think add(MyInterface) is not reliable. If it isn't then we have a more
fundamental problem here because if it is unreliable for Tasks then it is unreliable
for the other roles also.

> In any case TaskContainers need to be treated differently as no task can ever 
> get access to another Task instance - they only operate on the TaskModel. 
> (They pass the TaskModel to the container which executes the Task).
> 

I really do not think special treatment is necessary. Or in other words whatever
special thing you need to do for Tasks, may need to be done for some other
<role> that we come-up with in the future. So I would say the solution is to
generalize instead of specialcase it. So here is my generalization (based on Adam's
excelent explanations).

The way I see it, what is required is to be able to interpose an extra indirection
between the interface of a <role> and the type of the parameter. In the case of
Task, this is TaskModel. So in the taskdesc.xml we are looking at things as
following these definitions:

    <role name="task" interface="org.apache.ant.Task" />

    <task name="echo" class="org.apache.ant.taskdefs.Echo" />

With this declarations, we would have to hand the Task instance directly to the including
task because of the way introspection works. Instead what you want to say is that there 
is an additional intermediary here:

    <role name="task" interface="org.apache.ant.Task" 
             proxy="org.apache.ant.TaskModel"/>

So now, for a method of the form add(org.apache.ant.TaskModel), we would know is
role "task", we would create an instance of the Task, and use it to construct a TaskModel
which will keep the model information and then call add(taskModel).

Now TaskModel needs to be loaded with the XML model, so it can configure its task
at the right time, but that can be accomplish by generic behaviour on the introspector
and not by something special to TaskModels. That means that other roles or proxies
can do the same. 

Hope I am not completely off mark,

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Wed, 9 Jan 2002 19:40, Jose Alberto Fernandez wrote:
> In any case, when I write a Task that can have elements that are tasks
> (TaskContainer) or one that can have mappers, there should be no difference
> from the task writer point of view on how to write its set/add methods. Of
> course it may be that for a TaskContainer the argument is not ot type Task,
> but some other thing like a TaskModel that you mention and I am not sure I
> understand. But the point is that whtever it is, it should be based on the
> same discovery mechanism that you describe for the other <roles>: "based on
> the "add" method signature, reverse map to a role and then search on the
> role's registry for an entry for the corresponding element".

Well what I am saying there is essentially two ways to get extensibility. 


1. The first way is to get passed the TaskModel and interpret it yourself 
(probably using the services from the container). 

2. The second way is via the normal reflection process where an element is 
allowed to have a generic

void add( SomeInterface myInstance );

which can be used to add arbitrary subclasses of the interface 
"SomeInterface". 

(1) is needed because (2) does not allow enough flexability and there is no 
reliable way to have multiple add( MyInterface ) methods in an element. If 
you can think of a way to get rid of (1) then I am all ears but I think you 
would be hard press to.

In any case TaskContainers need to be treated differently as no task can ever 
get access to another Task instance - they only operate on the TaskModel. 
(They pass the TaskModel to the container which executes the Task).




-- 
Cheers,

Pete

*--------------------------------------------------*
| Wise men don't need advice. Fools don't take it. |
|              -Benjamin Franklin                  |
*--------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Wed, 9 Jan 2002 22:58, Adam Murdoch wrote:
...snip...

good explanation - at least better than I gave ;)

> A good solution, certainly very flexible.  A few things I'd like to change:
>
> 1. Use reflection to deliver nested task placeholders, something like:
>
> public add(Configuration elem);

could you expand the reason for this more ?

> or
>
> public addX(Configuration elem);

+1

> 2. Get rid of Configurable.  Then, all parameters to a task or data type
> are delivered via introspection.

Sometimes top-level tasks need to have complete control over interpretation 
and I can't see an easy way of doing this in that model? 

Take for instance the TypeInstanceTask functionality (in myrmidon.framework). 
Conor -1'edn not having this sort of functionality and I can also see it 
being useful - especially with scripting tasks.

How would you address this ?

> 3. Maybe change the task placeholders from Configurable to some interface
> like the following:
>
> public interface Executable
> {
>     void execute( ExecutionFrame frame ) throws TaskException;
> }

Dont get you - can you explain ?

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> From: Jose Alberto Fernandez [mailto:j_a_fernandez@yahoo.com]
> 
> From: "Peter Donald" <pe...@apache.org>
> 
> > On Tue, 8 Jan 2002 09:20, Jose Alberto Fernandez wrote:
> > 
> > > This is fine. The only thing I would ask (and notice I have 
> not looked at
> > > your code) is whether you plan to use the same mechanism for
> > > TaskContainers. There is certaintly no reason whatsoever to have two
> > > different mechanisms for what it is exactly the same issue.
> > 
> > Theres no distinction between TaskContainers and other sorts of 
> containers. 
> > However I don't think that a similar mechanism will be used. In 
> the case of 
> > TaskContainers et all you are not dealing directly with tasks but with 
> > TaskModels - so in this case it would be much more beneficial 
> to have the 
> > "container" passed the TaskModel and it can interpret it as 
> appropriate. 
> > 
> > The mechanism described above is more orientated to adding a concrete 
> > implementation of a abstract type rather than adding and possibly 
> > implementing tasks according to specified rules and behaviour.
> > 
> > If you can think of a mechanism that would be easy to support 
> both use cases 
> > easily then I am all ears.
> > 
> 
> Once again you speek in riddles :-)
> Maybe I have to spend time on your code, or maybe you could give 
> us an intro
> to the design of myrdom(sp?), you have generated way too much code for me
> to have the time to digest it.
> 
> In any case, when I write a Task that can have elements that are 
> tasks (TaskContainer)
> or one that can have mappers, there should be no difference from 
> the task writer point of
> view on how to write its set/add methods. Of course it may be 
> that for a TaskContainer
> the argument is not ot type Task, but some other thing like a 
> TaskModel that you mention
> and I am not sure I understand. But the point is that whtever it 
> is, it should be based
> on the same discovery mechanism that you describe for the other <roles>:
> "based on the "add" method signature, reverse map to a role and 
> then search on the role's
> registry for an entry for the corresponding element".
> 

At risk of muddying the waters further, I'm going to try to answer this from what I know of myrmidon (but I may have it wrong).

This is a long-winded look at how task configuration works in myrmidon, and how it deals with the nested task problem.  And some sugestions for making it a little simpler.

In myrmidon, tasks are instantiated and configured just prior to the task being executed.  The parameters of the task are instantiated and configured as part of this.  This happens recursively, so that the parameters of the parameters are configured, and so on.

Configuration is done via introspection, but its a bit simpler than Ant 1's scheme:

For each attribute X, the object's setX() method is called.  The attribute value is converted from a string to the appropriate type (converters can be dynamically added).

For each nested element X:
  - the nested object is created using the parent object's createX() method (if present), or the no-args constructor of the datatype.
  - the nested object is configured recursively.
  - the nested object is added to the parent using the parent object's addX() method.

Text content is set by calling the object's addContent() method.

Now, this places a couple of conditions on every object, from the task recursively down through its children:

1. The object has to be configurable via the introspection scheme.  Now, the configurer is far from complete - there's things like type substitution and reference resolution to go in.  But it clearly isn't going to handle every possibility.


2. It has to be a valid time to configure the object, when the outermost task is configured.

A task can only be configured immediately before it is executed.  This means that nested tasks, as a general rule, cannot be configured at the same time that the outermost task is configured.  Instead, the nested task's configuration has to be deferred until it is just about to execute.

For example, <sequential> breaks this rule, because only the first nested task can be configured when the <sequential> task is configured.


Before looking at how myrmidon lets a task or data type get around these restrictions, it might be worth taking a step back and considering whether it should.

Take the first condition.  I haven't seen a convincing use case that the introspection scheme doesn't handle, once you add in type substitution.  Maybe it would be good to stick with this rule for Ant 2.

Ok, the second condition.  We definitely want to have nested tasks.  So we need to come up with:

- A way for the container to deliver to the task, a placeholder for each nested task.  The placeholder could be, for example, the nested task's configuration (this is, more or less, the TaskModel that Peter is speaking of), the task object  itself (unconfigured of course), or some opaque handle.

- A way for the task to hand the placeholder back to the container, and say "configure and execute this please".


Here's how myrmidon solves the problem:

Firstly, the task has to implement Configurable:

public interface Configurable
{
    void configure(Configuration configuration) throws ConfigurationException;
}

When the container goes to configure a task, it checks whether the task implements Configurable.  If so, the container calls configure() and passes the task its entire configuration.  It then becomes the task's responsibility to configure itself.  The container does not use the introspection scheme at all.

So the task configures itself however it sees fit.  There is a helper AbstractContainerTask that you can extend to do a lot of the work for you.  The task does not configure its nested tasks, but holds on to the Configuration object for them (the Configuration object is the placeholder, in this case).

When the task wants to configure and execute a nested task, it asks the container for an Executor (not strictly true, but it'll do for argument's sake).  Executor looks like this:

public interface Executor
{
    void execute( Configuration task, ExecutionFrame frame ) throws TaskException;
}

The task calls execute() and passes it the nested task's configuration.  The ExecutionFrame lets the task do all kinds of stuff, like controlling the properties available to the nested task, which logger it uses and so on.  The Executor configures and executes the task, and returns.


A good solution, certainly very flexible.  A few things I'd like to change:

1. Use reflection to deliver nested task placeholders, something like:

public add(Configuration elem);

or

public addX(Configuration elem);

2. Get rid of Configurable.  Then, all parameters to a task or data type are delivered via introspection.

3. Maybe change the task placeholders from Configurable to some interface like the following:

public interface Executable
{
    void execute( ExecutionFrame frame ) throws TaskException;
}


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Tue, 8 Jan 2002 09:20, Jose Alberto Fernandez wrote:
> 
> > This is fine. The only thing I would ask (and notice I have not looked at
> > your code) is whether you plan to use the same mechanism for
> > TaskContainers. There is certaintly no reason whatsoever to have two
> > different mechanisms for what it is exactly the same issue.
> 
> Theres no distinction between TaskContainers and other sorts of containers. 
> However I don't think that a similar mechanism will be used. In the case of 
> TaskContainers et all you are not dealing directly with tasks but with 
> TaskModels - so in this case it would be much more beneficial to have the 
> "container" passed the TaskModel and it can interpret it as appropriate. 
> 
> The mechanism described above is more orientated to adding a concrete 
> implementation of a abstract type rather than adding and possibly 
> implementing tasks according to specified rules and behaviour.
> 
> If you can think of a mechanism that would be easy to support both use cases 
> easily then I am all ears.
> 

Once again you speek in riddles :-)
Maybe I have to spend time on your code, or maybe you could give us an intro
to the design of myrdom(sp?), you have generated way too much code for me
to have the time to digest it.

In any case, when I write a Task that can have elements that are tasks (TaskContainer)
or one that can have mappers, there should be no difference from the task writer point of
view on how to write its set/add methods. Of course it may be that for a TaskContainer
the argument is not ot type Task, but some other thing like a TaskModel that you mention
and I am not sure I understand. But the point is that whtever it is, it should be based
on the same discovery mechanism that you describe for the other <roles>:
"based on the "add" method signature, reverse map to a role and then search on the role's
registry for an entry for the corresponding element".

JA



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Tue, 8 Jan 2002 09:20, Jose Alberto Fernandez wrote:
> There is still the issue on how to define which compiler to use (i.e., the
> current magic properties) and eventhough I do not fully like it, they are
> quite flexible since its value can be taken from a property file and do not
> require any hardcoding or manipulation of the build file itself. I am not
> sure how aspects will compete with this degree of flexibility.

> This is fine. The only thing I would ask (and notice I have not looked at
> your code) is whether you plan to use the same mechanism for
> TaskContainers. There is certaintly no reason whatsoever to have two
> different mechanisms for what it is exactly the same issue.

Theres no distinction between TaskContainers and other sorts of containers. 
However I don't think that a similar mechanism will be used. In the case of 
TaskContainers et all you are not dealing directly with tasks but with 
TaskModels - so in this case it would be much more beneficial to have the 
"container" passed the TaskModel and it can interpret it as appropriate. 

The mechanism described above is more orientated to adding a concrete 
implementation of a abstract type rather than adding and possibly 
implementing tasks according to specified rules and behaviour.

If you can think of a mechanism that would be easy to support both use cases 
easily then I am all ears.

> In particular, when compared with the implementation in ANT1.x it would
> remove the limitation that forbids TaskContainers from having inside
> elements other than Tasks. I would like to be able to for example specify a
> task container that defines also a <classpath> for some reason only God
> knows ;-).

Will be possible in Ant2 and it was actually one of the things I had 
considered (setting classPath ala gump style). If it is ever useful is 
another thing altogether ;) Still for other things like nested conditions in 
<if/> tasks or something it would be fairly useful ..

> For a long time I have wanted to come up with a better concept of
> scripting. To me, scripting shouldn't be use to maniputate the Project
> datastructure, but instead it should allow writing tasks just like we do in
> Java that can be called with different arguments in multiple places of the
> build. You know like a scripting language. This also means that the model
> of objects available for scripting has to change. It has to be a smaller
> set of APIs that we can give guarantees of stability. Very few entry
> points.
>
> The problems I had in ANT1 that blocked me on trying to do something are:
>
> 1) The fact that the Task registry contains Class instances as oppose to
> some Factory. With a factory interface one could register something that
> understands how to instantiate scripts, with just classes, there is no way
> out.
>
> 2) One needs access to the Introspector. Whatever class implements the
> Script object cannot be introspected to obtain the parameters of the
> script, instead Introspector needs to ask the instance to tell it what is
> available. How that is done, I do not care. It could be done by the Factory
> (not as good); or by asking the instance for the information either the
> instance saying what it supports or saying whether a particular element is
> supported. I like the instance saying what it supports, but I do not care
> too much.

I agree and thats something myrmidon plans on supporting.

> Humm, this looks a little like the Dynamic stuff we were talking. Although
> I guess you are king of inverting it. Not sure. I guess, if we allow the
> Task to provide ist own Introspector (with the help of some Container
> service) you could eliminate only allow such manipulations to be done on
> Tasks that specifically allow them, as oppose to a blank policy. (If I
> understood your concerns correctly).

Thats one concern however my major concern is about the flexability and ease 
of writing such tasks. The way it is currently now is both flexible and easy 
for developer (both of task and of container) while other methods have not 
proved to be IMHO.

-- 
Cheers,

Pete

The big mistake that men make is that when they turn thirteen or fourteen and
all of a sudden they've reached puberty, they believe that they like women.
Actually, you're just horny. It doesn't mean you like women any more at
twenty-one than you did at ten.                --Jules Feiffer (cartoonist)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> works for me. What license/community is this xdoclet under ?

http://xdoclet.sourceforge.net - Their documentation needs a bit of work,
but don't all open-source projects?!  :)

Click the License link - its not a standard one, but its in line with the
ASF I believe.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 16:04, Erik Hatcher wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> And here's how XDoclet could do some generation for you...
>
> > package org.apache.myrmidon.framework.condition;
>
> /**
>  * ant:role condition
>  */
>
> > public interface Condition
> > {
> >   boolean test( TaskContext context );
> > }
> >
> > You would then add a roles file like
>
> So the <roles> could be generated from XDoclet tags...
>
> > <roles>
> >   <role name="condition"
> > class="org.apache.myrmidon.framework.condition.Condition"/>
> > </roles>
> >
> > You would also need to add some implementations of the Condition
> > interface/role and add them to a type library. Via adding them to
>
> types.xml
>
> > file like
> >
> > <types>
> >   <!-- some task also stored in type library -->
> >   <task name="a-task" class="..."/>
> >
> >   <!-- note that name of element matches name of role as defined in
> > roles.xml-->
> >   <condition name="and"
>
> class="org.apache.myrmidon.framework.condition.And"/>
>
> >   <condition name="or"
>
> class="org.apache.myrmidon.framework.condition.Or"/>
>
> >   <condition name="not"
>
> class="org.apache.myrmidon.framework.condition.Not"/>
>
> > </types>
>
> And org.apache.myrmidon.framework.condition.Or.java would have something
> like:
>
> /**
>  * @ant:condition or
>  */
>
> (although I'd have to dig into XDoclet more to see if/how it deals with
> "dynamic" tags but I'm sure there is a way to accomplish what is desired).

kool.

> I'm assuming these XML descriptor files are "static" in that they are
> embedded into Ant2 at build time and referenced in this manner??

the XML files are built at the same time as the type library so yep.

> Is this at all looking viable?

works for me. What license/community is this xdoclet under ?

-- 
Cheers,

Pete

--------------------------------------------------
"An intellectual is someone who has been educated 
beyond their intelligence."
--------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Jose Alberto Fernandez wrote:

> From: "Peter Donald" <pe...@apache.org>
> 
> In particular, when compared with the implementation in ANT1.x it would remove the
> limitation that forbids TaskContainers from having inside elements other than Tasks.
> I would like to be able to for example specify a task container that defines also a
> <classpath> for some reason only God knows ;-).
> 

Jose Alberto,

Speaking about this Ant 1.x limitation, it may not be as big a problem 
as you may think, if you are able to structure your task a little 
differently. The idea would be to have two levels, the task itself which 
may have classpaths, and whatever nested elements you wish to support 
and then within that a nested container into which the desired tasks are 
added - something like

<mytask>
   <classpath .../>
   <myspecial element .../>
   <tasks>
      <echo ...>
      <javac ...>
   </tasks>
</mytask>

Then it is just a matter of coordinating things in the outer task.

So, not wishing to distract you from Ant 2.x thinking, but this may help 
you out in the here and now :-).

Conor


Conor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> On Mon, 7 Jan 2002 11:33, Jose Alberto Fernandez wrote:
> >
> > The examples I have are things like <ejb-jar> which need to support new
> > elements as new EJBcontainers are supported, and tasks like <condition>
> > that is suppose to allow more conditions being defined over time. The
> > curent requirement of modifying core tasks everytime a new thing is added
> > is totally unacceptable.
> 
> agreed. Theres a whole bunch of other types aswell (ie mappers) that have 
> similar limitations.
> 
> > A simmilar problem we are having with <javac>
> > everytime we add support for a new compiler.
> 
> javac/jsp/etc is a similar problem however not exactly the same and not 
> something I will address in myrmidon (at least not in the near future). There 
> will still be some ugly hardcoding in here but recently Adam suggested using 
> XML format to configure the underlying services such as
> 
> <javac ...>
>   <jikes warnings="full" .../>
> </javac>
> 

This to me is the correct way to deal with compiler specific issues. Rather than
having some uninterpreted argument passed to whatever is underneath, we should
have arguments specific to a particular compiler. In particular I would like to be
able to define buildfiles in which I can set different options for different
compilers and at the end the option used depends on the compiler at hand,
something like:

 <javac ...>
   <jikes warnings="full"  ifavailable="true" />
   <scj optimized="no"  ifavailable="true" />
 </javac>

The idea here being that you can write build files that work correctly no matter
what compiler the developer happens to be using. the 'ifavailable' is just a thought
we need to think better how one goes on indicating that it only should be used
if that is the compiler made available.

There is still the issue on how to define which compiler to use (i.e., the current
magic properties) and eventhough I do not fully like it, they are quite flexible
since its value can be taken from a property file and do not require any
hardcoding or manipulation of the build file itself. I am not sure how aspects
will compete with this degree of flexibility.

> However this is more radical than what I have been thinking about but it is 
> one possible solution. I have not really played with it to see whether it 
> works or not.
> 
> > I have not seen a good solution for this issues. Upto now we are stuck on
> > requiring changing the core tasks in order for the introspector to work.
> > That should not be needed.
> 
> It was explained the same time I explained the notion of types/roles which 
> you missed also ;) Basically it goes something like the following.
> [....]
> 
> You would 
> first look it up using the standard mechanisms (add/create/set/whatever) and 
> if that failed you would look for a single method like
> 
> void add( X x );
> 
> If X represents an interface - lets say Condition in this case - then it will 
> look up the role registry to find the shorthand role name for that particular 
> class. So in this case it will lookup org.apache.myrmidon.framework.Condition 
> and retrieve the "condition" shorthand name.
> 
> Then it will look up the "condition" TypeFactory (where all the "condition" 
> types are registered to via the types.xml). Then it will call createType() 
> (or whatever the method is called) on the factory, passing in the name of the 
> element (in our case "and"). The TypeFactory will then lookup its registry 
> and create appropriate type (org.apache.myrmidon.framework.And in our case).
> 
> And this And instance will be configured and passed into the task via the 
> add() method.
> 
> I think thats basically how it went though I have not reimplemented this in 
> the latest proposal and haven't looked at it for about a year but last time I 
> did it I liked it and found it satisfied almost all of my needs without being 
> too complex.
> 

This is fine. The only thing I would ask (and notice I have not looked at your code)
is whether you plan to use the same mechanism for TaskContainers. There is certaintly
no reason whatsoever to have two different mechanisms for what it is exactly the same issue.

In particular, when compared with the implementation in ANT1.x it would remove the
limitation that forbids TaskContainers from having inside elements other than Tasks.
I would like to be able to for example specify a task container that defines also a
<classpath> for some reason only God knows ;-).

> ants scripting capability needs a complete overhaul and could be good if done 
> right - however thta is a massive task and not something I am game to take on 
> just yet. A lot of this requires us refactoring common code into a framework 
> and then creating a nice facade + documenting a particular variety 
> (javascript being my preference atm).
> 

For a long time I have wanted to come up with a better concept of scripting.
To me, scripting shouldn't be use to maniputate the Project datastructure,
but instead it should allow writing tasks just like we do in Java that can be called
with different arguments in multiple places of the build. You know like a scripting
language. This also means that the model of objects available for scripting has to
change. It has to be a smaller set of APIs that we can give guarantees of stability.
Very few entry points.

The problems I had in ANT1 that blocked me on trying to do something are:

1) The fact that the Task registry contains Class instances as oppose to some
Factory. With a factory interface one could register something that understands
how to instantiate scripts, with just classes, there is no way out. 

2) One needs access to the Introspector. Whatever class implements the Script object
cannot be introspected to obtain the parameters of the script, instead Introspector
needs to ask the instance to tell it what is available. How that is done, I do not care.
It could be done by the Factory (not as good); or by asking the instance for the
information either the instance saying what it supports or saying whether a particular
element is supported. I like the instance saying what it supports, but I do not care too much.

> > > > Will Ant2 allow dynamically defined attributes/elements?  If so, by
> > > > what mechanism?
> > >
> [...]
> So the other possibility is that you pass the task it's own task model. It 
> can thus read the taskmodel/XML and then interpret it as appropriate. However 
> that can be hard to hack so we will provide some abstract class that makes it 
> simple to configure attributes/elements using the containers services. 
> Something like
> 
> setAttribute( anObject, "key", "myvalue" );
> addElement( anObject, myElement );
> execTask( myElement );
> 
> or whatever. These will be tuned to make things easy to write these sort of 
> tasks. 
> 
> Now you could abuse this functionality and dynamically set proeprties and 
> throw all sorts of type safety to the wind but it is not going to be 
> something I think we should encourage.
> 

Humm, this looks a little like the Dynamic stuff we were talking. Although I guess
you are king of inverting it. Not sure. I guess, if we allow the Task to provide
ist own Introspector (with the help of some Container service) you could
eliminate only allow such manipulations to be done on Tasks that specifically
allow them, as oppose to a blank policy. (If I understood your concerns
correctly).

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

And here's how XDoclet could do some generation for you...

> package org.apache.myrmidon.framework.condition;
>
/**
 * ant:role condition
 */
> public interface Condition
> {
>   boolean test( TaskContext context );
> }
>
> You would then add a roles file like

So the <roles> could be generated from XDoclet tags...

> <roles>
>   <role name="condition"
> class="org.apache.myrmidon.framework.condition.Condition"/>
> </roles>
>
> You would also need to add some implementations of the Condition
> interface/role and add them to a type library. Via adding them to
types.xml
> file like
>
> <types>
>   <!-- some task also stored in type library -->
>   <task name="a-task" class="..."/>
>
>   <!-- note that name of element matches name of role as defined in
> roles.xml-->
>   <condition name="and"
class="org.apache.myrmidon.framework.condition.And"/>
>   <condition name="or"
class="org.apache.myrmidon.framework.condition.Or"/>
>   <condition name="not"
class="org.apache.myrmidon.framework.condition.Not"/>
> </types>

And org.apache.myrmidon.framework.condition.Or.java would have something
like:

/**
 * @ant:condition or
 */

(although I'd have to dig into XDoclet more to see if/how it deals with
"dynamic" tags but I'm sure there is a way to accomplish what is desired).

I'm assuming these XML descriptor files are "static" in that they are
embedded into Ant2 at build time and referenced in this manner??

Is this at all looking viable?

    Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 11:33, Jose Alberto Fernandez wrote:
> From: "Peter Donald" <pe...@apache.org>
>
> > So far I haven't actually seen a good use for it. Can you give me a good
> > use case ? The only one provided is directly due to limitations in Ant1.x
> > model. When these limitations are removed there would be no need for
> > DynaTask. So besides the specified case have you got another example ?
>
> The examples I have are things like <ejb-jar> which need to support new
> elements as new EJBcontainers are supported, and tasks like <condition>
> that is suppose to allow more conditions being defined over time. The
> curent requirement of modifying core tasks everytime a new thing is added
> is totally unacceptable.

agreed. Theres a whole bunch of other types aswell (ie mappers) that have 
similar limitations.

> A simmilar problem we are having with <javac>
> everytime we add support for a new compiler.

javac/jsp/etc is a similar problem however not exactly the same and not 
something I will address in myrmidon (at least not in the near future). There 
will still be some ugly hardcoding in here but recently Adam suggested using 
XML format to configure the underlying services such as

<javac ...>
  <jikes warnings="full" .../>
</javac>

However this is more radical than what I have been thinking about but it is 
one possible solution. I have not really played with it to see whether it 
works or not.

> I have not seen a good solution for this issues. Upto now we are stuck on
> requiring changing the core tasks in order for the introspector to work.
> That should not be needed.

It was explained the same time I explained the notion of types/roles which 
you missed also ;) Basically it goes something like the following.

Myrmidon defines roles in a roles.xml file. Each role represents a grouping 
of types for a similar purpose. Roles are implemented using java interfaces. 
So lets say we have the role "Condition" defined by the following interface

package org.apache.myrmidon.framework.condition;

public interface Condition
{
  boolean test( TaskContext context );
}

You would then add a roles file like 

<roles>
  <role name="condition" 
class="org.apache.myrmidon.framework.condition.Condition"/>
</roles>

You would also need to add some implementations of the Condition 
interface/role and add them to a type library. Via adding them to types.xml 
file like

<types>
  <!-- some task also stored in type library -->
  <task name="a-task" class="..."/>

  <!-- note that name of element matches name of role as defined in 
roles.xml--> 
  <condition name="and" class="org.apache.myrmidon.framework.condition.And"/>
  <condition name="or" class="org.apache.myrmidon.framework.condition.Or"/>
  <condition name="not" class="org.apache.myrmidon.framework.condition.Not"/>
</types> 

Then during the configuration process you cam across element "and". You would 
first look it up using the standard mechanisms (add/create/set/whatever) and 
if that failed you would look for a single method like

void add( X x );

If X represents an interface - lets say Condition in this case - then it will 
look up the role registry to find the shorthand role name for that particular 
class. So in this case it will lookup org.apache.myrmidon.framework.Condition 
and retrieve the "condition" shorthand name.

Then it will look up the "condition" TypeFactory (where all the "condition" 
types are registered to via the types.xml). Then it will call createType() 
(or whatever the method is called) on the factory, passing in the name of the 
element (in our case "and"). The TypeFactory will then lookup its registry 
and create appropriate type (org.apache.myrmidon.framework.And in our case).

And this And instance will be configured and passed into the task via the 
add() method.

I think thats basically how it went though I have not reimplemented this in 
the latest proposal and haven't looked at it for about a year but last time I 
did it I liked it and found it satisfied almost all of my needs without being 
too complex.

> Another example is the fact that it is not possible to write a task using
> the scripting facilities that are curent in ANT. What I would like is
> scripted tasks that are at the same standing as compiled tasks. In
> particular in ANT2 I would like for scripts to have less access to the
> internal machinery of ANT but more ability to define tasks in the same
> standing as compiled tasks. The curent balance is completely wrong.

ants scripting capability needs a complete overhaul and could be good if done 
right - however thta is a massive task and not something I am game to take on 
just yet. A lot of this requires us refactoring common code into a framework 
and then creating a nice facade + documenting a particular variety 
(javascript being my preference atm).

> > > Will Ant2 allow dynamically defined attributes/elements?  If so, by
> > > what mechanism?
> >
> > Probably - the mechanism has not really been decided upon I don't think
> > but my preference was to pass the task model/task
> > configuration/hierarchial hashmap/whatever to the task and allow it to
> > configure itself (with help from the container if needed).
>
> Can you be more specific? This says very little. Some days ago someone
> talked about letting tasks provide their own introspection (the task itself
> decides what it wants to expose) is that what you are taling about? Is it
> something else?

Well how to best explain this. Hmmm .. the idea is related to the TaskModel / 
TaskProxy / TaskConfiguration concept. Where in ant1.x you build a tree of 
task objects as you parse the project in ant2 you will create a tree of task 
models or whatever that are basically representations of the XML describing 
the task. 

So when Ant2 goes to execute a task it will 
1. create a task with same name as top level element of task (by looking in 
type registry)
2. pass all the required services to task (TaskContext and friends)
3. configure task
4. maybe validate task
5. call execute()

So with stage 3 sometime you want/need to do tricky things - in particular 
when you are writing container tasks like <if/> and friends. Theres a few 
ways to do this. One is to make a number of magic tasks and establish a whole 
other set of patterns for the container tasks to implement and hope this 
works out properly. However this leads to far too much complexity IMHO and is 
not flexible for people who want to do really wierd stuff.

So the other possibility is that you pass the task it's own task model. It 
can thus read the taskmodel/XML and then interpret it as appropriate. However 
that can be hard to hack so we will provide some abstract class that makes it 
simple to configure attributes/elements using the containers services. 
Something like

setAttribute( anObject, "key", "myvalue" );
addElement( anObject, myElement );
execTask( myElement );

or whatever. These will be tuned to make things easy to write these sort of 
tasks. 

Now you could abuse this functionality and dynamically set proeprties and 
throw all sorts of type safety to the wind but it is not going to be 
something I think we should encourage.

-- 
Cheers,

Pete

*-------------------------------------*
| Does the name `Pavlov' ring a bell? |
*-------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Peter Donald" <pe...@apache.org>

> So far I haven't actually seen a good use for it. Can you give me a good use 
> case ? The only one provided is directly due to limitations in Ant1.x model. 
> When these limitations are removed there would be no need for DynaTask. So 
> besides the specified case have you got another example ?
> 

The examples I have are things like <ejb-jar> which need to support new elements
as new EJBcontainers are supported, and tasks like <condition> that is suppose to
allow more conditions being defined over time. The curent requirement of modifying
core tasks everytime a new thing is added is totally unacceptable. A simmilar
problem we are having with <javac> everytime we add support for a new compiler.

I have not seen a good solution for this issues. Upto now we are stuck on requiring
changing the core tasks in order for the introspector to work. That should not be
needed.

Another example is the fact that it is not possible to write a task using the scripting
facilities that are curent in ANT. What I would like is scripted tasks that are at
the same standing as compiled tasks. In particular in ANT2 I would like for scripts
to have less access to the internal machinery of ANT but more ability to define 
tasks in the same standing as compiled tasks. The curent balance is completely wrong.

> > Will Ant2 allow dynamically defined attributes/elements?  If so, by what
> > mechanism?
> 
> Probably - the mechanism has not really been decided upon I don't think but 
> my preference was to pass the task model/task configuration/hierarchial 
> hashmap/whatever to the task and allow it to configure itself (with help from 
> the container if needed).
> 

Can you be more specific? This says very little. Some days ago someone talked
about letting tasks provide their own introspection (the task itself decides what it
wants to expose) is that what you are taling about? Is it something else?

Jose Alberto



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> Most likely I would -1 it but it would depend upon how it was implemented
> essentially. I think it is really poor design of tasks that would require
> this and would almost certainly reject any task that used it ;)

I would implement it using the interface that I proposed, and that Jose
refined.  Simple as that, and probably would only involve a few lines of
code (at least it should :).

Would you -1 that implementation?  I just want to know before I code it and
get shot down!  :)

How does implementing this open the flood gates to bad things?

> That could be said of lots of things. Many people would not consider
mutable
> propertys a hack because it adds a lot of capability and only becomes
> apparent if someone actually uses it.
>
> Feel free to repeat this argument for any of the other similar features ;)

Fair enough!  :)

> So far I haven't actually seen a good use for it. Can you give me a good
use
> case ? The only one provided is directly due to limitations in Ant1.x
model.
> When these limitations are removed there would be no need for DynaTask. So
> besides the specified case have you got another example ?

The XDoclet use-case is the only use-case I have in mind now.

Keep in mind that I'm of the opinion that Ant probably should be using
XDoclet in the future to allow a lot of a tasks configuration to be
specified in meta-data allowing documentation to be generated as well as any
other artifacts needed (configurator Java classes perhaps?).

    Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 11:46, Conor MacNeill wrote:
> > From: Peter Donald [mailto:peter@apache.org]
> >
> > > Will Ant2 allow dynamically defined attributes/elements?  If so, by
> > > what mechanism?
> >
> > Probably - the mechanism has not really been decided upon I don't
> > think but
> > my preference was to pass the task model/task configuration/hierarchial
> > hashmap/whatever to the task and allow it to configure itself
> > (with help from
> > the container if needed).
>
> You have said previously, when I added dynamic configuration to Ant 1.x,
> that you did not support dynamic tasks.
>
> Have you changed your mind?

nope. It is just a undesirable side-effect  of allowing a task to access it's 
own Task Model. And the benefits of providing the task with it's own Task 
Model outweigh the negatives IMHO

-- 
Cheers,

Pete

"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> From: Peter Donald [mailto:peter@apache.org]
> > Will Ant2 allow dynamically defined attributes/elements?  If so, by what
> > mechanism?
> 
> Probably - the mechanism has not really been decided upon I don't 
> think but 
> my preference was to pass the task model/task configuration/hierarchial 
> hashmap/whatever to the task and allow it to configure itself 
> (with help from 
> the container if needed).

You have said previously, when I added dynamic configuration to Ant 1.x, that you did not support dynamic tasks. 

Have you changed your mind?

Conor
 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 05:26, Erik Hatcher wrote:
> From: "Peter Donald" <pe...@apache.org>
>
> > To me it seems like an ugly hack to get around limitations of ant1.x -
>
> while
>
> > it may be possible to implement this style funcitonality in Ant2 - I
> > don't think it will be done this way or even readily supported by
> > committers.
>
> So even though you consider it a hack for Ant1.x would adding this
> capability be rejected or allowed? 

Most likely I would -1 it but it would depend upon how it was implemented 
essentially. I think it is really poor design of tasks that would require 
this and would almost certainly reject any task that used it ;)

> (I wasn't sure which version of Ant you
> meant when you said it wouldn't be readily supported)

I was talking Ant2. It may be possible in it but I will do everything in my 
power to stop people from using it like that ;) The only reason such 
functionality is exposed is to allow complicated container tasks to be 
written (everything from <if/>, <try/> to more ugly things). 

> I don't personally consider it a 'hack' as it seems to add a lot of dynamic
> capability, but only if the task itself is asking for it (by implementing
> DynamicConfigurator).

That could be said of lots of things. Many people would not consider mutable 
propertys a hack because it adds a lot of capability and only becomes 
apparent if someone actually uses it.

Feel free to repeat this argument for any of the other similar features ;)

> This is one of the biggest peeves I have against JSP Taglibs.... all their
> attributes must be defined in a TLD file.  It makes some sense in that
> proper attributes are determined at page compilation time, but also
> restricts the flexibility of taglibs IMO.

So far I haven't actually seen a good use for it. Can you give me a good use 
case ? The only one provided is directly due to limitations in Ant1.x model. 
When these limitations are removed there would be no need for DynaTask. So 
besides the specified case have you got another example ?

> Will Ant2 allow dynamically defined attributes/elements?  If so, by what
> mechanism?

Probably - the mechanism has not really been decided upon I don't think but 
my preference was to pass the task model/task configuration/hierarchial 
hashmap/whatever to the task and allow it to configure itself (with help from 
the container if needed).


-- 
Cheers,

Pete

----------------------------------------
"Liberty means responsibility. That is 
      why most men dread it." - Locke
----------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
From: "Peter Donald" <pe...@apache.org>

> To me it seems like an ugly hack to get around limitations of ant1.x -
while
> it may be possible to implement this style funcitonality in Ant2 - I don't
> think it will be done this way or even readily supported by committers.

So even though you consider it a hack for Ant1.x would adding this
capability be rejected or allowed?  (I wasn't sure which version of Ant you
meant when you said it wouldn't be readily supported)

I don't personally consider it a 'hack' as it seems to add a lot of dynamic
capability, but only if the task itself is asking for it (by implementing
DynamicConfigurator).

This is one of the biggest peeves I have against JSP Taglibs.... all their
attributes must be defined in a TLD file.  It makes some sense in that
proper attributes are determined at page compilation time, but also
restricts the flexibility of taglibs IMO.

Will Ant2 allow dynamically defined attributes/elements?  If so, by what
mechanism?

Thanks,
    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Sun, 6 Jan 2002 23:53, Erik Hatcher wrote:
> I'm going back and forth with the XDoclet guy and have more details on what
> his goal is.  There is a task <templatedoclet> that contains a HashMap of
> configuration options that they currently populate this way:
>
>    <templatedoclet ....>
>       <config-param name="MyConfig" value="the value"/>
>
> But instead they'd like something like this:
>
>    <templatedoclet .... MyConfig="the value">
>
> And of course this isn't allowed because there is no getMyConfig in
> DocletTask.
>
> Without delving deep into IntrospectionHelper, I'd like to bounce off an
> idea and see how its taken.  Create an interface (named DynaTask? - I've
> been following commons-dev DynaBean discussions so can't think of anything
> more original) that has a method (setDynaAttribute?) with the signature
> setDynaAttribute(String name, String value).  If no setter is found in the
> current process of finding one, if the class implements the "dynamic"
> interface then the interfaces method is called.
>
> That won't break backwards compatibility (I don't think) and would provide
> the XDoclet team with some additional flexibility, and it seems generally
> useful for simplyfing this kind of dynamic configuration for tasks.
>
> Thoughts?

To me it seems like an ugly hack to get around limitations of ant1.x - while 
it may be possible to implement this style funcitonality in Ant2 - I don't 
think it will be done this way or even readily supported by committers.

-- 
Cheers,

Pete

The big mistake that men make is that when they turn thirteen or fourteen and
all of a sudden they've reached puberty, they believe that they like women.
Actually, you're just horny. It doesn't mean you like women any more at
twenty-one than you did at ten.                --Jules Feiffer (cartoonist)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Mon, 7 Jan 2002 00:55, Jose Alberto Fernandez wrote:
> This will allow writing tasks that have their own dynamic subset of valid
> elements, for example <ejb-jar> would not have to be modified every time
> a new EJB container is supported, but instead the new plug-in will be
> declared in some registry and the task will use createDynamicElement() to
> search for the correct plug-in element to instantiate.

This is implementable in a much cleaner fashion without the use of DynaTasks 
- effectively using DynaTask approach would force every task to deal with 
this rather than having it implemented once in the container.

-- 
Cheers,

Pete

---------------------------------------
Be nice to your friends. If it weren't 
for them, you'd be a complete stranger.
---------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Jose Alberto Fernandez <j_...@yahoo.com>.
From: "Erik Hatcher" <ja...@ehatchersolutions.com>

> Without delving deep into IntrospectionHelper, I'd like to bounce off an
> idea and see how its taken.  Create an interface (named DynaTask? - I've
> been following commons-dev DynaBean discussions so can't think of anything
> more original) that has a method (setDynaAttribute?) with the signature
> setDynaAttribute(String name, String value).  If no setter is found in the
> current process of finding one, if the class implements the "dynamic"
> interface then the interfaces method is called.
> 

This comment may be good or bad for the acceptance of what you are proposing
(given my record of success of the list ;-) ). I am all for something like this.

I would go a step further and also require your dynamic interface to manage
elements (as well as attributes). So the interface would be something like:

    interface DynamicConfigurator {
        void setDynamicAttribute(String name, String value);
        Object createDynamicElement(String name);
    }

This will allow writing tasks that have their own dynamic subset of valid
elements, for example <ejb-jar> would not have to be modified every time
a new EJB container is supported, but instead the new plug-in will be declared
in some registry and the task will use createDynamicElement() to search for the correct
plug-in element to instantiate.

The same is applicable to things like <conditional>, <mappers>, etc. 
And it would finally allow to define a real useful <script> like task
in which we can define real useful <ScriptTasks> that can be used
in multiple places with different parameters. 

To tell you the truth, the current <script> task is kind of useless in my opinion.

Hope my comments dont kill your idea ;-)

Jose Alberto




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
I'm going back and forth with the XDoclet guy and have more details on what
his goal is.  There is a task <templatedoclet> that contains a HashMap of
configuration options that they currently populate this way:

   <templatedoclet ....>
      <config-param name="MyConfig" value="the value"/>

But instead they'd like something like this:

   <templatedoclet .... MyConfig="the value">

And of course this isn't allowed because there is no getMyConfig in
DocletTask.

Without delving deep into IntrospectionHelper, I'd like to bounce off an
idea and see how its taken.  Create an interface (named DynaTask? - I've
been following commons-dev DynaBean discussions so can't think of anything
more original) that has a method (setDynaAttribute?) with the signature
setDynaAttribute(String name, String value).  If no setter is found in the
current process of finding one, if the class implements the "dynamic"
interface then the interfaces method is called.

That won't break backwards compatibility (I don't think) and would provide
the XDoclet team with some additional flexibility, and it seems generally
useful for simplyfing this kind of dynamic configuration for tasks.

Thoughts?

    Erik




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Adam Murdoch wrote:

> Either way, I think it would be a useful thing to allow a class (data type
> or task) to have programmatic control over its meta-info.  Whatever
> mechanism is used should ideally allow meta-info from all 3 sources to be
> mixed and matched as the task writer chooses.  The 3 "sources" would be:
>  - introspection
>  - the task descriptor (ie the javadoc comments or whatever)
>  - the class itself (programmatic).

> 

Adam,

Peter Donald knocked back allowing a task to have control over its 
nested elements quite a while ago.

http://www.mail-archive.com/ant-dev%40jakarta.apache.org/msg01590.html

Conor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Sun, 6 Jan 2002 21:19, Adam Murdoch wrote:
> > From: Peter Donald [mailto:peter@apache.org]
> >
> > On Sat, 5 Jan 2002 14:30, Adam Murdoch wrote:
> > > > The Ant 1 tree is not a good place to be experimenting.
> > >
> > > Just out if interest, where *is* a good place to be experimenting?
> >
> > Depends on what you want to experiment on mainly.
>
> Mostly stuff on the Ant1.9 list, in particular the VFS layer and the
> TypeInfo thing (well, the whole task/datatype lifecycle really, from
> writing, packaging, doc generation, deployment, instantiation,
> configuration, validation, service discovery, ..., to execution.  Task
> testing too).

ooer - definetly sounds great.

> > Alternatively you could help out me with myrmidon proposal. What
> > I am doing
> > with it is trying to bring it from a nice tech demo to a usable
> > system. You
> > are actually the only person who has shown any interest in
> > helping out with
> > the proposal so I haven't really been discussing intentions and
> > designs on
> > list.
>
> You should advertise it more. 

I tried that a year ago and it led to a flamefest - not everyone approves of 
it ;) and none of the other committers has ever openly supported me so I am 
reluctent to do that lest it gets termed Petes Ant again

> It's very impressive work.

thanks.

> Myrmidon would be an excellent place to try some of the stuff I want to do,
> particularly given that it's incremental stuff, rather than stand-alone. 
> Also, having the ant1 tasks there will be handy, to evaluate what impact
> the changes have on the task writer.

theres a few things that are lacking and need cleaning but hopefully when 
theres some more tasks in place, myrmidon can be cleaned up and all the kinks 
worked out.

> Right now I'm cranking away on a VFS proposal, so won't be making changes
> to Myrmidon any time soon.

excellent - looking forward to the VFS stuff. If you want to drop source into 
the proposals directory to show people what you are experimenting with feel 
free to send it along to the list.

> > Anyways if thats what you want to do then I can start actually discussing
> > what I am ding on the mailing list.
>
> I'm pretty keen to help out, so that would be handy - for me at least.

Okay I will start discussing things as I go along (and as I have time).

-- 
Cheers,

Pete

------------------------------------------------------------
 I just got lost in thought... It was unfamiliar territory.
------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> From: Peter Donald [mailto:peter@apache.org]
> 
> On Sat, 5 Jan 2002 14:30, Adam Murdoch wrote:
> > > The Ant 1 tree is not a good place to be experimenting.
> >
> > Just out if interest, where *is* a good place to be experimenting?
> 
> Depends on what you want to experiment on mainly. 
> 

Mostly stuff on the Ant1.9 list, in particular the VFS layer and the TypeInfo thing (well, the whole task/datatype lifecycle really, from writing, packaging, doc generation, deployment, instantiation, configuration, validation, service discovery, ..., to execution.  Task testing too).

> 
> Alternatively you could help out me with myrmidon proposal. What 
> I am doing 
> with it is trying to bring it from a nice tech demo to a usable 
> system. You 
> are actually the only person who has shown any interest in 
> helping out with 
> the proposal so I haven't really been discussing intentions and 
> designs on 
> list. 
> 

You should advertise it more.  It's very impressive work.

Myrmidon would be an excellent place to try some of the stuff I want to do, particularly given that it's incremental stuff, rather than stand-alone.  Also, having the ant1 tasks there will be handy, to evaluate what impact the changes have on the task writer.

Right now I'm cranking away on a VFS proposal, so won't be making changes to Myrmidon any time soon.

> Anyways if thats what you want to do then I can start actually discussing 
> what I am ding on the mailing list.

I'm pretty keen to help out, so that would be handy - for me at least.


Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IntrospectionHelper request

Posted by Peter Donald <pe...@apache.org>.
On Sat, 5 Jan 2002 14:30, Adam Murdoch wrote:
> > The Ant 1 tree is not a good place to be experimenting.
>
> Just out if interest, where *is* a good place to be experimenting?

Depends on what you want to experiment on mainly. If it is extra tasks then 
you can just experiment wherever you want and send updates to the list when 
appropriate. 

At other times it may be best to experiment with sets of tasks or new 
features (like VFS layers or whatever) in a new directory in the proposal/ 
directory.

If you want to experiment with Ant1.xs types/infrastructure and container 
then you have a lot less leway as it is a requirement for you to be backwards 
compatible. The easiest thing to do here would be to create completely new 
classes and deprecate the old ones. So you may add something like 
IntrospectionHelper2, ProjectHelper2 etc which are variations on original 
classes with whatever mods are required. This can get ugly to do in some 
circumstances.

However if you want to do massive changes or really far out stuff then it is 
best to just fork the whole codebase make the mods and then send results back 
to list. 

Alternatively you could help out me with myrmidon proposal. What I am doing 
with it is trying to bring it from a nice tech demo to a usable system. You 
are actually the only person who has shown any interest in helping out with 
the proposal so I haven't really been discussing intentions and designs on 
list. 

Most of the things I am doing are relatively conservative - with a few 
exceptions (like cross project dependencies and dynamically 
registerable/loadable types). Mainly I am going through and enabling things 
that people have been wanting since ants early days but where never feasible 
with old code base.

However if you want to experiment more radically or help out with converting 
tasks I would be ecstatic to let you help out with myrmidon. My short term 
aims are basically to get a small collection of the ant1 tasks converted into 
myrmidon. Basically at first it will only be the exec based tasks, some of 
the file tasks and a few other that are easier to implement.

In process of convertion I am removing all the things like
* failonerror
* settable log levels
etc

because they will all be dealt with universally in ant2 - either via 
container tasks (like try-catch-finally) or facilities/aspects (like adding a 
ant:fail-on-error="true" attribute to a task which is handled by container).

I am also trying to separate the code out into 3 blocks. There is container 
specific code, framework code (shared by all tasks) and the code for specific 
type library (not accessible via other type libraries).

Anyways if thats what you want to do then I can start actually discussing 
what I am ding on the mailing list.

-- 
Cheers,

Pete

--------------------------------------------
Sorry, I forgot to take my medication today.
--------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.

> The Ant 1 tree is not a good place to be experimenting.

Just out if interest, where *is* a good place to be experimenting?



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IntrospectionHelper request

Posted by Adam Murdoch <ad...@yahoo.com>.
Hi,

The Myrmidon patch I submitted last week did this, more or less.
Configuration was done via interfaces (there was even one called
AttributeSetter, as it turns out).  The piece that is missing (and this was
at the top of my "what-i-want-to-do-next" list) was some way for a class to
hand its custom introspector to the configurer.

The short-term plan was to simply use a static method, called something like
"getConfigurer()".  If present, the configurer would use whatever it
returned, if not present, the default introspector would be used.  The
longer-term plan was to grow the introspector stuff into the TaskInfo.

Either way, I think it would be a useful thing to allow a class (data type
or task) to have programmatic control over its meta-info.  Whatever
mechanism is used should ideally allow meta-info from all 3 sources to be
mixed and matched as the task writer chooses.  The 3 "sources" would be:
 - introspection
 - the task descriptor (ie the javadoc comments or whatever)
 - the class itself (programmatic).

Not so sure about doing this kind of stuff in the Ant 1 tree.  For one,
there's the whole backwards compatibility thing - all the introspection
stuff is public, and is, strictly speaking, part of the API.  Also, it would
be good to spend a while playing with this stuff, to do some prototyping and
get the concepts sorted out a little better (e.g. it may well be flexibility
syndrome).  The Ant 1 tree is not a good place to be experimenting.


Adam

> -----Original Message-----
> From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
> Sent: Saturday, 5 January 2002 10:56 AM
> To: ant-dev
> Subject: IntrospectionHelper request
>
>
> While inquiring about some issues I was having with my attempts to get
> XDoclet custom templates working (very cool, by the way!), I got this
> request for Ant:
>
> "Please make IntrospectionHelper an interface with a default/derivable
> impl. I want to extend it and add a new kind of introspection, but
> everything seems to be concrete and utility class. Specifically I want
> to create my own AttributeSetter and instead of invoking a setter method
> in the target task/element, set a config param value in a hashtable
> field of the target element, or in other words I want to add a more
> dynamic approach so the user can add config params without having to
> create a DocletTask-derived class and getter/setter there."
>
> I don't quite have the bandwidth or intimate know-how of
> IntrospectionHelper
> yet to give a good response.  Thoughts??
>
>     Erik
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>