ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Problem with typedefs
Date Wed, 04 Dec 2002 16:51:21 GMT
The only DataType I ever created extended Path, so all the magic already
worked regarding Ids. From the looks of Path, it seems you need to override
DataType#setRefid() to make sure refid is the only used attribute of the
data type, and if it is, transfer the state of the referened Object to this
object (or delegate to the referenced object). Looks also like you should
use DataType#getCheckedRef() to access the reference, or code like in Path:

Object o = r.getReferencedObject(getProject());
// we only support references to paths right now
if (!(o instanceof Path)) {
  String msg = r.getRefId() + " doesn\'t denote a path";
  throw new BuildException(msg);

I'm assuming you added the add/createDatabase methods to your classes.

I hope this helps. I'm CC'ing Ant-dev to get advice from the experts. --DD

-----Original Message-----
From: Jeroen Breedveld [] 
Sent: Wednesday, December 04, 2002 10:37 AM
Subject: Problem with typedefs

Hi all, 

I created a custom type database and now I want to use the refid
attribute to reference a database I have declared in my init task.
However whenever I use it in a task I get a nullpointerexception because
for example the bootstrap parameter is null. What am I doing wrong? Do I
have to take special action for the refid attribute in my Database class
or does setRefid() from the superclass take care of all the action?   

  <target name="init">
    <path id="basic.path">
      <fileset dir="${xhive.dir}/build/lib">
        <include name="xhive.jar"/>
        <include name="dom3_intermediate.jar"/>
    <taskdef loaderref="xhive"
    <typedef loaderref="xhive"
    <federation id="test.federation" bootstrap="${bootstrap}"
    <database id="test.database" bootstrap="${bootstrap}"
name="${database}" user="${user}" password="${password}"/>
    <database id="test.database2" bootstrap="${bootstrap}"
name="${database2}" user="${user}" password="${password}"/>

  <target name="test-createlibrary" depends="init">
    <createlibrary name="testLib">
      <database refid="test.database"/>


Jeroen Breedveld


X-Hive Corporation
phone: +31 10 7108622

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

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

View raw message