ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: Embedded dynamic ANT tasks.
Date Mon, 09 Jun 2003 17:59:33 GMT
What I was thinking was on generalizing what we have on ComponentHelper.
Right now it keeps two tables, one for tasks and one for typedefs; instead
I would like to have a more generic setting, something like:

	boolean ComponentHelper.addComponentDefinition(Class realm, String typeName, Object typeDefinition)

Ok first the "realm" thing (just a big name to scare everyone), this will be just a key to
the kind
of storage service being requested: Task.class -- for TaskDefinitions; DataType.class -- Typesdefs;
and in the case of the script I would use ScriptDefBase.class for example.

This guy would do all the generic part of the manging definition of components living very
extra for the specialized calls:

	ComponentHelper.addTaskDefinition(String typeName, Class typeDefinition) {
		if (addComponentDefinition(Task.class, typeName, typeDefinition)) {
			// Previous definiton overriden
			// do any additional stuff that is needed (invalidate usages, etc.)

We may need some other method to declare the need for the table and to pass how to
detect redefinitions (this is now done in the code of each method)

	void ComponentHelper.addComponentRealm(Class realm, OverrideValidator validator);

where this validator thing will be passed to the AntTaskTable definition so that it 
knows how to do things (I am not too clear here because our current code is quite convoluted
due to all the backward compatibility).

In any case, I think you can get what I mean, for ScriptDef the usage is like:

	String source = ....;
name, source);

You will need something like:

	Object ComponentHelper.getComponentDefinition(Class realm, String typeName);

which will be used by ComponentHelper.createComponent(String typeName) in the current code.
Also here,
we may be able to get something better.

Jose Alberto

> -----Original Message-----
> From: Conor MacNeill []
> Sent: 09 June 2003 15:40
> To: Ant Developers List
> Subject: Re: Embedded dynamic ANT tasks.
> On Mon, 9 Jun 2003 08:42 pm, Jose Alberto Fernandez wrote:
> > You could do the following, which will require no changes to code:
> >
> Funnily enough, this approach is pretty close to what I was 
> working on for 
> <scriptdef>. It doesn't use DynamicConfigurator, however, as 
> that doesn't 
> really allow for deferred creation of nested elements.
> > The only problem with this solution is that the 
> implementation needs to
> > provide its own symbol-table which may be problematic when 
> using <import/>
> > and <ant/>. It would be nicer if ANT were willing to manage 
> this kind of
> > use symbol-table as some sort of generic service.
> <ant/>, <import/> may indeed be problems. I'm not sure yet - 
> I want to see how 
> that works out and do some more testing. What sort of generic 
> service do you 
> have in mind?
> Conor
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message