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

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

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

All Implemented Interfaces:
  SelectorContainer

public class EjbJar
extends MatchingTask

Provides automated EJB JAR file creation.

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.

Nested Class Summary
`static class` | `EjbJar.CMPVersion` CMP versions supported valid CMP versions are 1.0 and 2.0
`static class` | `EjbJar.DTDLocation` Inner class used to record information about the location of a local DTD
`static class` | `EjbJar.NamingScheme` An EnumeratedAttribute class for handling different EJB jar naming schemes

Field Summary

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

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

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`EjbJar()`

Method Summary
`protected void` | `addDeploymentTool(EJBDeploymentTool deploymentTool)` Add a deployment tool to the list of deployment tools that will be processed
`BorlandDeploymentTool` | `createBorland()` Adds a deployment tool for Borland server.
`Path` | `createClasspath()` Adds to the classpath used to locate the super classes and interfaces of the classes that will make up the EJB JAR.
`EjbJar.DTDLocation` | `createDTD()` Create a DTD location record.
`IPlanetDeploymentTool` | `createIplanet()` Adds a deployment tool for iPlanet Application Server.
`JbossDeploymentTool` | `createJboss()` Adds a deployment tool for JBoss server.
`JonasDeploymentTool` | `createJonas()` Adds a deployment tool for JOnAS server.
`FileSet` | `createSupport()` Adds a fileset for support elements.
`WeblogicDeploymentTool` | `createWeblogic()` Adds a deployment tool for Weblogic server.
`WeblogicTOPLinkDeploymentTool` | `createWeblogictoplink()` Adds a deployment tool for Weblogic when using the Toplink Object-Relational mapping.
`WebsphereDeploymentTool` | `createWebsphere()` Adds a deployment tool for Websphere 4.0 server.
`void` | `execute()` Invoked by Ant after the task is prepared, when it is ready to execute this task.
`java.lang.String` | `getCmpversion()` Gets the CMP version.
`java.io.File` | `getDestdir()` Gets the destination directory.
`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)` The string which terminates the bean name.
`void` | `setClasspath(Path classpath)` Set the classpath to use when resolving classes for inclusion in the jar.
`void` | `setCmpversion(EjbJar.CMPVersion version)` Sets the CMP version.
`void` | `setDependency(java.lang.String analyzer)` Set the analyzer to use when adding in dependencies to 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)` Controls whether the destination JARs are written out in the destination directory with the same hierarchical structure from which the deployment descriptors have been read.
`void` | `setGenericjarsuffix(java.lang.String inString)` Set the suffix for the generated jar file.
`void` | `setManifest(java.io.File manifest)` Set the Manifest file to use when jarring.
`void` | `setNaming(EjbJar.NamingScheme namingScheme)` Set the naming scheme used to determine the name of the generated jars from the deployment descriptor
`void` | `setSrcdir(java.io.File inDir)` Sets the source directory, which is the directory that contains the classes that will be added to the EJB jar.

Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject`

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

### addDeploymentTool

    protected void addDeploymentTool(EJBDeploymentTool deploymentTool)

  Add a deployment tool to the list of deployment tools that will be processed

  Parameters:
    `deploymentTool` - a deployment tool instance to which descriptors will be passed for processing.

### createWeblogic

    public WeblogicDeploymentTool createWeblogic()

  Adds a deployment tool for Weblogic server.

  Returns:
    the deployment tool instance to be configured.

### createWebsphere

    public WebsphereDeploymentTool createWebsphere()

  Adds a deployment tool for Websphere 4.0 server.

  Returns:
    the deployment tool instance to be configured.

### createBorland

    public BorlandDeploymentTool createBorland()

  Adds a deployment tool for Borland server.

  Returns:
    the deployment tool instance to be configured.

### createIplanet

    public IPlanetDeploymentTool createIplanet()

  Adds a deployment tool for iPlanet Application Server.

  Returns:
    the deployment tool instance to be configured.

### createJboss

    public JbossDeploymentTool createJboss()

  Adds a deployment tool for JBoss server.

  Returns:
    the deployment tool instance to be configured.

### createJonas

    public JonasDeploymentTool createJonas()

  Adds a deployment tool for JOnAS server.

  Returns:
    the deployment tool instance to be configured.

### createWeblogictoplink

    public WeblogicTOPLinkDeploymentTool createWeblogictoplink()

  Adds a deployment tool for Weblogic when using the Toplink Object-Relational mapping.

  Returns:
    the deployment tool instance to be configured.

### createClasspath

    public Path createClasspath()

  Adds to the classpath 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.

  Returns:
    the DTD location object to be configured by Ant

### createSupport

    public FileSet createSupport()

  Adds a fileset for support elements.

  Returns:
    a fileset which can be populated with support files.

### setManifest

    public void setManifest(java.io.File manifest)

  Set the Manifest file to use when jarring. As of EJB 1.1, manifest files are no longer used to configure the EJB. However, they still have a vital importance if the EJB is intended to be packaged in an EAR file. By adding "Class-Path" settings to a Manifest file, the EJB can look for classes inside the EAR file itself, allowing for easier deployment. This is outlined in the J2EE specification, and all J2EE components are meant to support it.

  Parameters:
    `manifest` - the manifest to be used in the EJB jar

### setSrcdir

    public void setSrcdir(java.io.File inDir)

  Sets the source directory, which 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.

### setDependency

    public void setDependency(java.lang.String analyzer)

  Set the analyzer to use when adding in dependencies to the JAR.

  Parameters:
    `analyzer` - the name of the dependency analyzer or a class.

### 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

### setNaming

    public void setNaming(EjbJar.NamingScheme namingScheme)

  Set the naming scheme used to determine the name of the generated jars from the deployment descriptor

  Parameters:
    `namingScheme` - the naming scheme to be used

### getDestdir

    public java.io.File getDestdir()

  Gets the destination directory.

  Returns:
    destination directory
  Since:
    ant 1.6

### 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:
    `inDir` - the destination directory in which to generate jars

### getCmpversion

    public java.lang.String getCmpversion()

  Gets the CMP version.

  Returns:
    CMP version
  Since:
    ant 1.6

### setCmpversion

    public void setCmpversion(EjbJar.CMPVersion version)

  Sets the CMP version.

  Parameters:
    `version` - CMP version. Must be either `1.0` or `2.0`.
    Default is `1.0`.
    Initially, only the JBoss implementation does something specific for CMP 2.0.
  Since:
    ant 1.6

### 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)

  Controls whether the destination JARs are written out in the destination directory with the same hierarchical 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)

  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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.