ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Re: Tasks, DataTypes and Factories
Date Wed, 06 Mar 2002 20:58:54 GMT
On Thu, 7 Mar 2002, Peter Donald wrote:

> > 2. Allow the use of optional namespaces in tasks. We already have
> > too many tasks in the default namespace, some grouping would
> > improve the readability and maintainability. Of course, all
> >  existing tasks will continue to work without namespaces.
> > This require a new method in Project: createComponent() that
> > will take a namespace and a tag name.
> No need for a separate namespace parameter in interface. Just pass in 
> "namespace:name" as the name and have the factory decode it if it wants. It 
> is not like this code is performance intensive and if it was there is plenty 
> of other places that should be dealt with first.

'Namespace' is a URI, and passing it mangled and unmangling it is ugly.
The idea is to improve it, not to hack it.  It's not about performance,
but about interfaces - and almost all applications that deal with xml
are now able to support namespaces ( except ant ).

BTW, a 'namespace' is not an XML thing - it's a way to group 
tasks ( same as a package name in java, etc ). Having a flat 
naming for tasks doesn't scale very well. 

> > 4. Make task/datatyle creation and behavior more consistent
> > with each other. They should use similar code for creation,
> > adapters ( for 'external' beans not implementing ant interfaces).
> As long as only classes extending Task/DataType/ProjectComponent are returned 
> from factory then all should be good. Well ... unless you do anything tricky 
> with classloader in which case you will need to mod the rest of code base 
> anyways ;)

Yes, the factory should return a ProjectComponent - be it a Task or 
DataType. It may return an adapter - i.e. TaskAdapter, or a DataType

Regarding classloader - there is no need to modify anything else in ant.
You can plug in a TaskFactory that implements/uses whatever class loader
and policy it wants - no other piece of ant cares about this as long
as it is consistent. 

Of course, the default ProjectCompoenentHelper will use the current
loader policy, but I hope Antlib will be reimplemented as a regular
task that plugs itself in.

> Also 
> * hasRole() should be hasProjectComponent() ?
> * createProjectComponent() should return a ProjectComponent ?
> BTW just as a note that this is the same mechanism I have been using in 
> Myrmidon for a while now (Though I called it TypeFactory). It was also the 
> method via which I made it possible for users to write tasks as templates or 
> scripts etc. So when I upload this stuff next week sometime it may be a good 
> idea to prototype that stuff to make sure it is doable under your proposal 
> (though I can't see why it shouldn't be depending on how you register the 
> factorys).

It would be very good to have myrmidon and mutant factories wrapped and 
usable with ant1.5 - and I think making this work is essential, so
if there's anything missing let me know.


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

View raw message