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

public Class JonasDeploymentTool

extends GenericDeploymentTool
Class Inheritance
Imports
java.io.File, .IOException, java.nio.file.Files, java.util.Arrays, .Hashtable, .List, javax.xml.parsers.SAXParser, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, org.apache.tools.ant.taskdefs.Java, org.apache.tools.ant.types.Path

The deployment tool to add the jonas specific deployment descriptors to the ejb JAR file. JONAS only requires one additional file jonas-ejb-jar.xml.
Version
1.0
See Also
EjbJar#createJonas

Field Summary

Modifier and TypeField and Description
private String
additionalargs

Additional args to send to GenIC.

protected static final String
DAVID_ORB

DAVID ORB.

private String
descriptorName

Filename of the standard EJB descriptor (which is passed to this class from the parent "ejbjar" task).

protected static final String
EJB_JAR_1_1_DTD

Name of the standard deployment descriptor DTD (these files are stored in the ${JONAS_ROOT}/xml directory).

protected static final String
EJB_JAR_1_1_PUBLIC_ID

Public Id of the standard deployment descriptor DTD.

protected static final String
protected static final String
protected static final String
GENIC_CLASS

GenIC class name (JOnAS 2.5)

private String
javac

Java compiler to use.

private String
javacopts

Options to pass to the java compiler.

protected static final String
JEREMIE_ORB

JEREMIE ORB.

protected static final String
JONAS_DD

Default JOnAS deployment descriptor name.

protected static final String
JONAS_EJB_JAR_2_4_DTD

Name of the JOnAS-specific deployment descriptor DTD (these files are stored in the ${JONAS_ROOT}/xml directory).

protected static final String
JONAS_EJB_JAR_2_4_PUBLIC_ID

Public Id of the JOnAS-specific deployment descriptor DTD.

protected static final String
protected static final String
private String
jonasDescriptorName

Filename of the JOnAS-specific EJB descriptor (which is passed to this class from the parent "ejbjar" task).

private File
jonasroot

JOnAS root directory.

private boolean
keepgenerated

true if the intermediate Java source files generated by GenIC must be deleted or not.

private boolean
keepgeneric

true if the generic JAR file used as input to GenIC must be retained.

private boolean
nocompil

true if the generated source files must not be compiled via the java and rmi compilers.

private boolean
nogenic

true if GenIC must not be run on the EJB JAR.

private boolean
novalidation

true if the XML deployment descriptors must be parsed without validation.

protected static final String
OLD_GENIC_CLASS_1

Old GenIC class name (JOnAS 2.4.x).

protected static final String
OLD_GENIC_CLASS_2

Old GenIC class name.

private String
orb

ORB to use (RMI, JEREMIE or DAVID).

private File
outputdir

Temporary output directory used by GenIC.

protected static final String
RMI_ORB

RMI ORB.

private String
rmicopts

Options to pass to the rmi compiler.

private boolean
secpropag

Whether or not the RMI skeleton and stub must be modified to implement the implicit propagation of the security context (the transactional context is always provided).

private String
suffix

Stores the suffix for the JOnAS JAR file.

private boolean
verbose

true if the GenIC call must be verbose.

Inherited from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool:
ANALYZER_CLASS_FULLANALYZER_CLASS_SUPERANALYZER_FULLANALYZER_NONEANALYZER_SUPERDEFAULT_ANALYZERDEFAULT_BUFFER_SIZEEJB_DDJAR_COMPRESS_LEVELMANIFESTMETA_DIR

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addAllFiles(File
the file to add.
file
,
String
the current sub-directory to scan.
rootDir
,
Hashtable<String, File>
the hashtable where to add the files.
hashtable
)

Add a file to the a given hashtable.

private void
addGenICGeneratedFiles(File
jar file.
genericJarFile
,
Hashtable<String, File>
the hashtable.
ejbFiles
)

Add to the given hashtable all the file generated by GenIC.

protected void
addVendorFiles(Hashtable<String, File>
a hashtable entryname -> file.
ejbFiles
,
String
a prefix to use.
ddPrefix
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.addVendorFiles.

Add any vendor specific files which should be included in the EJB Jar..
protected void
checkConfiguration(String
the name of the descriptor file.
descriptorFileName
,
SAXParser
not used.
saxParser
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.checkConfiguration.

Verify the configuration.
private File

Returns:

the temp directory.
createTempDir
()

Create a temporary directory for GenIC output.

private void
deleteAllFiles(File
file to delete.
aFile
)

Delete a file.

pack-priv String

Returns:

the GenIC class name. Return null if the class name cannot be found.
getGenicClassName
(Path
classpath where the GenIC class must be searched.
classpath
)

Get the GenIC class name to use in the given classpath.

protected String
getJarBaseName(String
String representing the file name of an EJB descriptor to be processed
descriptorFileName
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getJarBaseName.

Using the EJB descriptor file name passed from the ejbjar task, this method returns the "basename" which will be used to name the completed JAR file..
private String

Returns:

The name of the JOnAS-specific EJB descriptor file.
getJonasDescriptorName
()

Determines the name of the JOnAS-specific EJB descriptor using the specified standard EJB descriptor name.

protected File
getVendorOutputJarFile(String
the basename to use.
baseName
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getVendorOutputJarFile.

Get the vendor specific name of the Jar that will be output.
public void
processDescriptor(String
the name of the deployment descriptor
aDescriptorName
,
SAXParser
a SAX parser which can be used to parse the deployment descriptor.
saxParser
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.processDescriptor.

Implements org.apache.tools.ant.taskdefs.optional.ejb.EJBDeploymentTool.processDescriptor.

Process a deployment descriptor, generating the necessary vendor specific deployment files...
protected void
registerKnownDTDs(DescriptorHandler
no used in this class.
handler
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.registerKnownDTDs.

Deprecated as a consequence of DescriptorHandler being deprecated.
Register the locations of all known DTDs.
public void
setAdditionalargs(String
additional args.
aString
)

Sets the additional arguments.

public void
setJarsuffix(String
the string to use as the suffix.
aString
)

Sets the jar suffix.

public void
setJavac(String
the java compiler.
aString
)

Sets the java compiler to use.

public void
setJavacopts(String
the options.
aString
)

Set the options to pass to the java compiler.

public void
setJonasroot(File
the JOnAS root directory.
aFile
)

Set the JOnAS root directory.

public void
setKeepgenerated(boolean
true if the flag must be set.
aBoolean
)

Sets the keepgenerated flag.

public void
setKeepgeneric(boolean
true if the flag must be set.
aBoolean
)

Sets the keepgeneric flag.

public void
setNocompil(boolean
true if the flag must be set.
aBoolean
)

Sets the nocompil flag.

public void
setNogenic(boolean
true if the flag must be set.
aBoolean
)

Sets the nogenic flag.

public void
setNovalidation(boolean
true if the flag must be set.
aBoolean
)

Sets the novalidation flag.

public void
setOrb(String
'RMI', 'JEREMIE', or 'DAVID'.
aString
)

Sets the orb to construct classpath.

public void
setRmicopts(String
the options.
aString
)

Set the options to pass to the rmi compiler.

public void
setSecpropag(boolean
true if the flag must be set.
aBoolean
)

Sets the secpropag flag.

public void
setVerbose(boolean
true if the flag must be set.
aBoolean
)

Sets the verbose flag.

protected void
writeJar(String
the base name to use.
baseName
,
File
the jar file to write to.
jarfile
,
Hashtable<String, File>
the files to write to the jar.
ejbFiles
,
String
the id to use.
publicId
)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.writeJar.

Method used to encapsulate the writing of the JAR file.
Inherited from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool:
addFileToJaraddSupportClassescheckAndAddDependantsconfigurecreateClasspathgetClassLoaderForBuildgetCombinedClasspathgetConfiggetDescriptorHandlergetDestDirgetLocationgetManifestFilegetPublicIdgetTaskgetVendorDDPrefixlogneedToRebuildparseEjbFilessetClasspathsetDestdirsetGenericJarSuffixsetTaskusingBaseJarNamevalidateConfigured

Field Detail

additionalargsback to summary
private String additionalargs

Additional args to send to GenIC.

DAVID_ORBback to summary
protected static final String DAVID_ORB

DAVID ORB.

descriptorNameback to summary
private String descriptorName

Filename of the standard EJB descriptor (which is passed to this class from the parent "ejbjar" task). This file is relative to the directory specified by the "srcdir" attribute in the ejbjar task.

EJB_JAR_1_1_DTDback to summary
protected static final String EJB_JAR_1_1_DTD

Name of the standard deployment descriptor DTD (these files are stored in the ${JONAS_ROOT}/xml directory).

EJB_JAR_1_1_PUBLIC_IDback to summary
protected static final String EJB_JAR_1_1_PUBLIC_ID

Public Id of the standard deployment descriptor DTD.

EJB_JAR_2_0_DTDback to summary
protected static final String EJB_JAR_2_0_DTD
EJB_JAR_2_0_PUBLIC_IDback to summary
protected static final String EJB_JAR_2_0_PUBLIC_ID
GENIC_CLASSback to summary
protected static final String GENIC_CLASS

GenIC class name (JOnAS 2.5)

javacback to summary
private String javac

Java compiler to use. The default is the value of build.compiler property.

javacoptsback to summary
private String javacopts

Options to pass to the java compiler.

JEREMIE_ORBback to summary
protected static final String JEREMIE_ORB

JEREMIE ORB.

JONAS_DDback to summary
protected static final String JONAS_DD

Default JOnAS deployment descriptor name.

JONAS_EJB_JAR_2_4_DTDback to summary
protected static final String JONAS_EJB_JAR_2_4_DTD

Name of the JOnAS-specific deployment descriptor DTD (these files are stored in the ${JONAS_ROOT}/xml directory).

JONAS_EJB_JAR_2_4_PUBLIC_IDback to summary
protected static final String JONAS_EJB_JAR_2_4_PUBLIC_ID

Public Id of the JOnAS-specific deployment descriptor DTD.

JONAS_EJB_JAR_2_5_DTDback to summary
protected static final String JONAS_EJB_JAR_2_5_DTD
JONAS_EJB_JAR_2_5_PUBLIC_IDback to summary
protected static final String JONAS_EJB_JAR_2_5_PUBLIC_ID
jonasDescriptorNameback to summary
private String jonasDescriptorName

Filename of the JOnAS-specific EJB descriptor (which is passed to this class from the parent "ejbjar" task). This file is relative to the directory specified by the "srcdir" attribute in the ejbjar task.

jonasrootback to summary
private File jonasroot

JOnAS root directory.

keepgeneratedback to summary
private boolean keepgenerated

true if the intermediate Java source files generated by GenIC must be deleted or not. The default is false

keepgenericback to summary
private boolean keepgeneric

true if the generic JAR file used as input to GenIC must be retained. The default is false.

nocompilback to summary
private boolean nocompil

true if the generated source files must not be compiled via the java and rmi compilers. The default is false.

nogenicback to summary
private boolean nogenic

true if GenIC must not be run on the EJB JAR. The default is false.

novalidationback to summary
private boolean novalidation

true if the XML deployment descriptors must be parsed without validation. The default is false.

OLD_GENIC_CLASS_1back to summary
protected static final String OLD_GENIC_CLASS_1

Old GenIC class name (JOnAS 2.4.x).

OLD_GENIC_CLASS_2back to summary
protected static final String OLD_GENIC_CLASS_2

Old GenIC class name.

orbback to summary
private String orb

ORB to use (RMI, JEREMIE or DAVID). If omitted, it defaults to the one present in classpath. If specified, the corresponding JOnAS JAR is automatically added to the classpath.

outputdirback to summary
private File outputdir

Temporary output directory used by GenIC.

RMI_ORBback to summary
protected static final String RMI_ORB

RMI ORB.

rmicoptsback to summary
private String rmicopts

Options to pass to the rmi compiler.

secpropagback to summary
private boolean secpropag

Whether or not the RMI skeleton and stub must be modified to implement the implicit propagation of the security context (the transactional context is always provided). The default is false.

suffixback to summary
private String suffix

Stores the suffix for the JOnAS JAR file. The default is '.jar'.

verboseback to summary
private boolean verbose

true if the GenIC call must be verbose. The default is false.

Constructor Detail

JonasDeploymentToolback to summary
public JonasDeploymentTool()

Method Detail

addAllFilesback to summary
private void addAllFiles(File file, String rootDir, Hashtable<String, File> hashtable)

Add a file to the a given hashtable. If the file is a directory, add recursivly all the files inside to the hashtable.

Parameters
file:File

the file to add.

rootDir:String

the current sub-directory to scan.

hashtable:Hashtable<String, File>

the hashtable where to add the files.

addGenICGeneratedFilesback to summary
private void addGenICGeneratedFiles(File genericJarFile, Hashtable<String, File> ejbFiles)

Add to the given hashtable all the file generated by GenIC.

Parameters
genericJarFile:File

jar file.

ejbFiles:Hashtable<String, File>

the hashtable.

addVendorFilesback to summary
protected void addVendorFiles(Hashtable<String, File> ejbFiles, String ddPrefix)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.addVendorFiles.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.addVendorFiles.

Add any vendor specific files which should be included in the EJB Jar..

Parameters
ejbFiles:Hashtable<String, File>

a hashtable entryname -> file.

ddPrefix:String

a prefix to use.

Annotations
@Override
checkConfigurationback to summary
protected void checkConfiguration(String descriptorFileName, SAXParser saxParser) throws BuildException

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.checkConfiguration.

Verify the configuration.

Parameters
descriptorFileName:String

the name of the descriptor file.

saxParser:SAXParser

not used.

Annotations
@Override
Exceptions
BuildException:
if there is an error.
createTempDirback to summary
private File createTempDir() throws IOException

Create a temporary directory for GenIC output.

Returns:File

the temp directory.

Exceptions
BuildException:
if a temp directory cannot be created.
deleteAllFilesback to summary
private void deleteAllFiles(File aFile)

Delete a file. If the file is a directory, delete recursively all the files inside.

Parameters
aFile:File

file to delete.

getGenicClassNameback to summary
pack-priv String getGenicClassName(Path classpath)

Get the GenIC class name to use in the given classpath.

Parameters
classpath:Path

classpath where the GenIC class must be searched.

Returns:String

the GenIC class name. Return null if the class name cannot be found.

getJarBaseNameback to summary
protected String getJarBaseName(String descriptorFileName)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getJarBaseName.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getJarBaseName.

Using the EJB descriptor file name passed from the ejbjar task, this method returns the "basename" which will be used to name the completed JAR file..

Parameters
descriptorFileName:String

String representing the file name of an EJB descriptor to be processed

Returns:String

The "basename" which will be used to name the completed JAR file

Annotations
@Override
getJonasDescriptorNameback to summary
private String getJonasDescriptorName()

Determines the name of the JOnAS-specific EJB descriptor using the specified standard EJB descriptor name. In general, the standard descriptor will be named "[basename]-ejb-jar.xml", and this method will return "[basename]-jonas-ejb-jar.xml" or "jonas-[basename].xml"

Returns:String

The name of the JOnAS-specific EJB descriptor file.

getVendorOutputJarFileback to summary
protected File getVendorOutputJarFile(String baseName)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getVendorOutputJarFile.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.getVendorOutputJarFile.

Get the vendor specific name of the Jar that will be output. The modification date of this jar will be checked against the dependent bean classes..

Parameters
baseName:String

the basename to use.

Returns:File

File

Annotations
@Override
processDescriptorback to summary
public void processDescriptor(String aDescriptorName, SAXParser saxParser)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.processDescriptor.

Implements org.apache.tools.ant.taskdefs.optional.ejb.EJBDeploymentTool.processDescriptor.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.processDescriptor.

Process a deployment descriptor, generating the necessary vendor specific deployment files...

Parameters
aDescriptorName:String

Doc from org.apache.tools.ant.taskdefs.optional.ejb.EJBDeploymentTool.processDescriptor.

the name of the deployment descriptor

saxParser:SAXParser

Doc from org.apache.tools.ant.taskdefs.optional.ejb.EJBDeploymentTool.processDescriptor.

a SAX parser which can be used to parse the deployment descriptor.

Annotations
@Override
registerKnownDTDsback to summary
protected void registerKnownDTDs(DescriptorHandler handler)

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.registerKnownDTDs.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.registerKnownDTDs.

Deprecated

as a consequence of DescriptorHandler being deprecated. See corresponding docs for further information.

Register the locations of all known DTDs. vendor-specific subclasses should override this method to define the vendor-specific locations of the EJB DTDs.

Parameters
handler:DescriptorHandler

no used in this class.

Annotations
@Override
setAdditionalargsback to summary
public void setAdditionalargs(String aString)

Sets the additional arguments.

Parameters
aString:String

additional args.

setJarsuffixback to summary
public void setJarsuffix(String aString)

Sets the jar suffix.

Parameters
aString:String

the string to use as the suffix.

setJavacback to summary
public void setJavac(String aString)

Sets the java compiler to use.

Parameters
aString:String

the java compiler.

setJavacoptsback to summary
public void setJavacopts(String aString)

Set the options to pass to the java compiler.

Parameters
aString:String

the options.

setJonasrootback to summary
public void setJonasroot(File aFile)

Set the JOnAS root directory.

Parameters
aFile:File

the JOnAS root directory.

setKeepgeneratedback to summary
public void setKeepgenerated(boolean aBoolean)

Sets the keepgenerated flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setKeepgenericback to summary
public void setKeepgeneric(boolean aBoolean)

Sets the keepgeneric flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setNocompilback to summary
public void setNocompil(boolean aBoolean)

Sets the nocompil flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setNogenicback to summary
public void setNogenic(boolean aBoolean)

Sets the nogenic flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setNovalidationback to summary
public void setNovalidation(boolean aBoolean)

Sets the novalidation flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setOrbback to summary
public void setOrb(String aString)

Sets the orb to construct classpath.

Parameters
aString:String

'RMI', 'JEREMIE', or 'DAVID'.

setRmicoptsback to summary
public void setRmicopts(String aString)

Set the options to pass to the rmi compiler.

Parameters
aString:String

the options.

setSecpropagback to summary
public void setSecpropag(boolean aBoolean)

Sets the secpropag flag.

Parameters
aBoolean:boolean

true if the flag must be set.

setVerboseback to summary
public void setVerbose(boolean aBoolean)

Sets the verbose flag.

Parameters
aBoolean:boolean

true if the flag must be set.

writeJarback to summary
protected void writeJar(String baseName, File jarfile, Hashtable<String, File> ejbFiles, String publicId) throws BuildException

Overrides org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.writeJar.

Doc from org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.writeJar.

Method used to encapsulate the writing of the JAR file. Iterates over the filenames/java.io.Files in the Hashtable stored on the instance variable ejbFiles..

Parameters
baseName:String

the base name to use.

jarfile:File

the jar file to write to.

ejbFiles:Hashtable<String, File>

the files to write to the jar.

publicId:String

the id to use.

Annotations
@Override
Exceptions
BuildException:
if there is a problem.