ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Watkins <robert.watk...@qsipayments.com>
Subject [Patch] EjbJar task does not use the dtd locations for generic EJ Bs
Date Wed, 14 Mar 2001 01:37:15 GMT
A problem I stumbled over today is that the EjbJar task in Ant 1.3 does not
use the <dtd> information passed when it is doing a generic EJB. It uses it
correctly when building a WebLogic EJB. This struck me as somewhat of a bug.
I don't know if you're aware of it or not, but the current nightly build
(1.4alpha, 13 March) also exhibits the problem.

The target definition I'm using looks like this:

  <target name="build-ejb-jars" depends="init">
    <mkdir dir="${EJB_DIR}" />
    <ejbjar descriptordir="${DESCRIPTOR_DIR}"
            srcdir="${SRC_CLASSES}"
            destdir="${EJB_DIR}"
            classpath="${SRC_CLASSES};${J2EE_JAR}">
      <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
1.1//EN" 
           location="${DESCRIPTOR_DIR}/dtd/ejb-jar_1_1.dtd" />
      <include name="**/*-ejb-jar.xml" />
      <exclude name="**/*weblogic*.xml" />
    </ejbjar>
  </target>

The fault is that GenericDeploymentTool never registers the DTDs in the
created DescriptorHandler. In the WeblogicDeploymentTool, this is done in
the getDescriptorHandler() method.

Here's the patch I did to GenericDeploymentTool to allow the DTD locations
to be specified for generic EJBs. It replaces the getDescriptorHandler()
method in GenericDeploymentTool:

    protected DescriptorHandler getDescriptorHandler(File srcDir) {
    	DescriptorHandler handler = new DescriptorHandler(srcDir);
        for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();)
{
            EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation)i.next();
            handler.registerDTD(dtdLocation.getPublicId(),
dtdLocation.getLocation());
        }
        return handler;
    }


Hope you can put this to good use.

Robert.

-- 
     "Duct tape is like the Force: it has a light side, a dark side,
                   and it holds the universe together"
  Robert Watkins     robertdw@bigpond.net.au     robertw@qsipayments.com

Mime
View raw message