org.apache.tools.ant.taskdefs.optional.ejb
Class GenericDeploymentTool

java.lang.Object
  |
  +--org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool
All Implemented Interfaces:
EJBDeploymentTool
Direct Known Subclasses:
WeblogicDeploymentTool

public class GenericDeploymentTool
extends java.lang.Object
implements EJBDeploymentTool


Field Summary
protected static java.lang.String EJB_DD
           
protected static java.lang.String META_DIR
          Private constants that are used when constructing the standard jarfile
 
Constructor Summary
GenericDeploymentTool()
           
 
Method Summary
protected  void addFileToJar(java.util.jar.JarOutputStream jStream, java.io.FileInputStream iStream, java.lang.String filename)
          Utility method that encapsulates the logic of adding a file entry to a .jar file.
protected  void addVendorFiles(java.util.Hashtable ejbFiles, java.lang.String baseName)
          Add any vendor specific files which should be included in the EJB Jar.
 void configure(java.io.File srcDir, java.io.File descriptorDir, java.lang.String baseNameTerminator, java.lang.String baseJarName, boolean flatDestDir)
          Configure this tool for use in the ejbjar task.
protected  java.lang.String getBaseJarName()
          Get the base jar name.
protected  java.lang.String getBaseNameTerminator()
          Get the basename terminator.
protected  java.io.File getDescriptorDir()
          Get the meta-inf dir.
protected  DescriptorHandler getDescriptorHandler(java.io.File srcDir)
           
protected  java.io.File getDestDir()
          Get the desitination directory.
protected  java.io.File getSrcDir()
          Get the source dir.
protected  Task getTask()
          Get the task for this tool.
 void processDescriptor(java.lang.String descriptorFileName, javax.xml.parsers.SAXParser saxParser)
          Process a deployment descriptor, generating the necessary vendor specific deployment files.
 void setDestdir(java.io.File inDir)
          Setter used to store the value of destination directory prior to execute() being called.
 void setGenericJarSuffix(java.lang.String inString)
          Setter used to store the suffix for the generated jar file.
 void setTask(Task task)
          Set the task which owns this tool
protected  boolean usingBaseJarName()
          Returns true, if the meta-inf dir is being explicitly set, false otherwise.
 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)
          Method used to encapsulate the writing of the JAR file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_DIR

protected static final java.lang.String META_DIR
Private constants that are used when constructing the standard jarfile

EJB_DD

protected static final java.lang.String EJB_DD
Constructor Detail

GenericDeploymentTool

public GenericDeploymentTool()
Method Detail

setDestdir

public void setDestdir(java.io.File inDir)
Setter used to store the value of destination directory prior to execute() being called.
Parameters:
inDir - the destination directory.

getDestDir

protected java.io.File getDestDir()
Get the desitination directory.

setTask

public void setTask(Task task)
Set the task which owns this tool
Specified by:
setTask in interface EJBDeploymentTool

getTask

protected Task getTask()
Get the task for this tool.

getBaseNameTerminator

protected java.lang.String getBaseNameTerminator()
Get the basename terminator.

getBaseJarName

protected java.lang.String getBaseJarName()
Get the base jar name.

getSrcDir

protected java.io.File getSrcDir()
Get the source dir.

getDescriptorDir

protected java.io.File getDescriptorDir()
Get the meta-inf dir.

usingBaseJarName

protected boolean usingBaseJarName()
Returns true, if the meta-inf dir is being explicitly set, false otherwise.

setGenericJarSuffix

public void setGenericJarSuffix(java.lang.String inString)
Setter used to store the suffix for the generated jar file.
Parameters:
inString - the string to use as the suffix.

configure

public void configure(java.io.File srcDir,
                      java.io.File descriptorDir,
                      java.lang.String baseNameTerminator,
                      java.lang.String baseJarName,
                      boolean flatDestDir)
Configure this tool for use in the ejbjar task.
Specified by:
configure in interface EJBDeploymentTool

addFileToJar

protected void addFileToJar(java.util.jar.JarOutputStream jStream,
                            java.io.FileInputStream iStream,
                            java.lang.String filename)
                     throws BuildException
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 the jar entry.
iStream - A FileInputStream from which to read the contents the file being added.
filename - A String representing the name, including all relevant path information, that should be stored for the entry being added.

getDescriptorHandler

protected DescriptorHandler getDescriptorHandler(java.io.File srcDir)

processDescriptor

public void processDescriptor(java.lang.String descriptorFileName,
                              javax.xml.parsers.SAXParser saxParser)
Description copied from interface: EJBDeploymentTool
Process a deployment descriptor, generating the necessary vendor specific deployment files.
Specified by:
processDescriptor in interface EJBDeploymentTool
Following copied from interface: org.apache.tools.ant.taskdefs.optional.ejb.EJBDeploymentTool
Parameters:
descriptorFilename - the name of the deployment descriptor
saxParser - a SAX parser which can be used to parse the deployment descriptor.

addVendorFiles

protected void addVendorFiles(java.util.Hashtable ejbFiles,
                              java.lang.String baseName)
Add any vendor specific files which should be included in the EJB Jar.

writeJar

protected void writeJar(java.lang.String baseName,
                        java.io.File jarfile,
                        java.util.Hashtable files)
                 throws BuildException
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.

validateConfigured

public void validateConfigured()
                        throws BuildException
Called to validate that the tool parameters have been configured.
Specified by:
validateConfigured in interface EJBDeploymentTool


Copyright © 2000 Apache Software Foundation. All Rights Reserved.