ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
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 [mailto:jeroenb@x-hive.com] 
Sent: Wednesday, December 04, 2002 10:37 AM
To: ant-user@jakarta.apache.org
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"/>
      </fileset>
    </path>
    <taskdef loaderref="xhive"
resource="com/xhive/anttasks/tasks.properties"
classpathref="basic.path"/>
    <typedef loaderref="xhive"
resource="com/xhive/anttasks/type.properties"
classpathref="basic.path"/>
    <federation id="test.federation" bootstrap="${bootstrap}"
password="${superuserpassword}"/>
    <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>

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

Thanks,

Jeroen Breedveld

--

X-Hive Corporation
e-mail: jeroenb@x-hive.com
phone: +31 10 7108622
http://www.x-hive.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message