| java.lang.Object org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool
All known Subclasses: org.apache.tools.ant.taskdefs.optional.ejb.JonasDeploymentTool, org.apache.tools.ant.taskdefs.optional.ejb.IPlanetDeploymentTool, org.apache.tools.ant.taskdefs.optional.ejb.WeblogicDeploymentTool, org.apache.tools.ant.taskdefs.optional.ejb.WebsphereDeploymentTool, org.apache.tools.ant.taskdefs.optional.ejb.BorlandDeploymentTool, org.apache.tools.ant.taskdefs.optional.ejb.JbossDeploymentTool,
GenericDeploymentTool | public class GenericDeploymentTool implements EJBDeploymentTool(Code) | | A deployment tool which creates generic EJB jars. Generic jars contains
only those classes and META-INF entries specified in the EJB 1.1 standard
This class is also used as a framework for the creation of vendor specific
deployment tools. A number of template methods are provided through which the
vendor specific tool can hook into the EJB creation process.
|
Method Summary | |
protected void | addFileToJar(JarOutputStream jStream, File inputFile, String logicalFilename) Utility method that encapsulates the logic of adding a file entry to
a .jar file. | protected void | addSupportClasses(Hashtable ejbFiles) Adds any classes the user specifies using support nested elements
to the ejbFiles Hashtable. | protected void | addVendorFiles(Hashtable ejbFiles, String ddPrefix) Add any vendor specific files which should be included in the
EJB Jar. | protected void | checkAndAddDependants(Hashtable checkEntries) | protected void | checkConfiguration(String descriptorFileName, 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. | public void | configure(EjbJar.Config config) Configure this tool for use in the ejbjar task. | public Path | createClasspath() | protected 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 EjbJar.Config | getConfig() Get the basename terminator. | protected DescriptorHandler | getDescriptorHandler(File srcDir) Get a descriptionHandler.
Parameters: srcDir - the source directory. | protected File | getDestDir() Get the destination directory. | protected String | getJarBaseName(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 File | getManifestFile(String prefix) Get the manifets file to use for building the generic jar.
If the file does not exist the global manifest from the config is used
otherwise the default Ant manifest will be used.
Parameters: prefix - the prefix where to llook for the manifest file based onthe naming convention. | protected String | getPublicId() Returns the Public ID of the DTD specified in the EJB descriptor. | protected Task | getTask() Get the task for this tool. | public String | getVendorDDPrefix(String baseName, String descriptorFileName) Get the prefix for vendor deployment descriptors.
This will contain the path and the start of the descriptor name,
depending on the naming scheme
Parameters: baseName - the base name to use. Parameters: descriptorFileName - the file name to use. | File | getVendorOutputJarFile(String baseName) Get the vendor specific name of the Jar that will be output. | protected void | log(String message, int level) Log a message to the Ant output. | protected boolean | needToRebuild(Hashtable ejbFiles, File jarFile) This method checks the timestamp on each file listed in the
ejbFiles and compares them to the timestamp on the jarFile
. | protected Hashtable | parseEjbFiles(String descriptorFileName, SAXParser saxParser) This method returns a list of EJB files found when the specified EJB
descriptor is parsed and processed. | public void | processDescriptor(String descriptorFileName, SAXParser saxParser) . | protected void | registerKnownDTDs(DescriptorHandler handler) Register the locations of all known DTDs. | public void | setClasspath(Path classpath) Set the classpath to be used for this compilation. | public void | setDestdir(File inDir) Set the destination directory; required. | public void | setGenericJarSuffix(String inString) Set the suffix for the generated jar file. | public void | setTask(Task task) | protected boolean | usingBaseJarName() Indicate if this build is using the base jar name. | public void | validateConfigured() Called to validate that the tool parameters have been configured. | protected void | writeJar(String baseName, File jarfile, Hashtable files, String publicId) Method used to encapsulate the writing of the JAR file. |
ANALYZER_CLASS_FULL | final public static String ANALYZER_CLASS_FULL(Code) | | The analyzer class for the super analyzer
|
ANALYZER_CLASS_SUPER | final public static String ANALYZER_CLASS_SUPER(Code) | | The analyzer class for the super analyzer
|
ANALYZER_FULL | final public static String ANALYZER_FULL(Code) | | A dependency analyzer name to find all related classes
|
ANALYZER_NONE | final public static String ANALYZER_NONE(Code) | | A dependency analyzer name for no analyzer
|
ANALYZER_SUPER | final public static String ANALYZER_SUPER(Code) | | A dependency analyzer name to find ancestor classes
|
DEFAULT_ANALYZER | final public static String DEFAULT_ANALYZER(Code) | | The default analyzer
|
DEFAULT_BUFFER_SIZE | final public static int DEFAULT_BUFFER_SIZE(Code) | | The default buffer byte size to use for IO
|
EJB_DD | final protected static String EJB_DD(Code) | | Name for EJB Deployment descriptor within EJB jars
|
JAR_COMPRESS_LEVEL | final public static int JAR_COMPRESS_LEVEL(Code) | | The level to use for compression
|
MANIFEST | final protected static String MANIFEST(Code) | | The standard MANIFEST file
|
META_DIR | final protected static String META_DIR(Code) | | The standard META-INF directory in jar files
|
GenericDeploymentTool | public GenericDeploymentTool()(Code) | | No arg constructor
|
addFileToJar | protected void addFileToJar(JarOutputStream jStream, File inputFile, String logicalFilename) throws BuildException(Code) | | Utility method that encapsulates the logic of adding a file entry to
a .jar file. Used by execute() to add entries to the jar file as it is
constructed.
Parameters: jStream - A JarOutputStream into which to write thejar entry. Parameters: inputFile - A File from which to read thecontents the file being added. Parameters: logicalFilename - A String representing the name, includingall relevant path information, that should be stored for the entrybeing added. throws: BuildException - if there is a problem. |
addSupportClasses | protected void addSupportClasses(Hashtable ejbFiles)(Code) | | Adds any classes the user specifies using support nested elements
to the ejbFiles Hashtable.
Parameters: ejbFiles - Hashtable of EJB classes (and other) files that will beadded to the completed JAR file |
addVendorFiles | protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix)(Code) | | Add any vendor specific files which should be included in the
EJB Jar.
Parameters: ejbFiles - a hashtable entryname -> file. Parameters: ddPrefix - a prefix to use. |
checkAndAddDependants | protected void checkAndAddDependants(Hashtable checkEntries) throws BuildException(Code) | | Add all available classes, that depend on Remote, Home, Bean, PK
Parameters: checkEntries - files, that are extracted from the deployment descriptor throws: BuildException - if there is a problem. |
checkConfiguration | protected void checkConfiguration(String descriptorFileName, SAXParser saxParser) throws BuildException(Code) | | 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. If the configuration is invalid,
a BuildException should be thrown.
Parameters: descriptorFileName - String representing the file name of an EJBdescriptor to be processed Parameters: saxParser - SAXParser which may be used to parse the XMLdescriptor throws: BuildException - if there is a problem. |
configure | public void configure(EjbJar.Config config)(Code) | | Configure this tool for use in the ejbjar task.
Parameters: config - the configuration from the surrounding ejbjar task. |
createClasspath | public Path createClasspath()(Code) | | Add the classpath for the user classes
a Path instance to be configured by Ant. |
getClassLoaderForBuild | protected ClassLoader getClassLoaderForBuild()(Code) | | Returns a Classloader object which parses the passed in generic EjbJar classpath.
The loader is used to dynamically load classes from javax.ejb.* and the classes
being added to the jar.
a classloader. |
getCombinedClasspath | protected Path getCombinedClasspath()(Code) | | Get the classpath by combining the one from the surrounding task, if any
and the one from this tool.
the combined classpath |
getConfig | protected EjbJar.Config getConfig()(Code) | | Get the basename terminator.
an ejbjar task configuration |
getDescriptorHandler | protected DescriptorHandler getDescriptorHandler(File srcDir)(Code) | | Get a descriptionHandler.
Parameters: srcDir - the source directory. a handler. |
getDestDir | protected File getDestDir()(Code) | | Get the destination directory.
the destination directory into which EJB jars are to be written |
getJarBaseName | protected String getJarBaseName(String descriptorFileName)(Code) | | 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 representing the file name of an EJBdescriptor to be processed The "basename" which will be used to name thecompleted JAR file |
getLocation | protected Location getLocation()(Code) | | Get the build file location associated with this element's task.
the task's location instance. |
getManifestFile | protected File getManifestFile(String prefix)(Code) | | Get the manifets file to use for building the generic jar.
If the file does not exist the global manifest from the config is used
otherwise the default Ant manifest will be used.
Parameters: prefix - the prefix where to llook for the manifest file based onthe naming convention. the manifest file or null if the manifest file does not exist |
getPublicId | protected String getPublicId()(Code) | | Returns the Public ID of the DTD specified in the EJB descriptor. Not
every vendor-specific DeploymentTool will need to reference
this value or may want to determine this value in a vendor-specific way.
Public ID of the DTD specified in the EJB descriptor. |
getTask | protected Task getTask()(Code) | | Get the task for this tool.
the Task instance this tool is associated with. |
getVendorDDPrefix | public String getVendorDDPrefix(String baseName, String descriptorFileName)(Code) | | Get the prefix for vendor deployment descriptors.
This will contain the path and the start of the descriptor name,
depending on the naming scheme
Parameters: baseName - the base name to use. Parameters: descriptorFileName - the file name to use. the prefix. |
getVendorOutputJarFile | File getVendorOutputJarFile(String baseName)(Code) | | 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 - the basename to use. |
log | protected void log(String message, int level)(Code) | | Log a message to the Ant output.
Parameters: message - the message to be logged. Parameters: level - the severity of this message. |
needToRebuild | protected boolean needToRebuild(Hashtable ejbFiles, File jarFile)(Code) | | This method checks the timestamp on each file listed in the
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 convention
Parameters: ejbFiles - Hashtable of EJB classes (and other) files that will beadded to the completed JAR file Parameters: jarFile - JAR file which will contain all of the EJB classes (andother) files boolean indicating whether or not the jarFile is up to date |
parseEjbFiles | protected Hashtable parseEjbFiles(String descriptorFileName, SAXParser saxParser) throws IOException, SAXException(Code) | | This method returns a list of EJB files found when the specified EJB
descriptor is parsed and processed.
Parameters: descriptorFileName - String representing the file name of an EJBdescriptor to be processed Parameters: saxParser - SAXParser which may be used to parse the XMLdescriptor Hashtable of EJB class (and other) files to beadded to the completed JAR file throws: SAXException - Any SAX exception, possibly wrapping anotherexception throws: IOException - An IOException from the parser, possibly from athe byte stream or character stream |
registerKnownDTDs | protected void registerKnownDTDs(DescriptorHandler handler)(Code) | | 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 - no used in this class. |
setClasspath | public void setClasspath(Path classpath)(Code) | | Set the classpath to be used for this compilation.
Parameters: classpath - the classpath to be used for this build. |
setDestdir | public void setDestdir(File inDir)(Code) | | Set the destination directory; required.
Parameters: inDir - the destination directory. |
setGenericJarSuffix | public void setGenericJarSuffix(String inString)(Code) | | Set the suffix for the generated jar file.
Parameters: inString - the string to use as the suffix. |
setTask | public void setTask(Task task)(Code) | | Set the task which owns this tool
Parameters: task - the Task to which this deployment tool is associated. |
usingBaseJarName | protected boolean usingBaseJarName()(Code) | | Indicate if this build is using the base jar name.
true if the name of the generated jar is coming from thebasejarname attribute |
validateConfigured | public void validateConfigured() throws BuildException(Code) | | Called to validate that the tool parameters have been configured.
throws: BuildException - If the Deployment Tool's configuration isn'tvalid |
writeJar | protected void writeJar(String baseName, File jarfile, Hashtable files, String publicId) throws BuildException(Code) | | 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 - the base name to use. Parameters: jarfile - the jar file to write to. Parameters: files - the files to write to the jar. Parameters: publicId - the id to use. throws: BuildException - if there is a problem. |
|
|