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

public Class WebsphereDeploymentTool

extends GenericDeploymentTool
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.nio.file.Files, java.util.Hashtable, .HashMap, .Map, java.util.jar.JarEntry, .JarFile, .JarOutputStream, java.util.stream.Collectors, java.util.zip.ZipEntry, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, org.apache.tools.ant.taskdefs.Java, org.apache.tools.ant.types.Environment, .Path, org.apache.tools.ant.util.FileUtils

WebSphere deployment tool that augments the ejbjar task. Searches for the WebSphere specific deployment descriptors and adds them to the final ejb jar file. WebSphere has two specific descriptors for session beans: and another two for container managed entity beans: In terms of WebSphere, the generation of container code and stubs is called 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

Modifier and TypeField and Description
private boolean
private boolean
codegen

true - Only generate the deployment code, do not run RMIC or Javac

private String
dbName

The name of the database to create.

private String
dbSchema

The name of the schema to create.

private String
dbVendor

The DB Vendor name, the EJB is persisted against

private String
ejb11DTD

Instance variable that stores the location of the ejb 1.1 DTD file.

private boolean
private static final FileUtils
private String
jarSuffix

Instance variable that stores the suffix for the WebSphere jarfile.

private boolean
keepGeneric

Instance variable that determines whether generic ejb jars are kept.

private boolean
newCMP

Indicates if the old CMP location convention is to be used.

private boolean
noinform

true - Disable informational messages

private boolean
novalidate

true - Disable the validation steps

private boolean
nowarn

true - Disable warning and informational messages

public static final String
PUBLICID_EJB11

ID for ejb 1.1

public static final String
PUBLICID_EJB20

ID for ejb 2.0

private boolean
quiet

true - Only output error messages, suppress informational messages

private String
rmicOptions

Additional options for RMIC

protected static final String
SCHEMA_DIR

Schema directory

private String
tempdir

the scratchdir for the ejbdeploy operation

private boolean
trace

true - Enable internal tracing

private boolean
use35MappingRules

true- Use the WebSphere 3.5 compatible mapping rules

protected static final String
protected static final String
protected static final String
protected static final String
private Path
wasClasspath

The classpath to the WebSphere classes.

private File
websphereHome

the home directory for WebSphere

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
protected void
addVendorFiles(Hashtable<String, File>
a hashtable entryname -> file.
ejbFiles
,
String
a prefix to use.
baseName
)

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

Add any vendor specific files which should be included in the EJB Jar.
private void
buildWebsphereJar(File
java.io.File representing the source (EJB1.1) jarfile.
sourceJar
,
File
java.io.File representing the destination, WebSphere jarfile.
destJar
)

Helper method invoked by execute() for each WebSphere jar to be built.

public Path

Returns:

the WebSphere classpath.
createWASClasspath
()

Get the classpath to the WebSphere classpaths.

protected ClassLoader

Returns:

a classloader for the jar file.
getClassLoaderFromJar
(File
java.io.File representing jar file to get classes from.
classjar
)

Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it.

protected DescriptorHandler
getDescriptorHandler(File
the source directory.
srcDir
)

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

Deprecated as a consequence of DescriptorHandler being deprecated.
Get a descriptionHandler..
protected String

Returns:

String
getOptions
()

Gets the options for the EJB Deploy operation

pack-priv 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.
protected DescriptorHandler

Returns:

the handler.
getWebsphereDescriptorHandler
(final File
the source directory.
srcDir
)

Deprecated as a consequence of DescriptorHandler being deprecated.
Get a description handler.
protected boolean

Returns:

true if a rebuild is required.
isRebuildRequired
(File
java.io.File The generic jar file.
genericJarFile
,
File
java.io.File The WebSphere jar file to check to see if it needs to be rebuilt.
websphereJarFile
)

Helper method to check to see if a WebSphere EJB 1.1 jar needs to be rebuilt using ejbdeploy.

public void
setCodegen(boolean
option
codegen
)

Flag, default false, to only generate the deployment code, do not run RMIC or Javac

public void
setDbname(String
name of the database
dbName
)

Sets the name of the Database to create; optional.

public void
setDbschema(String
name of the schema
dbSchema
)

Sets the name of the schema to create; optional.

public void
setDbvendor(String
database vendor type
dbvendor
)

Sets the DB Vendor for the Entity Bean mapping; optional.

public void
setEjbdeploy(boolean
a boolean value.
ejbdeploy
)

Decide, whether ejbdeploy should be called or not; optional, default true.

public void
setEJBdtd(String
the string to use as the DTD location.
inString
)

Setter used to store the location of the Sun's Generic EJB DTD.

public void
setKeepgeneric(boolean
either 'true' or 'false'.
inValue
)

This controls whether the generic file used as input to ejbdeploy is retained; optional, default false.

public void
setNewCMP(boolean
a boolean value.
newCMP
)

Set the value of the newCMP scheme.

public void
setNoinform(boolean
if true disables informational messages
noinform
)

Flag to disable informational messages; optional, default false.

public void
setNovalidate(boolean
option
novalidate
)

Flag to disable the validation steps; optional, default false.

public void
setNowarn(boolean
option
nowarn
)

Flag to disable warning and informational messages; optional, default false.

public void
setOldCMP(boolean
a boolean value.
oldCMP
)

Set the value of the oldCMP scheme.

public void
setQuiet(boolean
option
quiet
)

Flag, default true, to only output error messages.

public void
setRebuild(boolean
a boolean value.
rebuild
)

Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbdeploy; optional, default true.

public void
setRmicoptions(String
the options to use.
options
)

Set the rmic options.

public void
setSuffix(String
the string to use as the suffix.
inString
)

String value appended to the basename of the deployment descriptor to create the filename of the WebLogic EJB jar file.

public void
setTempdir(String
the directory name to use.
tempdir
)

The directory, where ejbdeploy will write temporary files; optional, defaults to '_ejbdeploy_temp'.

public void
setTrace(boolean
a boolean value.
trace
)

Flag to enable internal tracing when set, optional, default false.

public void
setUse35(boolean
a boolean value.
attr
)

Flag to use the WebSphere 3.5 compatible mapping rules; optional, default false.

public void
setWASClasspath(Path
the WebSphere classpath.
wasClasspath
)

Set the WebSphere classpath.

public void
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.
files
,
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:
addFileToJaraddSupportClassescheckAndAddDependantscheckConfigurationconfigurecreateClasspathgetClassLoaderForBuildgetCombinedClasspathgetConfiggetDestDirgetJarBaseNamegetLocationgetManifestFilegetPublicIdgetTaskgetVendorDDPrefixlogneedToRebuildparseEjbFilesprocessDescriptorregisterKnownDTDssetClasspathsetDestdirsetGenericJarSuffixsetTaskusingBaseJarName

Field Detail

alwaysRebuildback to summary
private boolean alwaysRebuild
codegenback to summary
private boolean codegen

true - Only generate the deployment code, do not run RMIC or Javac

dbNameback to summary
private String dbName

The name of the database to create. (For top-down mapping only)

dbSchemaback to summary
private String dbSchema

The name of the schema to create. (For top-down mappings only)

dbVendorback to summary
private String dbVendor

The DB Vendor name, the EJB is persisted against

ejb11DTDback to summary
private String ejb11DTD

Instance variable that stores the location of the ejb 1.1 DTD file.

ejbdeployback to summary
private boolean ejbdeploy
FILE_UTILSback to summary
private static final FileUtils FILE_UTILS
jarSuffixback to summary
private String jarSuffix

Instance variable that stores the suffix for the WebSphere jarfile.

keepGenericback to summary
private boolean keepGeneric

Instance variable that determines whether generic ejb jars are kept.

newCMPback to summary
private boolean newCMP

Indicates if the old CMP location convention is to be used.

noinformback to summary
private boolean noinform

true - Disable informational messages

novalidateback to summary
private boolean novalidate

true - Disable the validation steps

nowarnback to summary
private boolean nowarn

true - Disable warning and informational messages

PUBLICID_EJB11back to summary
public static final String PUBLICID_EJB11

ID for ejb 1.1

PUBLICID_EJB20back to summary
public static final String PUBLICID_EJB20

ID for ejb 2.0

quietback to summary
private boolean quiet

true - Only output error messages, suppress informational messages

rmicOptionsback to summary
private String rmicOptions

Additional options for RMIC

SCHEMA_DIRback to summary
protected static final String SCHEMA_DIR

Schema directory

tempdirback to summary
private String tempdir

the scratchdir for the ejbdeploy operation

traceback to summary
private boolean trace

true - Enable internal tracing

use35MappingRulesback to summary
private boolean use35MappingRules

true- Use the WebSphere 3.5 compatible mapping rules

WAS_BNDback to summary
protected static final String WAS_BND
WAS_CMP_MAPback to summary
protected static final String WAS_CMP_MAP
WAS_CMP_SCHEMAback to summary
protected static final String WAS_CMP_SCHEMA
WAS_EXTback to summary
protected static final String WAS_EXT
wasClasspathback to summary
private Path wasClasspath

The classpath to the WebSphere classes.

websphereHomeback to summary
private File websphereHome

the home directory for WebSphere

Constructor Detail

WebsphereDeploymentToolback to summary
public WebsphereDeploymentTool()

Method Detail

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

Overrides 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.

baseName:String

a prefix to use.

Annotations
@Override
buildWebsphereJarback to summary
private void buildWebsphereJar(File sourceJar, File destJar)

Helper method invoked by execute() for each WebSphere jar to be built. Encapsulates the logic of constructing a java task for calling websphere.ejbdeploy and executing it.

Parameters
sourceJar:File

java.io.File representing the source (EJB1.1) jarfile.

destJar:File

java.io.File representing the destination, WebSphere jarfile.

createWASClasspathback to summary
public Path createWASClasspath()

Get the classpath to the WebSphere classpaths.

Returns:Path

the WebSphere classpath.

getClassLoaderFromJarback to summary
protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException

Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it.

Parameters
classjar:File

java.io.File representing jar file to get classes from.

Returns:ClassLoader

a classloader for the jar file.

Exceptions
IOException:
if there is an error.
getDescriptorHandlerback to summary
protected DescriptorHandler getDescriptorHandler(File srcDir)

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

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

Deprecated

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

Get a descriptionHandler..

Parameters
srcDir:File

the source directory.

Returns:DescriptorHandler

a handler.

Annotations
@Override
getOptionsback to summary
protected String getOptions()

Gets the options for the EJB Deploy operation

Returns:String

String

getVendorOutputJarFileback to summary
pack-priv File getVendorOutputJarFile(String baseName)

Overrides 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

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

the basename to use.

Returns:File

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

File

Annotations
@Override
getWebsphereDescriptorHandlerback to summary
protected DescriptorHandler getWebsphereDescriptorHandler(final File srcDir)

Deprecated

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

Get a description handler.

Parameters
srcDir:File

the source directory.

Returns:DescriptorHandler

the handler.

isRebuildRequiredback to summary
protected boolean isRebuildRequired(File genericJarFile, File websphereJarFile)

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:File

java.io.File The generic jar file.

websphereJarFile:File

java.io.File The WebSphere jar file to check to see if it needs to be rebuilt.

Returns:boolean

true if a rebuild is required.

setCodegenback to summary
public void setCodegen(boolean codegen)

Flag, default false, to only generate the deployment code, do not run RMIC or Javac

Parameters
codegen:boolean

option

setDbnameback to summary
public void setDbname(String dbName)

Sets the name of the Database to create; optional.

Parameters
dbName:String

name of the database

setDbschemaback to summary
public void setDbschema(String dbSchema)

Sets the name of the schema to create; optional.

Parameters
dbSchema:String

name of the schema

setDbvendorback to summary
public void setDbvendor(String dbvendor)

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] -help

This 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:String

database vendor type

setEjbdeployback to summary
public void setEjbdeploy(boolean ejbdeploy)

Decide, whether ejbdeploy should be called or not; optional, default true.

Parameters
ejbdeploy:boolean

a boolean value.

setEJBdtdback to summary
public void setEJBdtd(String inString)

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:String

the string to use as the DTD location.

setKeepgenericback to summary
public void setKeepgeneric(boolean inValue)

This controls whether the generic file used as input to ejbdeploy is retained; optional, default false.

Parameters
inValue:boolean

either 'true' or 'false'.

setNewCMPback to summary
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:boolean

a boolean value.

setNoinformback to summary
public void setNoinform(boolean noinform)

Flag to disable informational messages; optional, default false.

Parameters
noinform:boolean

if true disables informational messages

setNovalidateback to summary
public void setNovalidate(boolean novalidate)

Flag to disable the validation steps; optional, default false.

Parameters
novalidate:boolean

option

setNowarnback to summary
public void setNowarn(boolean nowarn)

Flag to disable warning and informational messages; optional, default false.

Parameters
nowarn:boolean

option

setOldCMPback to summary
public void setOldCMP(boolean oldCMP)

Set the value of the oldCMP scheme. This is an antonym for newCMP

Parameters
oldCMP:boolean

a boolean value.

setQuietback to summary
public void setQuiet(boolean quiet)

Flag, default true, to only output error messages.

Parameters
quiet:boolean

option

setRebuildback to summary
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:boolean

a boolean value.

setRmicoptionsback to summary
public void setRmicoptions(String options)

Set the rmic options.

Parameters
options:String

the options to use.

setSuffixback to summary
public void setSuffix(String inString)

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:String

the string to use as the suffix.

setTempdirback to summary
public void setTempdir(String tempdir)

The directory, where ejbdeploy will write temporary files; optional, defaults to '_ejbdeploy_temp'.

Parameters
tempdir:String

the directory name to use.

setTraceback to summary
public void setTrace(boolean trace)

Flag to enable internal tracing when set, optional, default false.

Parameters
trace:boolean

a boolean value.

setUse35back to summary
public void setUse35(boolean attr)

Flag to use the WebSphere 3.5 compatible mapping rules; optional, default false.

Parameters
attr:boolean

a boolean value.

setWASClasspathback to summary
public void setWASClasspath(Path wasClasspath)

Set the WebSphere classpath.

Parameters
wasClasspath:Path

the WebSphere classpath.

validateConfiguredback to summary
public void validateConfigured() throws BuildException

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

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

Called to validate that the tool parameters have been configured.

Annotations
@Override
Exceptions
BuildException:
if there is an error.
writeJarback to summary
protected void writeJar(String baseName, File jarFile, Hashtable<String, File> files, 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.

files: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.