ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Roles (was: antlib)
Date Fri, 02 May 2003 11:55:26 GMT
On Friday 02 May 2003 11:46, Wannheden, Knut wrote:
> Peter,
>
> > example:
> >     <typedef myfileset mypath anttest etc ..>
> >     <copy todir="output">
> >       <fileset ant-type="myfileset" dir="src"
> >                   newattribute="MyFileSet attribute"/>
> >     </copy>
> >
> >     <anttest>
> >       <path ant-type="mypath" path="build.xml"
> >                 newattribute="MyPath attribute"/>
> >     </anttest>
>
> I assume you meant to write "ant:type" instead of "ant-type"...

No...
Ant does not have the infrastructure at the moment to support XML
namespaces, and their associated contexts.

>
> I suppose in both examples all further attributes are for the target class.
> E.g. both attributes "dir" and "newattribute" are for <myfileset/>.

Yes, however myfileset has to extend the <copy/>'s <fileset/>
introspected class.

>  Or
> would the "dir" attribute be required for types of <copy/>'s <fileset/>
> role?
Yes,  as myfileset extends copies fileset elements's class it
inherites all the attributes and nested elements. It may however
override the implementation and throw a not supported exception for
specific attributes/nested elements.

for example:

    public static class MyFileSet
        extends FileSet
    {
        public void setNewAttribute(String value) {
            System.out.println("My fileset " + value);
        }
        public void setFollowSymlinks(boolean ignored) {
            throw new BuildException(
                "Symbolic links not supported");
        }
    }

Peter.

Mime
View raw message