Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional.ejb

public Class EjbJar

extends MatchingTask
Class Inheritance
Imports
java.io.File, java.util.ArrayList, .List, javax.xml.parsers.ParserConfigurationException, .SAXParser, .SAXParserFactory, org.apache.tools.ant.BuildException, .DirectoryScanner, .Project, org.apache.tools.ant.taskdefs.MatchingTask, org.apache.tools.ant.types.EnumeratedAttribute, .FileSet, .Path, org.xml.sax.SAXException

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 and Inner Type Summary

Modifier and TypeClass and Description
public static class
EjbJar.CMPVersion

CMP versions supported valid CMP versions are 1.0 and 2.0

pack-priv static class
EjbJar.Config

A class which contains the configuration state of the ejbjar task.

public static class
EjbJar.DTDLocation

Inner class used to record information about the location of a local DTD

public static class
EjbJar.NamingScheme

An EnumeratedAttribute class for handling different EJB jar naming schemes

Field Summary

Modifier and TypeField and Description
private String
cmpVersion

Instance variable that stores the CMP version for the JBoss jarfile.

private EjbJar.Config
config

The config which is built by this task and used by the various deployment tools to access the configuration of the ejbjar task

private List<EJBDeploymentTool>
deploymentTools

The list of deployment tools we are going to run.

private File
destDir

Stores a handle to the directory to put the Jar files in. This is only used by the generic deployment descriptor tool which is created if no other deployment descriptor tools are provided.

private String
genericJarSuffix

Instance variable that stores the suffix for the generated jarfile.

Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addDeploymentTool(EJBDeploymentTool
a deployment tool instance to which descriptors will be passed for processing.
deploymentTool
)

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

public BorlandDeploymentTool

Returns:

the deployment tool instance to be configured.
createBorland
()

Adds a deployment tool for Borland server.

public Path

Returns:

the path to be configured.
createClasspath
()

Adds to the classpath used to locate the super classes and interfaces of the classes that will make up the EJB JAR.

public EjbJar.DTDLocation

Returns:

the DTD location object to be configured by Ant
createDTD
()

Create a DTD location record.

public IPlanetDeploymentTool

Returns:

the deployment tool instance to be configured.
createIplanet
()

Adds a deployment tool for iPlanet Application Server.

public JbossDeploymentTool

Returns:

the deployment tool instance to be configured.
createJboss
()

Adds a deployment tool for JBoss server.

public JonasDeploymentTool

Returns:

the deployment tool instance to be configured.
createJonas
()

Adds a deployment tool for JOnAS server.

public OrionDeploymentTool

Returns:

the deployment tool instance to be configured.
createOrion
()

Create a orion nested element used to configure a deployment tool for Orion server.

public FileSet

Returns:

a fileset which can be populated with support files.
createSupport
()

Adds a fileset for support elements.

public WeblogicDeploymentTool

Returns:

the deployment tool instance to be configured.
createWeblogic
()

Adds a deployment tool for WebLogic server.

public WebsphereDeploymentTool

Returns:

the deployment tool instance to be configured.
createWebsphere
()

Adds a deployment tool for WebSphere 4.0 server.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Invoked by Ant after the task is prepared, when it is ready to execute this task.
public String

Returns:

CMP version
getCmpversion
()

Gets the CMP version.

public File

Returns:

destination directory
getDestdir
()

Gets the destination directory.

public void
setBasejarname(String
the basename that will be used when writing the jar file containing the EJB
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.

public void
setBasenameterminator(String
a string which marks the end of the basename.
inValue
)

The string which terminates the bean name.

public void
setClasspath(Path
the classpath to use.
classpath
)

Set the classpath to use when resolving classes for inclusion in the jar.

public void
setCmpversion(EjbJar.CMPVersion
CMP version.
version
)

Sets the CMP version.

public void
setDependency(String
the name of the dependency analyzer or a class.
analyzer
)

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

public void
setDescriptordir(File
the directory containing the deployment descriptors.
inDir
)

Set the descriptor directory.

public void
setDestdir(File
the destination directory in which to generate jars
inDir
)

Set the destination directory.

public void
setFlatdestdir(boolean
the new value of the flatdestdir flag.
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.

public void
setGenericjarsuffix(String
the string to use as the suffix.
inString
)

Set the suffix for the generated jar file.

public void
setManifest(File
the manifest to be used in the EJB jar
manifest
)

Set the Manifest file to use when jarring.

public void
setNaming(EjbJar.NamingScheme
the naming scheme to be used
namingScheme
)

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

public void
setSrcdir(File
the source directory.
inDir
)

Sets the source directory, which is the directory that contains the classes that will be added to the EJB jar.

private void
validateConfig()

Validate the config that has been configured from the build file

Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
addaddAndaddContainsaddContainsRegexpaddCustomaddDateaddDependaddDepthaddDifferentaddFilenameaddMajorityaddModifiedaddNoneaddNotaddOraddPresentaddSelectoraddSizeaddTypeappendSelectorcreateExcludecreateExcludesFilecreateIncludecreateIncludesFilecreatePatternSetgetDirectoryScannergetImplicitFileSetgetSelectorshasSelectorsselectorCountselectorElementssetCaseSensitivesetDefaultexcludessetExcludessetExcludesfilesetFollowSymlinkssetIncludessetIncludesfilesetProjectXsetIgnoreXsetItems

Field Detail

cmpVersionback to summary
private String cmpVersion

Instance variable that stores the CMP version for the JBoss jarfile.

configback to summary
private EjbJar.Config config

The config which is built by this task and used by the various deployment tools to access the configuration of the ejbjar task

deploymentToolsback to summary
private List<EJBDeploymentTool> deploymentTools

The list of deployment tools we are going to run.

destDirback to summary
private File destDir

Stores a handle to the directory to put the Jar files in. This is only used by the generic deployment descriptor tool which is created if no other deployment descriptor tools are provided. Normally each deployment tool will specify the destination dir itself.

genericJarSuffixback to summary
private String genericJarSuffix

Instance variable that stores the suffix for the generated jarfile.

Constructor Detail

EjbJarback to summary
public EjbJar()

Method Detail

addDeploymentToolback to summary
protected void addDeploymentTool(EJBDeploymentTool deploymentTool)

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

Parameters
deploymentTool:EJBDeploymentTool

a deployment tool instance to which descriptors will be passed for processing.

createBorlandback to summary
public BorlandDeploymentTool createBorland()

Adds a deployment tool for Borland server.

Returns:BorlandDeploymentTool

the deployment tool instance to be configured.

createClasspathback to summary
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:Path

the path to be configured.

createDTDback to summary
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:EjbJar.DTDLocation

the DTD location object to be configured by Ant

createIplanetback to summary
public IPlanetDeploymentTool createIplanet()

Adds a deployment tool for iPlanet Application Server.

Returns:IPlanetDeploymentTool

the deployment tool instance to be configured.

createJbossback to summary
public JbossDeploymentTool createJboss()

Adds a deployment tool for JBoss server.

Returns:JbossDeploymentTool

the deployment tool instance to be configured.

createJonasback to summary
public JonasDeploymentTool createJonas()

Adds a deployment tool for JOnAS server.

Returns:JonasDeploymentTool

the deployment tool instance to be configured.

createOrionback to summary
public OrionDeploymentTool createOrion()

Create a orion nested element used to configure a deployment tool for Orion server.

Returns:OrionDeploymentTool

the deployment tool instance to be configured.

Since
Ant 1.10.2
createSupportback to summary
public FileSet createSupport()

Adds a fileset for support elements.

Returns:FileSet

a fileset which can be populated with support files.

createWeblogicback to summary
public WeblogicDeploymentTool createWeblogic()

Adds a deployment tool for WebLogic server.

Returns:WeblogicDeploymentTool

the deployment tool instance to be configured.

createWebsphereback to summary
public WebsphereDeploymentTool createWebsphere()

Adds a deployment tool for WebSphere 4.0 server.

Returns:WebsphereDeploymentTool

the deployment tool instance to be configured.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

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.

Annotations
@Override
Exceptions
BuildException:
thrown whenever a problem is encountered that cannot be recovered from, to signal to ant that a major problem occurred within this task.
getCmpversionback to summary
public String getCmpversion()

Gets the CMP version.

Returns:String

CMP version

Since
ant 1.6
getDestdirback to summary
public File getDestdir()

Gets the destination directory.

Returns:File

destination directory

Since
ant 1.6
setBasejarnameback to summary
public void setBasejarname(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:String

the basename that will be used when writing the jar file containing the EJB

setBasenameterminatorback to summary
public void setBasenameterminator(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:String

a string which marks the end of the basename.

setClasspathback to summary
public void setClasspath(Path classpath)

Set the classpath to use when resolving classes for inclusion in the jar.

Parameters
classpath:Path

the classpath to use.

setCmpversionback to summary
public void setCmpversion(EjbJar.CMPVersion version)

Sets the 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.

Parameters
version:EjbJar.CMPVersion

CMP version.

Since
ant 1.6
setDependencyback to summary
public void setDependency(String analyzer)

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

Parameters
analyzer:String

the name of the dependency analyzer or a class.

setDescriptordirback to summary
public void setDescriptordir(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:File

the directory containing the deployment descriptors.

setDestdirback to summary
public void setDestdir(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:File

the destination directory in which to generate jars

setFlatdestdirback to summary
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:boolean

the new value of the flatdestdir flag.

setGenericjarsuffixback to summary
public void setGenericjarsuffix(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:String

the string to use as the suffix.

setManifestback to summary
public void setManifest(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:File

the manifest to be used in the EJB jar

setNamingback to summary
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:EjbJar.NamingScheme

the naming scheme to be used

setSrcdirback to summary
public void setSrcdir(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:File

the source directory.

validateConfigback to summary
private void validateConfig() throws BuildException

Validate the config that has been configured from the build file

Exceptions
BuildException:
if the config is not valid
org.apache.tools.ant.taskdefs.optional.ejb back to summary

public Class EjbJar.CMPVersion

extends EnumeratedAttribute
Class Inheritance

CMP versions supported valid CMP versions are 1.0 and 2.0
Since
ant 1.6

Field Summary

Modifier and TypeField and Description
public static final String
CMP1_0

1.0 value

public static final String
CMP2_0

2.0 value

Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]
getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

CMP1_0back to summary
public static final String CMP1_0

1.0 value

CMP2_0back to summary
public static final String CMP2_0

2.0 value

Constructor Detail

CMPVersionback to summary
public CMPVersion()

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Doc from org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..

Returns:String[]

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.

Annotations
@Override
org.apache.tools.ant.taskdefs.optional.ejb back to summary

pack-priv Class EjbJar.Config

extends Object
Class Inheritance

A class which contains the configuration state of the ejbjar task. This state is passed to the deployment tools for configuration

Field Summary

Modifier and TypeField and Description
public String
analyzer

The dependency analyzer to use to add additional classes to the jar

public String
baseJarName

Stores a handle to the destination EJB Jar file

public String
baseNameTerminator

Instance variable that marks the end of the 'basename'

public Path
classpath

The classpath to use when loading classes

public File
descriptorDir

Stores a handle to the directory under which to search for deployment descriptors

public ArrayList<EjbJar.DTDLocation>
dtdLocations

The list of configured DTD locations

public boolean
flatDestDir

Instance variable that determines whether to use a package structure of a flat directory as the destination for the jar files.

public File
manifest

The Manifest file

public EjbJar.NamingScheme
namingScheme

The naming scheme used to determine the generated jar name from the descriptor information

public File
srcDir

Stores a handle to the directory under which to search for class files

public List<FileSet>
supportFileSets

A Fileset of support classes

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

analyzerback to summary
public String analyzer

The dependency analyzer to use to add additional classes to the jar

baseJarNameback to summary
public String baseJarName

Stores a handle to the destination EJB Jar file

baseNameTerminatorback to summary
public String baseNameTerminator

Instance variable that marks the end of the 'basename'

classpathback to summary
public Path classpath

The classpath to use when loading classes

descriptorDirback to summary
public File descriptorDir

Stores a handle to the directory under which to search for deployment descriptors

dtdLocationsback to summary
public ArrayList<EjbJar.DTDLocation> dtdLocations

The list of configured DTD locations

flatDestDirback to summary
public boolean flatDestDir

Instance variable that determines whether to use a package structure of a flat directory as the destination for the jar files.

manifestback to summary
public File manifest

The Manifest file

namingSchemeback to summary
public EjbJar.NamingScheme namingScheme

The naming scheme used to determine the generated jar name from the descriptor information

srcDirback to summary
public File srcDir

Stores a handle to the directory under which to search for class files

supportFileSetsback to summary
public List<FileSet> supportFileSets

A Fileset of support classes

Constructor Detail

Configback to summary
pack-priv Config()
org.apache.tools.ant.taskdefs.optional.ejb back to summary

public Class EjbJar.DTDLocation

extends DTDLocation
Class Inheritance

Inner class used to record information about the location of a local DTD

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

DTDLocationback to summary
public DTDLocation()
org.apache.tools.ant.taskdefs.optional.ejb back to summary

public Class EjbJar.NamingScheme

extends EnumeratedAttribute
Class Inheritance

An EnumeratedAttribute class for handling different EJB jar naming schemes

Field Summary

Modifier and TypeField and Description
public static final String
BASEJARNAME

Naming scheme where the generated jar is named by the basejarname attribute

public static final String
DESCRIPTOR

Naming scheme where the generated jar name is based on the name of the deployment descriptor file

public static final String
DIRECTORY

Naming scheme where the generated jar name is based on the name of the directory containing the deployment descriptor

public static final String
EJB_NAME

Naming scheme where generated jar is determined from the ejb-name in the deployment descriptor

Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

an array of the values of this attribute class.
getValues
()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the values of the NamingScheme
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

BASEJARNAMEback to summary
public static final String BASEJARNAME

Naming scheme where the generated jar is named by the basejarname attribute

DESCRIPTORback to summary
public static final String DESCRIPTOR

Naming scheme where the generated jar name is based on the name of the deployment descriptor file

DIRECTORYback to summary
public static final String DIRECTORY

Naming scheme where the generated jar name is based on the name of the directory containing the deployment descriptor

EJB_NAMEback to summary
public static final String EJB_NAME

Naming scheme where generated jar is determined from the ejb-name in the deployment descriptor

Constructor Detail

NamingSchemeback to summary
public NamingScheme()

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the values of the NamingScheme

Returns:String[]

an array of the values of this attribute class.

Annotations
@Override