ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Descriptor Format
Date Sun, 03 Jun 2001 04:08:02 GMT
Hi,

I think we are closer to defining the format for descriptor file. The
problem is that we have an open set of components that each descriptor file
must be able to describe. For isntance we currently have settled on at
least the following types being stored in jars;
* Mappers
* Tasks
* DataTypes (and sub-classes like FileSet/FTPFileSet/ZipFileSet).
* Aspects
* Listeners
* Converters

We need some way to be able to register all these different types.
Excluding converter for the moment, all of them have similar attributes
that need to be placed in TypeRegistry (ie Type + name + className).

A pattern that originated with Cocoon2 (which has similar requirements) is
to have two types of data in XML. The first type looks like

<type name="task" interface="org.apache.ant.api.Task"/>
<type name="data-type" interface="org.apache.ant.api.DataType"/>
<type name="mapper" interface="org.apache.ant.framework.Mapper"/>

It maps a short-hand name to a Type/Role name. The second type looks like

<task name="javac" class="org.apache.ant.tasks.jdk.Javac"/>
<task name="java" class="org.apache.ant.tasks.jdk.Java"/>

<data-type name="classpath" class="org.apache.ant.tasks.jdk.Classpath"/>
<data-type name="fileset" class="org.apache.ant.tasks.file.FileSet"/>
<data-type name="zip-fileset" class="org.apache.ant.tasks.file.ZipFileSet"/>

<mapper name="glob" class="org.apache.ant.framework.mappers.GlobMapper"/>

and this maps name to classes that match a certain role. ie The following
two representations are basically equivelent

<mapper name="glob" class="org.apache.ant.framework.mappers.GlobMapper"/>

<item  name="glob"
       interface="org.apache.ant.framework.Mapper"
       class="org.apache.ant.framework.mappers.GlobMapper"/>

but the first is easier to read.

I propose that the descriptor format looks like -

<task name="javac" class="org.apache.ant.tasks.jdk.Javac"/>
<task name="java" class="org.apache.ant.tasks.jdk.Java"/>

<data-type name="classpath" class="org.apache.ant.tasks.jdk.Classpath"/>
<data-type name="fileset" class="org.apache.ant.tasks.file.FileSet"/>
<data-type name="zip-fileset" class="org.apache.ant.tasks.file.ZipFileSet"/>

<mapper name="glob" class="org.apache.ant.framework.mappers.GlobMapper"/>

It is easy to read and write and expressive enough for most concerns. If we
ever across a need for parameterized types (which I am not sure we will) we
can always change format to look like

<mapper name="glob" class="org.apache.ant.framework.mappers.GlobMapper">
  <parameter name="foo" value="bar" />
</mapper>

However I am not sure we will ever need this.

The first set of information

<type name="task" interface="org.apache.ant.api.Task"/>
<type name="data-type" interface="org.apache.ant.api.DataType"/>
<type name="mapper" interface="org.apache.ant.framework.Mapper"/>

will be stored in regular jars that are sucked into base ClassLoader. The
reason is that the interfaces have to come from common jars that all tasks
have access to and it seems good to keep information about interface in one
place.

So I essentially propose 2 descriptors. One stored with antlibs and one
stored with archive that defines the interfaces used by antlibs.
(Converters will be handled separately - more on that later). Thoughts?

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message