Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs.optional.ejb
Class EjbJar

    java.lang.Object
      |
      +--org.apache.tools.ant.Task
            |
            +--org.apache.tools.ant.taskdefs.MatchingTask
                  |
                  +--org.apache.tools.ant.taskdefs.optional.ejb.EjbJar

public class EjbJar
extends MatchingTask

Provides automated ejb jar file creation for ant. Extends the MatchingTask class provided in the default ant distribution to provide a directory scanning EJB jarfile generator.

The task works by taking the deployment descriptors one at a time and parsing them to locate the names of the classes which should be placed in the jar. The classnames are translated to java.io.Files by replacing periods with File.separatorChar and resolving the generated filename as a relative path under the srcDir attribute. All necessary files are then assembled into a jarfile. One jarfile is constructed for each deployment descriptor found.

Functionality is currently provided for standard EJB1.1 jars and Weblogic 5.1 jars. The weblogic deployment descriptors, used in constructing the Weblogic jar, are located based on a simple naming convention. The name of the standard deployment descriptor is taken upto the first instance of a String, specified by the attribute baseNameTerminator, and then the regular Weblogic descriptor name is appended. For example if baseNameTerminator is set to '-', its default value, and a standard descriptor is called Foo-ejb-jar.xml then the files Foo-weblogic-ejb-jar.xml and Foo-weblogic-cmp-rdbms-jar.xml will be looked for, and if found, included in the jarfile.

Attributes and setter methods are provided to support optional generation of Weblogic5.1 jars, optional deletion of generic jar files, setting alternate values for baseNameTerminator, and setting the strings to append to the names of the generated jarfiles.

Author:
  Tim Fennell

Inner Class Summary
`static class` | `EjbJar.DTDLocation`

Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`fileset, useDefaultExcludes`

Fields inherited from class org.apache.tools.ant.Task
`description, location, project, target, taskName, taskType, wrapper`

Constructor Summary
`EjbJar()`

Method Summary
`Path` | `createClasspath()` creates a nested classpath element.
`EjbJar.DTDLocation` | `createDTD()` Create a DTD location record.
`FileSet` | `createSupport()` Create a file set for support elements
`WeblogicDeploymentTool` | `createWeblogic()` Create a weblogic nested element used to configure a deployment tool for Weblogic server.
`WeblogicTOPLinkDeploymentTool` | `createWeblogictoplink()` Create a nested element for weblogic when using the Toplink Object- Relational mapping.
`void` | `execute()` Invoked by Ant after the task is prepared, when it is ready to execute this task.
`void` | `setBasejarname(java.lang.String inValue)` Set the base name of the EJB jar that is to be created if it is not to be determined from the name of the deployment descriptor files.
`void` | `setBasenameterminator(java.lang.String inValue)` Set the baseNameTerminator.
`void` | `setClasspath(Path classpath)` Set the classpath to use when resolving classes for inclusion in the jar.
`void` | `setDescriptordir(java.io.File inDir)` Set the descriptor directory.
`void` | `setDestdir(java.io.File inDir)` Set the destination directory.
`void` | `setFlatdestdir(boolean inValue)` Set the flat dest dir flag.
`void` | `setGenericjarsuffix(java.lang.String inString)` Set the suffix for the generated jar file.
`void` | `setSrcdir(java.io.File inDir)` Set the srcdir attribute.

Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`createExclude, createInclude, createPatternSet, getDirectoryScanner, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EjbJar

    public EjbJar()

Method Detail

### createWeblogic

    public WeblogicDeploymentTool createWeblogic()

  Create a weblogic nested element used to configure a deployment tool for Weblogic server.
  Returns:
    the deployment tool instance to be configured.

### createWeblogictoplink

    public WeblogicTOPLinkDeploymentTool createWeblogictoplink()

  Create a nested element for weblogic when using the Toplink Object- Relational mapping.
  Returns:
    the deployment tool instance to be configured.

### createClasspath

    public Path createClasspath()

  creates a nested classpath element. This classpath is used to locate the super classes and interfaces of the classes that will make up the EJB jar.
  Returns:
    the path to be configured.

### createDTD

    public EjbJar.DTDLocation createDTD()

  Create a DTD location record. This stores the location of a DTD. The DTD is identified by its public Id. The location may either be a file location or a resource location.

### createSupport

    public FileSet createSupport()

  Create a file set for support elements
  Returns:
    a fileset which can be populated with support files.

### setSrcdir

    public void setSrcdir(java.io.File inDir)

  Set the srcdir attribute. The source directory is the directory that contains the classes that will be added to the EJB jar. Typically this will include the home and remote interfaces and the bean class.
  Parameters:
    `inDir` - the source directory.

### setDescriptordir

    public void setDescriptordir(java.io.File inDir)

  Set the descriptor directory. The descriptor directory contains the EJB deployment descriptors. These are XML files that declare the properties of a bean in a particular deployment scenario. Such properties include, for example, the transactional nature of the bean and the security access control to the bean's methods.
  Parameters:
    `inDir` - the directory containing the deployment descriptors.

### setBasejarname

    public void setBasejarname(java.lang.String inValue)

  Set the base name of the EJB jar that is to be created if it is not to be determined from the name of the deployment descriptor files.
  Parameters:
    `inValue` - the basename that will be used when writing the jar file containing the EJB

### setDestdir

    public void setDestdir(java.io.File inDir)

  Set the destination directory. The EJB jar files will be written into this directory. The jar files that exist in this directory are also used when determining if the contents of the jar file have changed. Note that this parameter is only used if no deployment tools are specified. Typically each deployment tool will specify its own destination directory.
  Parameters:
    `inFile` - the destination directory.

### setClasspath

    public void setClasspath(Path classpath)

  Set the classpath to use when resolving classes for inclusion in the jar.
  Parameters:
    `classpath` - the classpath to use.

### setFlatdestdir

    public void setFlatdestdir(boolean inValue)

  Set the flat dest dir flag. This flag controls whether the destination jars are written out in the destination directory with the same hierarchal structure from which the deployment descriptors have been read. If this is set to true the generated EJB jars are written into the root of the destination directory, otherwise they are written out in the same relative position as the deployment descriptors in the descriptor directory.
  Parameters:
    `inValue` - the new value of the flatdestdir flag.

### setGenericjarsuffix

    public void setGenericjarsuffix(java.lang.String inString)

  Set the suffix for the generated jar file. When generic jars are generated, they have a suffix which is appended to the the bean name to create the name of the jar file. Note that this suffix includes the extension fo te jar file and should therefore end with an appropriate extension such as .jar or .ear
  Parameters:
    `inString` - the string to use as the suffix.

### setBasenameterminator

    public void setBasenameterminator(java.lang.String inValue)

  Set the baseNameTerminator. The basename terminator is the string which terminates the bean name. The convention used by this task is that bean descriptors are named as the BeanName with some suffix. The baseNameTerminator string separates the bean name and the suffix and is used to determine the bean name.
  Parameters:
    `inValue` - a string which marks the end of the basename.

### execute

    public void execute()
                 throws BuildException

  Invoked by Ant after the task is prepared, when it is ready to execute this task. This will configure all of the nested deployment tools to allow them to process the jar. If no deployment tools have been configured a generic tool is created to handle the jar. A parser is configured and then each descriptor found is passed to all the deployment tool elements for processing.
  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - thrown whenever a problem is encountered that cannot be recovered from, to signal to ant that a major problem occurred within this task.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 Apache Software Foundation. All Rights Reserved.