public class GenericDeploymentTool extends java.lang.Object implements EJBDeploymentTool
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANALYZER_CLASS_FULL
The analyzer class for the super analyzer
|
static java.lang.String |
ANALYZER_CLASS_SUPER
The analyzer class for the super analyzer
|
static java.lang.String |
ANALYZER_FULL
A dependency analyzer name to find all related classes
|
static java.lang.String |
ANALYZER_NONE
A dependency analyzer name for no analyzer
|
static java.lang.String |
ANALYZER_SUPER
A dependency analyzer name to find ancestor classes
|
static java.lang.String |
DEFAULT_ANALYZER
The default analyzer
|
static int |
DEFAULT_BUFFER_SIZE
The default buffer byte size to use for IO
|
protected static java.lang.String |
EJB_DD
Name for EJB Deployment descriptor within EJB jars
|
static int |
JAR_COMPRESS_LEVEL
The level to use for compression
|
protected static java.lang.String |
MANIFEST
The standard MANIFEST file
|
protected static java.lang.String |
META_DIR
The standard META-INF directory in jar files
|
Constructor and Description |
---|
GenericDeploymentTool()
No arg constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFileToJar(java.util.jar.JarOutputStream jStream,
java.io.File inputFile,
java.lang.String logicalFilename)
Utility method that encapsulates the logic of adding a file entry to
a .jar file.
|
protected void |
addSupportClasses(java.util.Hashtable ejbFiles)
Adds any classes the user specifies using support nested elements
to the
ejbFiles Hashtable. |
protected void |
addVendorFiles(java.util.Hashtable ejbFiles,
java.lang.String ddPrefix)
Add any vendor specific files which should be included in the
EJB Jar.
|
protected void |
checkAndAddDependants(java.util.Hashtable checkEntries)
Add all available classes, that depend on Remote, Home, Bean, PK
|
protected void |
checkConfiguration(java.lang.String descriptorFileName,
javax.xml.parsers.SAXParser saxParser)
This method is called as the first step in the processDescriptor method
to allow vendor-specific subclasses to validate the task configuration
prior to processing the descriptor.
|
void |
configure(org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.Config config)
Configure this tool for use in the ejbjar task.
|
Path |
createClasspath()
Add the classpath for the user classes
|
protected java.lang.ClassLoader |
getClassLoaderForBuild()
Returns a Classloader object which parses the passed in generic EjbJar classpath.
|
protected Path |
getCombinedClasspath()
Get the classpath by combining the one from the surrounding task, if any
and the one from this tool.
|
protected org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.Config |
getConfig()
Get the basename terminator.
|
protected DescriptorHandler |
getDescriptorHandler(java.io.File srcDir)
Get a descriptionHandler.
|
protected java.io.File |
getDestDir()
Get the destination directory.
|
protected java.lang.String |
getJarBaseName(java.lang.String descriptorFileName)
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. |
protected Location |
getLocation()
Get the build file location associated with this element's task.
|
protected java.io.File |
getManifestFile(java.lang.String prefix)
Get the manifest file to use for building the generic jar.
|
protected java.lang.String |
getPublicId()
Returns the Public ID of the DTD specified in the EJB descriptor.
|
protected Task |
getTask()
Get the task for this tool.
|
java.lang.String |
getVendorDDPrefix(java.lang.String baseName,
java.lang.String descriptorFileName)
Get the prefix for vendor deployment descriptors.
|
protected void |
log(java.lang.String message,
int level)
Log a message to the Ant output.
|
protected boolean |
needToRebuild(java.util.Hashtable ejbFiles,
java.io.File jarFile)
This method checks the timestamp on each file listed in the
ejbFiles and compares them to the timestamp on the jarFile
. |
protected java.util.Hashtable |
parseEjbFiles(java.lang.String descriptorFileName,
javax.xml.parsers.SAXParser saxParser)
This method returns a list of EJB files found when the specified EJB
descriptor is parsed and processed.
|
void |
processDescriptor(java.lang.String descriptorFileName,
javax.xml.parsers.SAXParser saxParser)
Process a deployment descriptor, generating the necessary vendor specific
deployment files.
|
protected void |
registerKnownDTDs(DescriptorHandler handler)
Register the locations of all known DTDs.
|
void |
setClasspath(Path classpath)
Set the classpath to be used for this compilation.
|
void |
setDestdir(java.io.File inDir)
Set the destination directory; required.
|
void |
setGenericJarSuffix(java.lang.String inString)
Set the suffix for the generated jar file.
|
void |
setTask(Task task)
Set the task which owns this tool
|
protected boolean |
usingBaseJarName()
Indicate if this build is using the base jar name.
|
void |
validateConfigured()
Called to validate that the tool parameters have been configured.
|
protected void |
writeJar(java.lang.String baseName,
java.io.File jarfile,
java.util.Hashtable files,
java.lang.String publicId)
Method used to encapsulate the writing of the JAR file.
|
public static final int DEFAULT_BUFFER_SIZE
public static final int JAR_COMPRESS_LEVEL
protected static final java.lang.String META_DIR
protected static final java.lang.String MANIFEST
protected static final java.lang.String EJB_DD
public static final java.lang.String ANALYZER_SUPER
public static final java.lang.String ANALYZER_FULL
public static final java.lang.String ANALYZER_NONE
public static final java.lang.String DEFAULT_ANALYZER
public static final java.lang.String ANALYZER_CLASS_SUPER
public static final java.lang.String ANALYZER_CLASS_FULL
public void setDestdir(java.io.File inDir)
inDir
- the destination directory.protected java.io.File getDestDir()
public void setTask(Task task)
setTask
in interface EJBDeploymentTool
task
- the Task to which this deployment tool is associated.protected Task getTask()
protected org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.Config getConfig()
protected boolean usingBaseJarName()
public void setGenericJarSuffix(java.lang.String inString)
inString
- the string to use as the suffix.public Path createClasspath()
public void setClasspath(Path classpath)
classpath
- the classpath to be used for this build.protected Path getCombinedClasspath()
protected void log(java.lang.String message, int level)
message
- the message to be logged.level
- the severity of this message.protected Location getLocation()
public void configure(org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.Config config)
configure
in interface EJBDeploymentTool
config
- the configuration from the surrounding ejbjar task.protected void addFileToJar(java.util.jar.JarOutputStream jStream, java.io.File inputFile, java.lang.String logicalFilename) throws BuildException
jStream
- A JarOutputStream into which to write the
jar entry.inputFile
- A File from which to read the
contents the file being added.logicalFilename
- A String representing the name, including
all relevant path information, that should be stored for the entry
being added.BuildException
- if there is a problem.protected DescriptorHandler getDescriptorHandler(java.io.File srcDir)
srcDir
- the source directory.protected void registerKnownDTDs(DescriptorHandler handler)
handler
- no used in this class.public void processDescriptor(java.lang.String descriptorFileName, javax.xml.parsers.SAXParser saxParser)
processDescriptor
in interface EJBDeploymentTool
descriptorFileName
- the name of the deployment descriptorsaxParser
- a SAX parser which can be used to parse the deployment descriptor.protected void checkConfiguration(java.lang.String descriptorFileName, javax.xml.parsers.SAXParser saxParser) throws BuildException
descriptorFileName
- String representing the file name of an EJB
descriptor to be processedsaxParser
- SAXParser which may be used to parse the XML
descriptorBuildException
- if there is a problem.protected java.util.Hashtable parseEjbFiles(java.lang.String descriptorFileName, javax.xml.parsers.SAXParser saxParser) throws java.io.IOException, org.xml.sax.SAXException
descriptorFileName
- String representing the file name of an EJB
descriptor to be processedsaxParser
- SAXParser which may be used to parse the XML
descriptororg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another
exceptionjava.io.IOException
- An IOException from the parser, possibly from a
the byte stream or character streamprotected void addSupportClasses(java.util.Hashtable ejbFiles)
ejbFiles
Hashtable.ejbFiles
- Hashtable of EJB classes (and other) files that will be
added to the completed JAR fileprotected java.lang.String getJarBaseName(java.lang.String descriptorFileName)
ejbjar
task, this method returns the "basename" which will be used to name the
completed JAR file.descriptorFileName
- String representing the file name of an EJB
descriptor to be processedpublic java.lang.String getVendorDDPrefix(java.lang.String baseName, java.lang.String descriptorFileName)
baseName
- the base name to use.descriptorFileName
- the file name to use.protected void addVendorFiles(java.util.Hashtable ejbFiles, java.lang.String ddPrefix)
ejbFiles
- a hashtable entryname -> file.ddPrefix
- a prefix to use.protected boolean needToRebuild(java.util.Hashtable ejbFiles, java.io.File jarFile)
ejbFiles
and compares them to the timestamp on the jarFile
. If the jarFile
's timestamp is more recent than
each EJB file, true
is returned. Otherwise, false
is returned.
TODO: find a way to check the manifest-file, that is found by naming conventionejbFiles
- Hashtable of EJB classes (and other) files that will be
added to the completed JAR filejarFile
- JAR file which will contain all of the EJB classes (and
other) filesjarFile
is up to dateprotected java.lang.String getPublicId()
DeploymentTool
will need to reference
this value or may want to determine this value in a vendor-specific way.protected java.io.File getManifestFile(java.lang.String prefix)
prefix
- the prefix where to llook for the manifest file based on
the naming convention.protected void writeJar(java.lang.String baseName, java.io.File jarfile, java.util.Hashtable files, java.lang.String publicId) throws BuildException
baseName
- the base name to use.jarfile
- the jar file to write to.files
- the files to write to the jar.publicId
- the id to use.BuildException
- if there is a problem.protected void checkAndAddDependants(java.util.Hashtable checkEntries) throws BuildException
checkEntries
- files, that are extracted from the deployment descriptorBuildException
- if there is a problem.protected java.lang.ClassLoader getClassLoaderForBuild()
public void validateConfigured() throws BuildException
validateConfigured
in interface EJBDeploymentTool
BuildException
- If the Deployment Tool's configuration isn't
valid