Class WebsphereDeploymentTool
- All Implemented Interfaces:
EJBDeploymentTool
- ibm-ejb-jar-bnd.xmi
- ibm-ejb-jar-ext.xmi
- Map.mapxmi
- Schema.dbxmi
deployment. This step can be performed by the websphere
element as part of the jar generation process. If the switch
ejbdeploy is on, the ejbdeploy tool from the WebSphere toolset
is called for every ejb-jar. Unfortunately, this step only works, if you
use the ibm jdk. Otherwise, the rmic (called by ejbdeploy) throws a
ClassFormatError. Be sure to switch ejbdeploy off, if run ant with
sun jdk.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringID for ejb 1.1static final StringID for ejb 2.0protected static final StringSchema directoryprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class GenericDeploymentTool
ANALYZER_CLASS_FULL, ANALYZER_CLASS_SUPER, ANALYZER_FULL, ANALYZER_NONE, ANALYZER_SUPER, DEFAULT_ANALYZER, DEFAULT_BUFFER_SIZE, EJB_DD, JAR_COMPRESS_LEVEL, MANIFEST, META_DIRModifier and TypeFieldDescriptionstatic final StringThe analyzer class for the super analyzerstatic final StringThe analyzer class for the super analyzerstatic final StringA dependency analyzer name to find all related classesstatic final StringA dependency analyzer name for no analyzerstatic final StringA dependency analyzer name to find ancestor classesstatic final StringThe default analyzerstatic final intThe default buffer byte size to use for IOprotected static final StringName for EJB Deployment descriptor within EJB jarsstatic final intThe level to use for compressionprotected static final StringThe standard MANIFEST fileprotected static final StringThe standard META-INF directory in jar files -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddVendorFiles(Hashtable<String, File> ejbFiles, String baseName) Add any vendor specific files which should be included in the EJB Jar.Get the classpath to the WebSphere classpaths.protected ClassLoadergetClassLoaderFromJar(File classjar) Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it.protected DescriptorHandlergetDescriptorHandler(File srcDir) Get a descriptionHandler.protected StringGets the options for the EJB Deploy operationprotected DescriptorHandlergetWebsphereDescriptorHandler(File srcDir) Get a description handler.protected booleanisRebuildRequired(File genericJarFile, File websphereJarFile) Helper method to check to see if a WebSphere EJB 1.1 jar needs to be rebuilt using ejbdeploy.voidsetCodegen(boolean codegen) Flag, default false, to only generate the deployment code, do not run RMIC or JavacvoidSets the name of the Database to create; optional.voidsetDbschema(String dbSchema) Sets the name of the schema to create; optional.voidsetDbvendor(String dbvendor) Sets the DB Vendor for the Entity Bean mapping; optional.voidsetEjbdeploy(boolean ejbdeploy) Decide, whether ejbdeploy should be called or not; optional, default true.voidSetter used to store the location of the Sun's Generic EJB DTD.voidsetKeepgeneric(boolean inValue) This controls whether the generic file used as input to ejbdeploy is retained; optional, default false.voidsetNewCMP(boolean newCMP) Set the value of the newCMP scheme.voidsetNoinform(boolean noinform) Flag to disable informational messages; optional, default false.voidsetNovalidate(boolean novalidate) Flag to disable the validation steps; optional, default false.voidsetNowarn(boolean nowarn) Flag to disable warning and informational messages; optional, default false.voidsetOldCMP(boolean oldCMP) Set the value of the oldCMP scheme.voidsetQuiet(boolean quiet) Flag, default true, to only output error messages.voidsetRebuild(boolean rebuild) Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbdeploy; optional, default true.voidsetRmicoptions(String options) Set the rmic options.voidString value appended to the basename of the deployment descriptor to create the filename of the WebLogic EJB jar file.voidsetTempdir(String tempdir) The directory, where ejbdeploy will write temporary files; optional, defaults to '_ejbdeploy_temp'.voidsetTrace(boolean trace) Flag to enable internal tracing when set, optional, default false.voidsetUse35(boolean attr) Flag to use the WebSphere 3.5 compatible mapping rules; optional, default false.voidsetWASClasspath(Path wasClasspath) Set the WebSphere classpath.voidCalled to validate that the tool parameters have been configured.protected voidMethod used to encapsulate the writing of the JAR file.Methods inherited from class GenericDeploymentTool
addFileToJar, addSupportClasses, checkAndAddDependants, checkConfiguration, configure, createClasspath, getClassLoaderForBuild, getCombinedClasspath, getConfig, getDestDir, getJarBaseName, getLocation, getManifestFile, getPublicId, getTask, getVendorDDPrefix, log, needToRebuild, parseEjbFiles, processDescriptor, registerKnownDTDs, setClasspath, setDestdir, setGenericJarSuffix, setTask, usingBaseJarNameModifier and TypeMethodDescriptionprotected voidaddFileToJar(JarOutputStream jStream, File inputFile, String logicalFilename) Utility method that encapsulates the logic of adding a file entry to a .jar file.protected voidaddSupportClasses(Hashtable<String, File> ejbFiles) Adds any classes the user specifies using support nested elements to theejbFilesHashtable.protected voidcheckAndAddDependants(Hashtable<String, File> checkEntries) Add all available classes, that depend on Remote, Home, Bean, PKprotected voidcheckConfiguration(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.voidconfigure(org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.Config config) Configure this tool for use in the ejbjar task.Add the classpath for the user classesprotected ClassLoaderReturns a Classloader object which parses the passed in generic EjbJar classpath.protected PathGet 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.ConfigGet the basename terminator.protected FileGet the destination directory.protected StringgetJarBaseName(String descriptorFileName) Using the EJB descriptor file name passed from theejbjartask, this method returns the "basename" which will be used to name the completed JAR file.protected LocationGet the build file location associated with this element's task.protected FilegetManifestFile(String prefix) Get the manifest file to use for building the generic jar.protected StringReturns the Public ID of the DTD specified in the EJB descriptor.protected TaskgetTask()Get the task for this tool.getVendorDDPrefix(String baseName, String descriptorFileName) Get the prefix for vendor deployment descriptors.protected voidLog a message to the Ant output.protected booleanneedToRebuild(Hashtable<String, File> ejbFiles, File jarFile) This method checks the timestamp on each file listed in theejbFilesand compares them to the timestamp on thejarFile.parseEjbFiles(String descriptorFileName, SAXParser saxParser) This method returns a list of EJB files found when the specified EJB descriptor is parsed and processed.voidprocessDescriptor(String descriptorFileName, SAXParser saxParser) Process a deployment descriptor, generating the necessary vendor specific deployment files.protected voidregisterKnownDTDs(DescriptorHandler handler) Register the locations of all known DTDs.voidsetClasspath(Path classpath) Set the classpath to be used for this compilation.voidsetDestdir(File inDir) Set the destination directory; required.voidsetGenericJarSuffix(String inString) Set the suffix for the generated jar file.voidSet the task which owns this toolprotected booleanIndicate if this build is using the base jar name.
-
Field Details
-
PUBLICID_EJB11
-
PUBLICID_EJB20
-
SCHEMA_DIR
-
WAS_EXT
- See Also:
-
WAS_BND
- See Also:
-
WAS_CMP_MAP
- See Also:
-
WAS_CMP_SCHEMA
- See Also:
-
-
Constructor Details
-
WebsphereDeploymentTool
public WebsphereDeploymentTool()
-
-
Method Details
-
createWASClasspath
Get the classpath to the WebSphere classpaths.- Returns:
- the WebSphere classpath.
-
setWASClasspath
Set the WebSphere classpath.- Parameters:
wasClasspath- the WebSphere classpath.
-
setDbvendor
Sets the DB Vendor for the Entity Bean mapping; optional.Valid options can be obtained by running the following command:
<WAS_HOME>/bin/EJBDeploy.[sh/bat] -helpThis is also used to determine the name of the Map.mapxmi and Schema.dbxmi files, for example Account-DB2UDB_V81-Map.mapxmi and Account-DB2UDB_V81-Schema.dbxmi.
- Parameters:
dbvendor- database vendor type
-
setDbname
Sets the name of the Database to create; optional.- Parameters:
dbName- name of the database
-
setDbschema
Sets the name of the schema to create; optional.- Parameters:
dbSchema- name of the schema
-
setCodegen
public void setCodegen(boolean codegen) Flag, default false, to only generate the deployment code, do not run RMIC or Javac- Parameters:
codegen- option
-
setQuiet
public void setQuiet(boolean quiet) Flag, default true, to only output error messages.- Parameters:
quiet- option
-
setNovalidate
public void setNovalidate(boolean novalidate) Flag to disable the validation steps; optional, default false.- Parameters:
novalidate- option
-
setNowarn
public void setNowarn(boolean nowarn) Flag to disable warning and informational messages; optional, default false.- Parameters:
nowarn- option
-
setNoinform
public void setNoinform(boolean noinform) Flag to disable informational messages; optional, default false.- Parameters:
noinform- if true disables informational messages
-
setTrace
public void setTrace(boolean trace) Flag to enable internal tracing when set, optional, default false.- Parameters:
trace- abooleanvalue.
-
setRmicoptions
Set the rmic options.- Parameters:
options- the options to use.
-
setUse35
public void setUse35(boolean attr) Flag to use the WebSphere 3.5 compatible mapping rules; optional, default false.- Parameters:
attr- abooleanvalue.
-
setRebuild
public void setRebuild(boolean rebuild) Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbdeploy; optional, default true.- Parameters:
rebuild- abooleanvalue.
-
setSuffix
String value appended to the basename of the deployment descriptor to create the filename of the WebLogic EJB jar file. Optional, default '.jar'.- Parameters:
inString- the string to use as the suffix.
-
setKeepgeneric
public void setKeepgeneric(boolean inValue) This controls whether the generic file used as input to ejbdeploy is retained; optional, default false.- Parameters:
inValue- either 'true' or 'false'.
-
setEjbdeploy
public void setEjbdeploy(boolean ejbdeploy) Decide, whether ejbdeploy should be called or not; optional, default true.- Parameters:
ejbdeploy- abooleanvalue.
-
setEJBdtd
Setter used to store the location of the Sun's Generic EJB DTD. This can be a file on the system or a resource on the classpath.- Parameters:
inString- the string to use as the DTD location.
-
setOldCMP
public void setOldCMP(boolean oldCMP) Set the value of the oldCMP scheme. This is an antonym for newCMP- Parameters:
oldCMP- abooleanvalue.
-
setNewCMP
public void setNewCMP(boolean newCMP) Set the value of the newCMP scheme. The old CMP scheme locates the WebSphere CMP descriptor based on the naming convention where the WebSphere CMP file is expected to be named with the bean name as the prefix. Under this scheme the name of the CMP descriptor does not match the name actually used in the main WebSphere EJB descriptor. Also, descriptors which contain multiple CMP references could not be used.- Parameters:
newCMP- abooleanvalue.
-
setTempdir
The directory, where ejbdeploy will write temporary files; optional, defaults to '_ejbdeploy_temp'.- Parameters:
tempdir- the directory name to use.
-
getDescriptorHandler
Get a descriptionHandler..- Overrides:
getDescriptorHandlerin classGenericDeploymentTool- Parameters:
srcDir- the source directory.- Returns:
- a handler.
-
getWebsphereDescriptorHandler
Get a description handler.- Parameters:
srcDir- the source directory.- Returns:
- the handler.
-
addVendorFiles
Add any vendor specific files which should be included in the EJB Jar.- Overrides:
addVendorFilesin classGenericDeploymentTool- Parameters:
ejbFiles- a hashtable entryname -> file.baseName- a prefix to use.
-
getOptions
-
writeJar
protected void writeJar(String baseName, File jarFile, Hashtable<String, File> files, String publicId) throws BuildExceptionMethod 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..- Overrides:
writeJarin classGenericDeploymentTool- Parameters:
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.- Throws:
BuildException- if there is a problem.
-
validateConfigured
Called to validate that the tool parameters have been configured.- Specified by:
validateConfiguredin interfaceEJBDeploymentTool- Overrides:
validateConfiguredin classGenericDeploymentTool- Throws:
BuildException- if there is an error.
-
isRebuildRequired
Helper method to check to see if a WebSphere EJB 1.1 jar needs to be rebuilt using ejbdeploy. Called from writeJar it sees if the "Bean" classes are the only thing that needs to be updated and either updates the Jar with the Bean classfile or returns true, saying that the whole WebSphere jar needs to be regenerated with ejbdeploy. This allows faster build times for working developers.The way WebSphere ejbdeploy works is it creates wrappers for the publicly defined methods as they are exposed in the remote interface. If the actual bean changes without changing the the method signatures then only the bean classfile needs to be updated and the rest of the WebSphere jar file can remain the same. If the Interfaces, ie. the method signatures change or if the xml deployment descriptors changed, the whole jar needs to be rebuilt with ejbdeploy. This is not strictly true for the xml files. If the JNDI name changes then the jar doesn't have to be rebuild, but if the resources references change then it does. At this point the WebSphere jar gets rebuilt if the xml files change at all.
- Parameters:
genericJarFile- java.io.File The generic jar file.websphereJarFile- java.io.File The WebSphere jar file to check to see if it needs to be rebuilt.- Returns:
- true if a rebuild is required.
-
getClassLoaderFromJar
Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it.- Parameters:
classjar- java.io.File representing jar file to get classes from.- Returns:
- a classloader for the jar file.
- Throws:
IOException- if there is an error.
-