Thayer,

You may want to pull the latest cvs and take a look at the latest ejbjar
task.  There have been some extensive changes to it as of late.

john

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 12, 2000 4:47 PM
To: [EMAIL PROTECTED]
Subject: Weblogic 5.1 task (ejbc alternative)


I have a task that generates EJBs for Weblogic 5.1 that I'd like to make
available. This task was already under development when what became ejbjar
was posted. Since we designed it to meet our own needs, we ended up with
some functionality not currently available in ejbjar:

        1. The value of the build.compiler property from the build file is
passed to weblogic.ejbc, allowing us to use jikes. I believe the ejbjar
task is still using the default compiler.

        2. All .xml files in the same directory as the descriptor are
added to the bean jar. This is important to us because we need to include
toplink descriptors in some of our bean jars. Currently, the ejbjar task
looks for descriptors by name and so won't pick up anything besides
ejb-jar.xml, weblogic-ejb-jar.xml, and weblogic-cmp-rdbms-jar.xml.

        3. The interface is simpler and has some additional attributes
(debug, deprecation, warnings). Here's an example:

    <ejbc
            srcdir="${src.dir}"
            destdir="${build.dir}"
            classpath="${compile.classpath}"
            debug="on"
            deprecation="on"
            warnings="no"
        />

I fully expect some or all of these additional "features" will be
incorporated into ejbjar before long. Meanwhile, here is an option for
those who need these features now.

Thayer Robins
Rocket Network

--------- 
package com.rocket.tools.ant;

import java.util.Map;
import java.util.jar.*;
import java.util.*;
import java.io.*;
import javax.xml.parsers.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.xml.sax.*;
import org.w3c.dom.*;

/**
 * <p>Provides an Ant task that automates the creation of one or more
 * deployable bean jars for Weblogic 5.1. This task extends the Ant
 * Task class and is compliant with Ant 1.1.</p>
 *
 * <p>The task begins by recursively searching srcdir for all files
 * named ejb-jar.xml, which is the deployment descriptor specified in
 * the EJB 1.1 specification. Each file found is parsed, and a map is
 * created containing information about each bean identified in the
 * descriptor. This map is then used to create a list of the fully
 * qualified names of all files named in the descriptor. Primary key
 * class files are included only if the fully qualified name does not
 * begin with "java." (in other words, only if the bean uses a custom
 * primary key class).</p>
 *
 * <p>Before proceeding to create a bean jar, the task verifies that
 * generation (or regeneration) is necessary. If a previously created
 * bean jar exists in destdir, the jar's modified date is checked
 * against the descriptor file and the bean(s) source files. The final
 * bean jar is named by taking the fully qualified name of the first
 * bean referenced in the descriptor and appending ".jar". (Periods
 * are used as a separator when naming the jar, so a bean named
 * com.ejb.test would result in a jar named com.ejb.test.jar.) The
 * source files are found by looking in srcdir for the ".java"
 * versions of the files in the above- described list. If a jar
 * exists and is up to date, the task continues by parsing the next
 * descriptor.</p>
 *
 * <p>Once it is determined that generation is necessary, the next
 * step is to create an intermediate jar file containing the bean
 * files and all necessary descriptors. The bean class files are found
 * by looking in destdir for the ".class" versions of files in the
 * file list. The descriptors are located by searching the directory
 * containing the descriptor currently being processed for all files
 * that end with ".xml". Each such file is copied into a META-INF
 * directory in the temporary directory. The Ant Jar task is then used
 * to create the intermediate jar, and this jar is passed to the
 * Weblogic ejbc compiler, along with any options specified in the
 * build file. Once the final jar is created, the temporary directory,
 * which includes the intermediate jar, is deleted.</p>
 *
 * <p>The task is descriptor-driven. Creation of a bean jar is
 * attempted for every ejb-jar.xml file found in srcdir. Multiple
 * bean jars can be created from the same package provided that each
 * jar has it's own set of descriptors and these descriptors are
 * grouped together in their own directory. Since the files named in
 * ejb-jar.xml are fully qualified, it doesn't matter where that
 * directory is, as long as it falls under srcdir.</p>
 *
 * <p>The task provides the following attributes:
 * <pre>   srcdir (mandatory): directory containing descriptor files
 *             and packages that include bean source files; source
 *             files are used to determine whether bean needs to be
 *             regenerated
 *         destdir (mandatory): directory containing compiled class
 *             files and into which and final jar will be created
 *         classpath (optional): classpath used to run Weblogic ejbc
 *             compiler
 *         deprecation (optional): option passed to Weblogic ejbc
 *             compiler
 *         debug (optional): option passed to Weblogic ejbc compiler
 *         warnings (optional): option passed to Weblogic ejbc
 *             compiler
 * </pre>
 * @author <a href="mailto:[EMAIL PROTECTED]">Thayer Robins</a>
 */
public class ejbc extends Task
{
    /**
     * File type constant representing ordinary file.
     */
    private static final int FILE = 1;

    /**
     * File type constant representing directory.
     */
    private static final int DIRECTORY = 2;

    /**
     * File type constant representing jar file.
     */
    private static final int JAR = 3;

    /**
     * Filename of the xml deployment descriptor.
     */
    private static final String DESCRIPTOR_FILENAME = "ejb-jar.xml";

    /**
     * Prefix to name of directory in which generated files are placed.
     */
    private static final String TEMPORARY_DIR_PREFIX = "tmp-";

    /**
     * Prefix to filename of the temporary jar passed to the ejbc compiler.
     */
    private static final String EJBC_JAR_PREFIX = "ejb-";

    /**
     * Compiler to use for all compilations.
     */
    private String compiler;



//ejbc task attributes

    /**
     * Directory containing .class files and into which final bean
     * jars will be compiled. Also used as temporary location for
     * all files and directories created by this task.
     */
    private File destinationDirectory;

    /**
     * The source directory for the home and remote interfaces and
     * all supporting classes. Must also contain all necessary
     * deployment descriptors.
     */
    private File sourceDirectory;

    /**
     * Classpath used to run Weblogic's ejbc compiler.
     */
    private String classpath;

    /**
     * ejbc option.
     */
    private boolean debug = false;

    /**
     * ejbc option.
     */
    private boolean deprecation = false;

    /**
     * ejbc option
     */
     private boolean warnings = false;


    /**
     * Entrance point for task. Regenerates a Weblogic jar for each
     * deployment descriptor in source directory. Build is canceled
     * if jar is up to date with respect to the source files.
     *
     * @exception BuildException if something goes wrong with the build
     */
    public void execute() throws BuildException
    {
        //Validate attributes provided in .xml build file
        validateAttributes();

        //Use compiler specified in build file for all compilations
        compiler = project.getProperty("build.compiler");
        if (compiler == null)
        {
            if (Project.getJavaVersion().startsWith("1.3"))
                compiler = "modern";
            else compiler = "classic";
        }

        //Build is descriptor driven, so find those descriptors
        String[] includes = { "**/" + DESCRIPTOR_FILENAME };
        File[] descriptorList = getFiles(sourceDirectory, includes);

        //Must have at least one descriptor to continue
        if (descriptorList.length == 0)
        {
            String msg = "No " + DESCRIPTOR_FILENAME + " file found.";
            throw new BuildException(msg);
        }

        //Create one jar for each descriptor
        for (int i=0; i < descriptorList.length; i++)
        {

            //Get class and interface names from deployment descriptor
            Map mapBeans = getInfoFromDescriptor(descriptorList[i]);

            //Get fully qualified names of files identified in
            // descriptor
            String[] filenameList = getBeanClassNames(mapBeans);

            //Use name of at least one bean in descriptor to name
            // directory and jars created here
            String beanName = getBeanName(mapBeans);
            File destinationJar =
                new File(destinationDirectory, beanName + ".jar");

            //Is descriptor file or any source file newer than
            // generated classes? If so, regenerate.
            if ( isBuildRequired(filenameList, descriptorList[i],
                    destinationJar) )
            {
                project.log("Generating " + destinationJar.getPath()
                    + " ...", Project.MSG_VERBOSE);
                regenerate(filenameList, descriptorList[i], beanName,
                        destinationJar);
            }
            else
            {
                project.log(destinationJar.getPath()
                    + " is up to date", Project.MSG_VERBOSE);
            }

            //ALWAYS delete files that are part of the JAR from
            // the filesystem
            removeFiles(filenameList);

        }//end for
    }


    /**
     * Validate attributes provided for this task in .xml build file.
     *
     * @exception BuildException if any supplied attribute is invalid
     * or any mandatory attribute is missing
     */
    protected void validateAttributes() throws BuildException
    {
        //Make sure mandatory arguments were supplied
        String msg = null;
        if (sourceDirectory == null)
            msg = "The \'src\' attribute is required.";
        else if (destinationDirectory == null)
            msg = "The \'dest\' attribute is required.";

        if (msg != null) throw new BuildException(msg);

        //Validate
        validateFile(sourceDirectory, "source directory", DIRECTORY);
        validateFile(destinationDirectory, "destination directory",
            DIRECTORY);
     }


    /**
     * Get list of files in source tree matching strings in includes
     * array.
     *
     * @baseDir directory to search
     *
     * @includes patterns to search for. If null, all files are
     * included.
     */
    protected File[] getFiles(File baseDir, String[] includes)
    {
        DirectoryScanner ds = new DirectoryScanner();
        ds.setBasedir(baseDir);
        ds.setIncludes(includes);
        ds.scan();

        String[] filenames = ds.getIncludedFiles();
        int numFiles = filenames.length;

        File[] fileList = new File[numFiles];
        for (int i=0; i < numFiles; i++)
        {
            //Filenames returned by getIncludedFiles() are relative
            // to base directory
            fileList[i] = new File(baseDir, filenames[i]);
        }

        return fileList;
    }


    /**
     * Validate that a given file, jar, or directory exists and is in
     * fact what it purports to be. If the item does not exist or is
     * not what it is supposed to be, a build exception is thrown.
     *
     * @param file the directory to be validated
     *
     * @param usage indicates the file type
     *
     * @param type constant indicating whether the file object is
     * supposed to be a directory, jar, or plain old file
     *
     * @throws BuildException if the given directory is not valid.
     */
    protected void validateFile(File file, String usage, int type)
        throws BuildException
    {
        if (!file.exists())
        {
            String msg = "The " + usage + " " + file.getPath()
                + " does not exist.";
            throw new BuildException(msg);
        }

        switch(type)
        {
            case FILE:
                if (!file.isFile())
                {
                    String msg = "The " + usage + " file "
                            + file.getPath() + " is not a file.";
                    throw new BuildException(msg);
                }
                break;

            case DIRECTORY:
                if (!file.isDirectory())
                {
                    String msg = "The " + usage + " directory "
                            + file.getPath() + " is not a directory.";
                    throw new BuildException(msg);
                }
                break;

            case JAR:
                if ( !file.isFile() ||
                     !file.getPath().endsWith(".jar") )
                {
                    String msg = "The " + usage + " file "
                            + file.getPath() + " is not a jar file.";
                    throw new BuildException(msg);
                }
                break;
        }//end switch
     }


    /**
     * Create complex data structure containing class names for all
     * beans found in xml deployment descriptor. Map returned has the
     * following structure: key = bean name (String), value = Map
     * containing names of bean classes and interfaces. Inner Map
     * contains: key = xml tag (String), value = fully-qualified
     * class/interface name (String).
     *
     * @param descriptor the xml deployment descriptor
     *
     * @return Map containing class and interface names for all beans
     * in descriptor
     *
     * @throws BuildException if the descriptor file is invalid
     */
     protected Map getInfoFromDescriptor(File descriptor)
        throws BuildException
     {
        boolean beanFound = false;
        Map mapBeans = new HashMap(8);
        Element root;

        try
        {
            DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
            Document doc =
                factory.newDocumentBuilder().parse(descriptor);
            root = doc.getDocumentElement();
        }
        catch (IOException e)
        {
            String msg = "Can't open build file "
                    + descriptor.getName() + ": " + e.toString();
            throw new BuildException(msg);
        }
        catch (SAXException se)
        {
            String msg = "Can't open build file "
                    + descriptor.getName() + ": " + se.toString();
            throw new BuildException(msg);
        }
        catch (ParserConfigurationException pce)
        {
            String msg = "Parser cannot be built: "
                + pce.toString();
            throw new BuildException(msg);
        }

        //Make sure we have a proper xml descriptor
        if (!root.getTagName().equals("ejb-jar"))
        {
            String msg = "Descriptor file is not ejb-jar.xml.";
            throw new BuildException(msg);
        }

        NodeList list = root.getElementsByTagName("enterprise-beans");
        NodeList beanList = ((Element)list.item(0)).getChildNodes();

        for(int i=0; i < beanList.getLength(); i++)
        {
          if( ((Node)beanList.item(i)).getNodeName().equals("entity")
              || ((Node)beanList.item(i)).getNodeName().equals("session")
            )
          {
            beanFound = true;
            String beanName = "dummy";
            Map mapBeanData = new HashMap(8);
            Node beanNode = (Node)beanList.item(i);
            NodeList beanTags = beanNode.getChildNodes();

            for(int j=0; j < beanTags.getLength(); j++)
            {
              Node tagNode = (Node)beanTags.item(j);

              try
              {
                if( tagNode.getNodeName().equals("ejb-name") )
                    beanName = tagNode.getFirstChild().getNodeValue();
                else if(tagNode.getNodeName().equals("home"))
                    mapBeanData.put("home",
                        tagNode.getFirstChild().getNodeValue());
                else if(tagNode.getNodeName().equals("remote"))
                    mapBeanData.put("remote",
                        tagNode.getFirstChild().getNodeValue());
                else if(tagNode.getNodeName().equals("ejb-class"))
                    mapBeanData.put("ejb-class",
                        tagNode.getFirstChild().getNodeValue());
                else if(tagNode.getNodeName().equals("prim-key-class"))
                    mapBeanData.put("prim-key-class",
                        tagNode.getFirstChild().getNodeValue());
              }
              catch(NullPointerException e)
              {
                String msg = "Required tag in ejb-jar.xml may "
                    + "be empty: " + e.toString();
                throw new BuildException(msg);
              }
            }//end for

            //Bean name is key; value is map containing class names
            mapBeans.put(beanName, mapBeanData);

          }//end if entity or session tag
        }//end for (iterating through beanList)

        if (!beanFound)
        {
            String msg = descriptor.getPath() +
                    " does not contain entity or session tag.";
            throw new BuildException(msg);
        }

        return mapBeans;
    }


    /**
     * Extract fully qualified names of all classes and interfaces
     * identified in collection.
     *
     * @param mapBeans the Map containing information about the bean
     *
     * @return String[] containing class and interface names
     */
    protected String[] getBeanClassNames(Map mapBeans)
    {
        List filenamesList = new ArrayList(8);

        Iterator it = mapBeans.keySet().iterator();
        while (it.hasNext())
        {
            String beanName = (String)it.next();
            Map mapBeanData = (Map)mapBeans.get(beanName);
            Iterator itBean = mapBeanData.keySet().iterator();
            while (itBean.hasNext())
            {
                String tagName = (String)itBean.next();
                String tagValue = (String)mapBeanData.get(tagName);

                if (tagName.equals("home") || tagName.equals("remote")
                     || tagName.equals("ejb-class"))
                {
                    filenamesList.add(tagValue);
                }
                else if (tagName.equals("prim-key-class"))
                {
                    //prim-key-class could be a java wrapper or
                    // String class
                    if ( !(tagValue.startsWith("java.")) )
                        filenamesList.add(tagValue);
                }

            }//end while (itBean.hasNext())
        }//end while (it.hasNext() && !buildRequired)

        //Convert arguments to string array
        String[] array = new String[filenamesList.size()];
        filenamesList.toArray(array);

        return array;
    }


    /**
     * Get fully qualified name of first bean identified in collection.
     *
     * @param mapBeans the Map containing information about the bean
     *
     * @return String containing dot-separated name of bean package
     */
    protected String getBeanName(Map mapBeans)
    {
        String fullName = null;
        Iterator it = mapBeans.values().iterator();
        if (it.hasNext())
        {
            fullName = (String) ((Map)it.next()).get("remote");
            int pos = fullName.lastIndexOf('.');
            fullName = fullName.substring(0, pos);
        }
        else
        {
            String msg = "Something wrong in getBeanName().";
            throw new BuildException(msg);
        }

        return fullName;
    }


    /**
     * Determine if the Weblogic EJB support classes need to be
     * regenerated for a given deployment descriptor. Returns true
     * if no Weblogic jar is found, or if at least one source file
     * or the descriptor file is found to be more recent than the
     * existing jar.
     *
     * @param filenameList the fully qualified class and interface
     * names
     *
     * @param descriptor the descriptor file that was parsed to get
     * information about the bean
     *
     * @param destinationJar the deployable bean jar
     *
     * @return true if the support classes need to be regenerated
     *
     * @throws BuildException
     */
    protected boolean isBuildRequired(String[] filenameList,
                                      File descriptor,
                                      File destinationJar)
        throws BuildException
    {
        if (!destinationJar.exists()) return true;

        //Use time existing destination jar was created
        long existingJarTime = destinationJar.lastModified();

        //Require build if descriptor has been changed
        if (descriptor.lastModified() > existingJarTime) return true;

        //Are any source files newer?  If so, require build.
        boolean buildRequired = false;
        char cSeparator = File.separatorChar;

        for (int i=0; i < filenameList.length; i++)
        {
            String filename = filenameList[i].replace('.', cSeparator)
                + ".java";
            File sourceFile = new File(sourceDirectory, filename);
            validateFile(sourceFile, "source file", FILE);
            if (sourceFile.lastModified() > existingJarTime)
            {
                buildRequired = true;
                break;
            }
        }

        return buildRequired;
    }


    /**
     * Create Weblogic 5.1-compliant ejb jar from source files.
     *
     * @param fileList the list of fully qualified classes and
     * interfaces comprising bean
     *
     * @param beanName the package name of a bean in fileList
     *
     * @param destinationJar the deployable jar to generate
     * (or regenerate)
     *
     * @exception BuildException
     */
    protected void regenerate(String[] filenameList, File descriptor,
                              String beanName, File destinationJar)
        throws BuildException
    {
        //--Step 1: put everything that will be jarred into temporary
        //  directory
        File tempDir = new File(destinationDirectory,
                TEMPORARY_DIR_PREFIX + beanName);

        if ( !tempDir.mkdir() )
        {
            String msg = "Unable to create directory "
                + tempDir.getPath();
            throw new BuildException(msg);
        }

        //--Step 2: create jar that will be passed to weblogic ejbc
        //  compiler
        project.log("Creating intermediate jar in directory "
                + tempDir.getPath(), Project.MSG_VERBOSE);
        File intermediateJar = createIntermediateJar(filenameList,
                descriptor.getParentFile(), tempDir, beanName);

        //--Step 3: run weblogic ejbc compiler
        project.log("Running ejbc to create " 
                + destinationJar.getPath(), Project.MSG_VERBOSE);
        regenerateSupportClasses(intermediateJar, destinationJar);

        //--Step 4: delete temporary directory and its contents
        removeDirectory(tempDir);
    }

    /**
     * Delete directory; recursively empty directory first if
     * necessary.
     *
     * @param directory the directory to be emptied and deleted
     */
    protected void removeDirectory(File directory)
    {
        File[] fileList = directory.listFiles();

        for (int i=0; i < fileList.length; i++)
        {
            if (fileList[i].isDirectory())
                removeDirectory(fileList[i]);
            else fileList[i].delete();
        }

        directory.delete();
    }

    /**
     * Delete files that correspond to compiled classes
     *
     * @param files a list of fully qualified classnames
     */
    protected void removeFiles(String[] files) {
        for(int i=0;i<files.length;i++)
        {
          String fileName = files[i].replace('.', File.separatorChar);
          File f = new File(destinationDirectory, fileName + ".class");
          f.delete();
        }
    }


    /**
     * Create jar that will be passed to Weblogic ejbc compiler.
     *
     * @param filenameList the fully qualified names of bean
     * interfaces and implementation class
     *
     * @param descriptorSourceDir the directory containing all
     * descriptor files for this jar
     *
     * @param tempDir the directory used to create jar
     *
     * @throws BuildException
     */
    protected File createIntermediateJar(String[] filenameList,
                                         File descriptorSourceDir,
                                         File tempDir, String beanName)
        throws BuildException
    {
        //Copy class files
        for (int i=0; i < filenameList.length; i++)
        {
            String classFile =
                filenameList[i].replace('.', File.separatorChar)
                    + ".class";
            File fromFile = new File(destinationDirectory, classFile);
            File toFile = new File(tempDir, classFile);

            try
            {
                project.copyFile(fromFile, toFile);
            }
            catch(IOException e)
            {
                String msg = "Can't copy file " + fromFile.getPath()
                        + " to " + toFile.getPath() + ": "
                        + e.toString();
                throw new BuildException(msg);
            }
        }

        //Create descriptor directory
        File descriptorDir = new File(tempDir, "META-INF");
        if ( !descriptorDir.mkdir() )
        {
            String msg = "Unable to create directory "
                + descriptorDir.getPath();
            throw new BuildException(msg);
        }

        //Copy xml descriptors
        String[] includes = {"**/*.xml"};
        File[] xmlFiles = getFiles(descriptorSourceDir, includes);

        for (int i=0; i < xmlFiles.length; i++)
        {
            try
            {
                File toFile =
                    new File(descriptorDir, xmlFiles[i].getName());
                project.copyFile(xmlFiles[i], toFile);
            }
            catch(IOException e)
            {
                String msg = "Can't copy file " + xmlFiles[i].getPath()
                        + " to " + descriptorDir.getPath() + ":"
                        + e.toString();
                throw new BuildException(msg);
            }
        }

        File jarfile = new File(tempDir,
                EJBC_JAR_PREFIX + beanName + ".jar");

        //Place created jar in generated files directory
        org.apache.tools.ant.taskdefs.Jar jarTask = null;

        try
        {
            jarTask = (Jar) project.createTask("jar");
            jarTask.setJarfile(jarfile.getPath());
            jarTask.setBasedir(tempDir.getPath());

            jarTask.execute();
        }
        catch(Exception e)
        {
            String msg =
                "Exception occurred creating intermediate jar: "
                + e.toString();
            throw new BuildException(msg);
        }

        return jarfile;
    }


    /**
     * Create Weblogic jar.
     *
     * @param sourceJar the jar file containing bean classes and
     * descriptors
     *
     * @param destinationJar the deployable bean jar to be generated
     *
     * @throws BuildException passes on any exception thrown by Weblogic
     * compiler
     */
    protected void regenerateSupportClasses(File sourceJar,
                                            File destinationJar)
        throws BuildException
    {
        String args = getEjbcArguments(sourceJar, destinationJar);
        String classpath = getEjbcClasspath();

        //Print arguments to log
        project.log("Calling weblogic.ejbc with args: -classpath "
                + classpath + " " + args, Project.MSG_VERBOSE);

        org.apache.tools.ant.taskdefs.Java javaTask = null;

        try
        {
            javaTask = (Java) project.createTask("java");
            javaTask.setClassname("weblogic.ejbc");
            javaTask.setArgs(args);
            javaTask.setFork("true");

            if (classpath != null)
                javaTask.createClasspath().setPath(classpath);

            javaTask.execute();
        }
        catch(Exception e)
        {
            String msg = "Exception occurred calling weblogic.ejbc: "
                    + e.toString();
            throw new BuildException(msg);
        }
    }


    /**
     * Create string containing arguments for Weblogic compiler.
     *
     * @return String consisting of space-delimited arguments
     */
    protected String getEjbcArguments(File sourceJar,
                                      File destinationJar)
    {
        StringBuffer args = new StringBuffer();

        args.append(" -compiler ");
        args.append(compiler);

        if (debug && !compiler.equals("jikes"))
            args.append(" -debug");
        if (deprecation) args.append(" -deprecation");
        if (!warnings) args.append(" -nowarn");

        args.append(" ");
        args.append(sourceJar.getPath());
        args.append(" ");
        args.append(destinationJar.getPath());

        return args.toString();
    }


    /**
     * Calculate classpath for jvm that runs Weblogic compiler.
     *
     * @return String representing classpath
     */
    protected String getEjbcClasspath()
    {
        StringBuffer classpath =
            new StringBuffer(destinationDirectory.getPath());
        if (this.classpath != null)
        {
            classpath.append(File.pathSeparatorChar);
            classpath.append(this.classpath);
        }

        classpath.append(File.pathSeparatorChar);
        classpath.append(System.getProperty("java.class.path"));

        return classpath.toString();
    }


    /**
     * Set directory containing class files and into which bean
     * jars, with generated skeletons and stubs, will be placed.
     *
     * @param destination the path of the directory containing
     * compiled bean files and into which generated bean jars are
     * placed
     */
    public void setDestdir(String destination) {
        this.destinationDirectory = project.resolveFile(destination);
    }

    /**
     * Set the directory containing the source code for the bean
     * interfaces, implementation class, and deployment descriptors.
     *
     * @param source the directory containg the source tree for the
     * EJB's classes and descriptors
     */
    public void setSrcdir(String source) {
        sourceDirectory = project.resolveFile(source);
    }

    /**
     * Set classpath used to run Weblogic's ejbc compiler.
     *
     * @param classpath the colon-delimited classpath
     */
    public void setClasspath(String classpath) {
        this.classpath = project.translatePath(classpath);
    }

    /**
     * Set ejbc -debug option.
     *
     * @param debug
     */
    public void setDebug(String debug) {
        this.debug = Project.toBoolean(debug);
    }

    /**
     * Set ejbc -deprecation option.
     *
     * @param deprecation
     */
    public void setDeprecation(String deprecation) {
        this.deprecation = Project.toBoolean(deprecation);
    }

    /**
     * Set ejbc -nowarn option
     *
     * @param warnings
     */
    public void setWarnings(String warnings) {
        this.warnings = Project.toBoolean(warnings);
    }
}

Reply via email to