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

public Class WeblogicDeploymentTool

extends GenericDeploymentTool
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.optional.ejb.WeblogicTOPLinkDeploymentTool
Imports
java.io.File, .IOException, .InputStream, java.nio.file.Files, java.util.Hashtable, .HashMap, .List, .Map, .Vector, java.util.jar.JarEntry, .JarFile, .JarOutputStream, java.util.stream.Collectors, java.util.zip.ZipEntry, javax.xml.parsers.SAXParser, .SAXParserFactory, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, org.apache.tools.ant.taskdefs.Java, org.apache.tools.ant.types.Environment, .Environment.Variable, .Path, org.apache.tools.ant.util.FileUtils, org.xml.sax.InputSource

The weblogic element is used to control the weblogic.ejbc compiler for generating WebLogic EJB jars. Prior to Ant 1.3, the method of locating CMP descriptors was to use the ejbjar naming convention. So if your ejb-jar was called, Customer-ejb-jar.xml, your WebLogic descriptor was called Customer- weblogic-ejb-jar.xml and your CMP descriptor had to be Customer-weblogic-cmp- rdbms-jar.xml. In addition, the <type-storage> element in the WebLogic descriptor had to be set to the standard name META-INF/weblogic-cmp-rdbms- jar.xml, as that is where the CMP descriptor was mapped to in the generated jar.

Field Summary

Modifier and TypeField and Description
private String
private String
additionalJvmArgs

additional args to pass to the spawned jvm

private boolean
private String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
DEFAULT_WL51_EJB11_DTD_LOCATION

WebLogic 5.1 dtd location

protected static final String
protected static final String
protected static final String
DEFAULT_WL60_EJB11_DTD_LOCATION

WebLogic 6.0 ejb 1.1 dtd location

protected static final String
DEFAULT_WL60_EJB20_DTD_LOCATION

WebLogic 6.0 ejb 2.0 dtd location

protected static final String
private String
ejb11DTD

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

private String
ejbcClass

Instance variable that stores the fully qualified classname of the WebLogic EJBC compiler

private static final FileUtils
FILE_UTILS

File utilities instance for copying jars

private String
jarSuffix

Instance variable that stores the suffix for the WebLogic jarfile.

private Integer
jvmDebugLevel

The weblogic.StdoutSeverityLevel to use when running the JVM that executes ejbc.

private boolean
keepgenerated

Instance variable that determines whether generic ejb jars are kept.

private boolean
private boolean
newCMP

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

private boolean
noEJBC

controls whether ejbc is run on the generated jar

private File
public static final String
public static final String
public static final String
PUBLICID_WEBLOGIC_EJB510

WebLogic 5.1.0 id

public static final String
PUBLICID_WEBLOGIC_EJB600

WebLogic 6.0.0 id

public static final String
PUBLICID_WEBLOGIC_EJB700

WebLogic 7.0.0 id

private List<Environment.Variable>
sysprops

System properties for the JVM.

private String
weblogicDTD

Instance variable that stores the location of the WebLogic DTD file.

protected static final String
protected static final String
private Path
wlClasspath

The classpath to the WebLogic classes.

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
public void
addSysproperty(Environment.Variable
the element to add.
sysp
)

Add a nested sysproperty element.

protected void
addVendorFiles(Hashtable<String, File>
the hash table to be populated.
ejbFiles
,
String
the prefix to use.
ddPrefix
)

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
buildWeblogicJar(File
java.io.File representing the source (EJB1.1) jarfile.
sourceJar
,
File
java.io.File representing the destination, WebLogic jarfile.
destJar
,
String publicId)

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

public Path

Returns:

the classpath to configure.
createWLClasspath
()

Get the classpath to the WebLogic classpaths.

protected ClassLoader

Returns:

the classloader for the jarfile.
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.

public String

Returns:

the name of the ejbc compiler class.
getEjbcClass
()

Get the ejbc compiler class.

public Integer

Returns:

the jvm debug level (may be null).
getJvmDebugLevel
()

Get the debug level.

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 descriptor.
getWeblogicDescriptorHandler
(final File
the source directory.
srcDir
)

Deprecated as a consequence of DescriptorHandler being deprecated.
Get the WebLogic descriptor handler.
protected boolean

Returns:

true if the jar needs to be rebuilt.
isRebuildRequired
(File
java.io.File The generic jar file.
genericJarFile
,
File
java.io.File The WebLogic jar file to check to see if it needs to be rebuilt.
weblogicJarFile
)

Helper method to check to see if a WebLogic EJB 1.1 jar needs to be rebuilt using ejbc.

protected void
registerKnownDTDs(DescriptorHandler
the handler to use.
handler
)

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

Deprecated as a consequence of DescriptorHandler being deprecated.
Register the DTDs.
public void
setArgs(String
extra arguments to pass to the ejbc tool.
args
)

Any optional extra arguments pass to the weblogic.ejbc tool.

public void
setCompiler(String
the compiler to be used.
compiler
)

The compiler (switch -compiler) to use; optional.

public void
setEjbcClass(String
the name of the class to use.
ejbcClass
)

Set the classname of the ejbc compiler; optional Normally ejbjar determines the appropriate class based on the DTD used for the EJB.

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

Deprecated.

public void
setJvmargs(String
the arguments to be passed to the JVM
args
)

Set any additional arguments to pass to the WebLogic JVM; optional.

public void
setJvmDebugLevel(Integer
the value to use.
jvmDebugLevel
)

Sets the weblogic.StdoutSeverityLevel to use when running the JVM that executes ejbc; optional.

public void
setKeepgenerated(String
either 'true' or 'false'
inValue
)

Controls whether WebLogic will keep the generated Java files used to build the class files added to the jar.

public void
setKeepgeneric(boolean
true for keep generic
inValue
)

controls whether the generic file used as input to ejbc is retained; defaults to false

public void
setNewCMP(boolean
a boolean value.
newCMP
)

If this is set to true, the new method for locating CMP descriptors will be used; optional, default false.

public void
setNoEJBC(boolean
a boolean value.
noEJBC
)

Do not EJBC the jar after it has been put together; optional, default false

public void
setOldCMP(boolean
a boolean value.
oldCMP
)

Set the value of the oldCMP scheme.

public void
setOutputDir(File
the directory to be used.
outputDir
)

If set ejbc will use this directory as the output destination rather than a jar file.

public void
setRebuild(boolean
a boolean value.
rebuild
)

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

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

Setter used to store the suffix for the generated WebLogic jar file.

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

Deprecated.

public void
setWLClasspath(Path
the path to be used.
wlClasspath
)

Optional classpath to WL6.0.

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

Deprecated.

public void
protected void
writeJar(String
the base name.
baseName
,
File
the jar file to populate.
jarFile
,
Hashtable<String, File>
the hash table of files to write.
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:
addFileToJaraddSupportClassescheckAndAddDependantscheckConfigurationconfigurecreateClasspathgetClassLoaderForBuildgetCombinedClasspathgetConfiggetDescriptorHandlergetDestDirgetJarBaseNamegetLocationgetManifestFilegetPublicIdgetTaskgetVendorDDPrefixlogneedToRebuildparseEjbFilesprocessDescriptorsetClasspathsetDestdirsetGenericJarSuffixsetTaskusingBaseJarName

Field Detail

additionalArgsback to summary
private String additionalArgs
additionalJvmArgsback to summary
private String additionalJvmArgs

additional args to pass to the spawned jvm

alwaysRebuildback to summary
private boolean alwaysRebuild
compilerback to summary
private String compiler
COMPILER_EJB11back to summary
protected static final String COMPILER_EJB11
COMPILER_EJB20back to summary
protected static final String COMPILER_EJB20
DEFAULT_COMPILERback to summary
protected static final String DEFAULT_COMPILER
DEFAULT_WL51_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL51_DTD_LOCATION
DEFAULT_WL51_EJB11_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL51_EJB11_DTD_LOCATION

WebLogic 5.1 dtd location

DEFAULT_WL60_51_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL60_51_DTD_LOCATION
DEFAULT_WL60_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL60_DTD_LOCATION
DEFAULT_WL60_EJB11_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL60_EJB11_DTD_LOCATION

WebLogic 6.0 ejb 1.1 dtd location

DEFAULT_WL60_EJB20_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL60_EJB20_DTD_LOCATION

WebLogic 6.0 ejb 2.0 dtd location

DEFAULT_WL70_DTD_LOCATIONback to summary
protected static final String DEFAULT_WL70_DTD_LOCATION
ejb11DTDback to summary
private String ejb11DTD

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

ejbcClassback to summary
private String ejbcClass

Instance variable that stores the fully qualified classname of the WebLogic EJBC compiler

FILE_UTILSback to summary
private static final FileUtils FILE_UTILS

File utilities instance for copying jars

jarSuffixback to summary
private String jarSuffix

Instance variable that stores the suffix for the WebLogic jarfile.

jvmDebugLevelback to summary
private Integer jvmDebugLevel

The weblogic.StdoutSeverityLevel to use when running the JVM that executes ejbc. Set to 16 to avoid the warnings about EJB Home and Remotes being in the classpath

keepgeneratedback to summary
private boolean keepgenerated

Instance variable that determines whether generic ejb jars are kept.

keepGenericback to summary
private boolean keepGeneric
newCMPback to summary
private boolean newCMP

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

noEJBCback to summary
private boolean noEJBC

controls whether ejbc is run on the generated jar

outputDirback to summary
private File outputDir
PUBLICID_EJB11back to summary
public static final String PUBLICID_EJB11

EJB11 id

PUBLICID_EJB20back to summary
public static final String PUBLICID_EJB20

EJB20 id

PUBLICID_WEBLOGIC_EJB510back to summary
public static final String PUBLICID_WEBLOGIC_EJB510

WebLogic 5.1.0 id

PUBLICID_WEBLOGIC_EJB600back to summary
public static final String PUBLICID_WEBLOGIC_EJB600

WebLogic 6.0.0 id

PUBLICID_WEBLOGIC_EJB700back to summary
public static final String PUBLICID_WEBLOGIC_EJB700

WebLogic 7.0.0 id

syspropsback to summary
private List<Environment.Variable> sysprops

System properties for the JVM.

weblogicDTDback to summary
private String weblogicDTD

Instance variable that stores the location of the WebLogic DTD file.

WL_CMP_DDback to summary
protected static final String WL_CMP_DD
WL_DDback to summary
protected static final String WL_DD
wlClasspathback to summary
private Path wlClasspath

The classpath to the WebLogic classes.

Constructor Detail

WeblogicDeploymentToolback to summary
public WeblogicDeploymentTool()

Method Detail

addSyspropertyback to summary
public void addSysproperty(Environment.Variable sysp)

Add a nested sysproperty element.

Parameters
sysp:Environment.Variable

the element to add.

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

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>

the hash table to be populated.

ddPrefix:String

the prefix to use.

Annotations
@Override
buildWeblogicJarback to summary
private void buildWeblogicJar(File sourceJar, File destJar, String publicId)

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

Parameters
sourceJar:File

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

destJar:File

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

createWLClasspathback to summary
public Path createWLClasspath()

Get the classpath to the WebLogic classpaths.

Returns:Path

the classpath to configure.

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

the classloader for the jarfile.

Exceptions
IOException:
if there is a problem.
getEjbcClassback to summary
public String getEjbcClass()

Get the ejbc compiler class.

Returns:String

the name of the ejbc compiler class.

getJvmDebugLevelback to summary
public Integer getJvmDebugLevel()

Get the debug level.

Returns:Integer

the jvm debug level (may be null).

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
getWeblogicDescriptorHandlerback to summary
protected DescriptorHandler getWeblogicDescriptorHandler(final File srcDir)

Deprecated

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

Get the WebLogic descriptor handler.

Parameters
srcDir:File

the source directory.

Returns:DescriptorHandler

the descriptor.

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

Helper method to check to see if a WebLogic EJB 1.1 jar needs to be rebuilt using ejbc. 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 WebLogic jar needs to be regenerated with ejbc. This allows faster build times for working developers.

The way WebLogic ejbc 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 WebLogic 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 ejbc. 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 WebLogic jar gets rebuilt if the xml files change at all.

Parameters
genericJarFile:File

java.io.File The generic jar file.

weblogicJarFile:File

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

Returns:boolean

true if the jar needs to be rebuilt.

registerKnownDTDsback to summary
protected void registerKnownDTDs(DescriptorHandler handler)

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

Deprecated

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

Register the DTDs.

Parameters
handler:DescriptorHandler

the handler to use.

Annotations
@Override
setArgsback to summary
public void setArgs(String args)

Any optional extra arguments pass to the weblogic.ejbc tool.

Parameters
args:String

extra arguments to pass to the ejbc tool.

setCompilerback to summary
public void setCompiler(String compiler)

The compiler (switch -compiler) to use; optional. This allows for the selection of a different compiler to be used for the compilation of the generated Java files. This could be set, for example, to Jikes to compile with the Jikes compiler. If this is not set and the build.compiler property is set to jikes, the Jikes compiler will be used. If this is not desired, the value "default" may be given to use the default compiler.

Parameters
compiler:String

the compiler to be used.

setEjbcClassback to summary
public void setEjbcClass(String ejbcClass)

Set the classname of the ejbc compiler; optional Normally ejbjar determines the appropriate class based on the DTD used for the EJB. The EJB 2.0 compiler featured in WebLogic 6 has, however, been deprecated in version 7. When using with version 7 this attribute should be set to "weblogic.ejbc" to avoid the deprecation warning.

Parameters
ejbcClass:String

the name of the class to use.

setEJBdtdback to summary
public void setEJBdtd(String inString)

Deprecated. Defines the location of Sun's EJB DTD in the WebLogic class hierarchy. Should not be needed, and the nested <dtd> element is recommended when it is.

Parameters
inString:String

the string to use as the DTD location.

setJvmargsback to summary
public void setJvmargs(String args)

Set any additional arguments to pass to the WebLogic JVM; optional.

Parameters
args:String

the arguments to be passed to the JVM

setJvmDebugLevelback to summary
public void setJvmDebugLevel(Integer jvmDebugLevel)

Sets the weblogic.StdoutSeverityLevel to use when running the JVM that executes ejbc; optional. Set to 16 to avoid the warnings about EJB Home and Remotes being in the classpath

Parameters
jvmDebugLevel:Integer

the value to use.

setKeepgeneratedback to summary
public void setKeepgenerated(String inValue)

Controls whether WebLogic will keep the generated Java files used to build the class files added to the jar. This can be useful when debugging; default is false.

Parameters
inValue:String

either 'true' or 'false'

setKeepgenericback to summary
public void setKeepgeneric(boolean inValue)

controls whether the generic file used as input to ejbc is retained; defaults to false

Parameters
inValue:boolean

true for keep generic

setNewCMPback to summary
public void setNewCMP(boolean newCMP)

If this is set to true, the new method for locating CMP descriptors will be used; optional, default false.

The old CMP scheme locates the WebLogic CMP descriptor based on the naming convention where the WebLogic 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 WebLogic EJB descriptor. Also, descriptors which contain multiple CMP references could not be used.

Parameters
newCMP:boolean

a boolean value.

setNoEJBCback to summary
public void setNoEJBC(boolean noEJBC)

Do not EJBC the jar after it has been put together; optional, default false

Parameters
noEJBC:boolean

a boolean value.

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.

setOutputDirback to summary
public void setOutputDir(File outputDir)

If set ejbc will use this directory as the output destination rather than a jar file. This allows for the generation of "exploded" jars.

Parameters
outputDir:File

the directory to be used.

setRebuildback to summary
public void setRebuild(boolean rebuild)

Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbc; optional, default true. This flag controls whether weblogic.ejbc is always invoked to build the jar file. In certain circumstances, such as when only a bean class has been changed, the jar can be generated by merely replacing the changed classes and not rerunning ejbc. Setting this to false will reduce the time to run ejbjar.

Parameters
rebuild:boolean

a boolean value.

setSuffixback to summary
public void setSuffix(String inString)

Setter used to store the suffix for the generated WebLogic jar file.

Parameters
inString:String

the string to use as the suffix.

setWeblogicdtdback to summary
public void setWeblogicdtd(String inString)

Deprecated. Defines the location of the ejb-jar DTD in the WebLogic class hierarchy. Should not be needed, and the nested <dtd> element is recommended when it is.

Parameters
inString:String

the string to use as the DTD location.

setWLClasspathback to summary
public void setWLClasspath(Path wlClasspath)

Optional classpath to WL6.0. WebLogic 6.0 will give a warning if the home and remote interfaces of a bean are on the system classpath used to run weblogic.ejbc. In that case, the standard WebLogic classes should be set with this attribute (or equivalent nested element) and the home and remote interfaces located with the standard classpath attribute.

Parameters
wlClasspath:Path

the path to be used.

setWLdtdback to summary
public void setWLdtd(String inString)

Deprecated. Defines the location of WebLogic DTD in the WebLogic class hierarchy. Should not be needed, and the nested <dtd> element is recommended when it is.

Parameters
inString:String

the string to use as the DTD location.

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.

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.

jarFile:File

the jar file to populate.

files:Hashtable<String, File>

the hash table of files to write.

publicId:String

the id to use.

Annotations
@Override
Exceptions
BuildException:
if there is a problem.