Class WeblogicDeploymentTool
- All Implemented Interfaces:
EJBDeploymentTool
- Direct Known Subclasses:
WeblogicTOPLinkDeploymentTool
public class WeblogicDeploymentTool extends GenericDeploymentTool
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
COMPILER_EJB11
protected static java.lang.String
COMPILER_EJB20
protected static java.lang.String
DEFAULT_COMPILER
protected static java.lang.String
DEFAULT_WL51_DTD_LOCATION
protected static java.lang.String
DEFAULT_WL51_EJB11_DTD_LOCATION
WebLogic 5.1 dtd locationprotected static java.lang.String
DEFAULT_WL60_51_DTD_LOCATION
protected static java.lang.String
DEFAULT_WL60_DTD_LOCATION
protected static java.lang.String
DEFAULT_WL60_EJB11_DTD_LOCATION
WebLogic 6.0 ejb 1.1 dtd locationprotected static java.lang.String
DEFAULT_WL60_EJB20_DTD_LOCATION
WebLogic 6.0 ejb 2.0 dtd locationprotected static java.lang.String
DEFAULT_WL70_DTD_LOCATION
static java.lang.String
PUBLICID_EJB11
EJB11 idstatic java.lang.String
PUBLICID_EJB20
EJB20 idstatic java.lang.String
PUBLICID_WEBLOGIC_EJB510
WebLogic 5.1.0 idstatic java.lang.String
PUBLICID_WEBLOGIC_EJB600
WebLogic 6.0.0 idstatic java.lang.String
PUBLICID_WEBLOGIC_EJB700
WebLogic 7.0.0 idprotected static java.lang.String
WL_CMP_DD
protected static java.lang.String
WL_DD
Fields inherited from class org.apache.tools.ant.taskdefs.optional.ejb.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_DIR
-
Constructor Summary
Constructors Constructor Description WeblogicDeploymentTool()
-
Method Summary
Modifier and Type Method Description void
addSysproperty(Environment.Variable sysp)
Add a nested sysproperty element.protected void
addVendorFiles(java.util.Hashtable<java.lang.String,java.io.File> ejbFiles, java.lang.String ddPrefix)
Add any vendor specific files which should be included in the EJB Jar.Path
createWLClasspath()
Get the classpath to the WebLogic classpaths.protected java.lang.ClassLoader
getClassLoaderFromJar(java.io.File classjar)
Helper method invoked by isRebuildRequired to get a ClassLoader for a Jar File passed to it.java.lang.String
getEjbcClass()
Get the ejbc compiler class.java.lang.Integer
getJvmDebugLevel()
Get the debug level.protected DescriptorHandler
getWeblogicDescriptorHandler(java.io.File srcDir)
Get the WebLogic descriptor handler.protected boolean
isRebuildRequired(java.io.File genericJarFile, java.io.File weblogicJarFile)
Helper method to check to see if a WebLogic EJB 1.1 jar needs to be rebuilt using ejbc.protected void
registerKnownDTDs(DescriptorHandler handler)
Register the DTDs.void
setArgs(java.lang.String args)
Any optional extra arguments pass to the weblogic.ejbc tool.void
setCompiler(java.lang.String compiler)
The compiler (switch-compiler
) to use; optional.void
setEjbcClass(java.lang.String ejbcClass)
Set the classname of the ejbc compiler; optional Normally ejbjar determines the appropriate class based on the DTD used for the EJB.void
setEJBdtd(java.lang.String inString)
Deprecated.void
setJvmargs(java.lang.String args)
Set any additional arguments to pass to the WebLogic JVM; optional.void
setJvmDebugLevel(java.lang.Integer jvmDebugLevel)
Sets the weblogic.StdoutSeverityLevel to use when running the JVM that executes ejbc; optional.void
setKeepgenerated(java.lang.String inValue)
Controls whether WebLogic will keep the generated Java files used to build the class files added to the jar.void
setKeepgeneric(boolean inValue)
controls whether the generic file used as input to ejbc is retained; defaults to falsevoid
setNewCMP(boolean newCMP)
If this is set to true, the new method for locating CMP descriptors will be used; optional, default false.void
setNoEJBC(boolean noEJBC)
Do not EJBC the jar after it has been put together; optional, default falsevoid
setOldCMP(boolean oldCMP)
Set the value of the oldCMP scheme.void
setOutputDir(java.io.File outputDir)
If set ejbc will use this directory as the output destination rather than a jar file.void
setRebuild(boolean rebuild)
Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbc; optional, default true.void
setSuffix(java.lang.String inString)
Setter used to store the suffix for the generated WebLogic jar file.void
setWeblogicdtd(java.lang.String inString)
Deprecated.void
setWLClasspath(Path wlClasspath)
Optional classpath to WL6.0.void
setWLdtd(java.lang.String inString)
Deprecated.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<java.lang.String,java.io.File> files, java.lang.String publicId)
Method used to encapsulate the writing of the JAR file.Methods inherited from class org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool
addFileToJar, addSupportClasses, checkAndAddDependants, checkConfiguration, configure, createClasspath, getClassLoaderForBuild, getCombinedClasspath, getConfig, getDescriptorHandler, getDestDir, getJarBaseName, getLocation, getManifestFile, getPublicId, getTask, getVendorDDPrefix, log, needToRebuild, parseEjbFiles, processDescriptor, setClasspath, setDestdir, setGenericJarSuffix, setTask, usingBaseJarName
-
Field Details
-
PUBLICID_EJB11
public static final java.lang.String PUBLICID_EJB11EJB11 id- See Also:
- Constant Field Values
-
PUBLICID_EJB20
public static final java.lang.String PUBLICID_EJB20EJB20 id- See Also:
- Constant Field Values
-
PUBLICID_WEBLOGIC_EJB510
public static final java.lang.String PUBLICID_WEBLOGIC_EJB510WebLogic 5.1.0 id- See Also:
- Constant Field Values
-
PUBLICID_WEBLOGIC_EJB600
public static final java.lang.String PUBLICID_WEBLOGIC_EJB600WebLogic 6.0.0 id- See Also:
- Constant Field Values
-
PUBLICID_WEBLOGIC_EJB700
public static final java.lang.String PUBLICID_WEBLOGIC_EJB700WebLogic 7.0.0 id- See Also:
- Constant Field Values
-
DEFAULT_WL51_EJB11_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL51_EJB11_DTD_LOCATIONWebLogic 5.1 dtd location- See Also:
- Constant Field Values
-
DEFAULT_WL60_EJB11_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL60_EJB11_DTD_LOCATIONWebLogic 6.0 ejb 1.1 dtd location- See Also:
- Constant Field Values
-
DEFAULT_WL60_EJB20_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL60_EJB20_DTD_LOCATIONWebLogic 6.0 ejb 2.0 dtd location- See Also:
- Constant Field Values
-
DEFAULT_WL51_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL51_DTD_LOCATION- See Also:
- Constant Field Values
-
DEFAULT_WL60_51_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL60_51_DTD_LOCATION- See Also:
- Constant Field Values
-
DEFAULT_WL60_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL60_DTD_LOCATION- See Also:
- Constant Field Values
-
DEFAULT_WL70_DTD_LOCATION
protected static final java.lang.String DEFAULT_WL70_DTD_LOCATION- See Also:
- Constant Field Values
-
DEFAULT_COMPILER
protected static final java.lang.String DEFAULT_COMPILER- See Also:
- Constant Field Values
-
WL_DD
protected static final java.lang.String WL_DD- See Also:
- Constant Field Values
-
WL_CMP_DD
protected static final java.lang.String WL_CMP_DD- See Also:
- Constant Field Values
-
COMPILER_EJB11
protected static final java.lang.String COMPILER_EJB11- See Also:
- Constant Field Values
-
COMPILER_EJB20
protected static final java.lang.String COMPILER_EJB20- See Also:
- Constant Field Values
-
-
Constructor Details
-
WeblogicDeploymentTool
public WeblogicDeploymentTool()
-
-
Method Details
-
addSysproperty
Add a nested sysproperty element.- Parameters:
sysp
- the element to add.
-
createWLClasspath
Get the classpath to the WebLogic classpaths.- Returns:
- the classpath to configure.
-
setOutputDir
public void setOutputDir(java.io.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
- the directory to be used.
-
setWLClasspath
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
- the path to be used.
-
setCompiler
public void setCompiler(java.lang.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 thebuild.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
- the compiler to be used.
-
setRebuild
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
- aboolean
value.
-
setJvmDebugLevel
public void setJvmDebugLevel(java.lang.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
- the value to use.
-
getJvmDebugLevel
public java.lang.Integer getJvmDebugLevel()Get the debug level.- Returns:
- the jvm debug level (may be null).
-
setSuffix
public void setSuffix(java.lang.String inString)Setter used to store the suffix for the generated WebLogic jar file.- Parameters:
inString
- the string to use as the suffix.
-
setKeepgeneric
public void setKeepgeneric(boolean inValue)controls whether the generic file used as input to ejbc is retained; defaults to false- Parameters:
inValue
- true for keep generic
-
setKeepgenerated
public void setKeepgenerated(java.lang.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
- either 'true' or 'false'
-
setArgs
public void setArgs(java.lang.String args)Any optional extra arguments pass to the weblogic.ejbc tool.- Parameters:
args
- extra arguments to pass to the ejbc tool.
-
setJvmargs
public void setJvmargs(java.lang.String args)Set any additional arguments to pass to the WebLogic JVM; optional.- Parameters:
args
- the arguments to be passed to the JVM
-
setEjbcClass
public void setEjbcClass(java.lang.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
- the name of the class to use.
-
getEjbcClass
public java.lang.String getEjbcClass()Get the ejbc compiler class.- Returns:
- the name of the ejbc compiler class.
-
setWeblogicdtd
public void setWeblogicdtd(java.lang.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
- the string to use as the DTD location.
-
setWLdtd
public void setWLdtd(java.lang.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
- the string to use as the DTD location.
-
setEJBdtd
public void setEJBdtd(java.lang.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
- 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
- aboolean
value.
-
setNewCMP
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
- aboolean
value.
-
setNoEJBC
public void setNoEJBC(boolean noEJBC)Do not EJBC the jar after it has been put together; optional, default false- Parameters:
noEJBC
- aboolean
value.
-
registerKnownDTDs
Register the DTDs.- Overrides:
registerKnownDTDs
in classGenericDeploymentTool
- Parameters:
handler
- the handler to use.
-
getWeblogicDescriptorHandler
Get the WebLogic descriptor handler.- Parameters:
srcDir
- the source directory.- Returns:
- the descriptor.
-
addVendorFiles
protected void addVendorFiles(java.util.Hashtable<java.lang.String,java.io.File> ejbFiles, java.lang.String ddPrefix)Add any vendor specific files which should be included in the EJB Jar.- Overrides:
addVendorFiles
in classGenericDeploymentTool
- Parameters:
ejbFiles
- the hash table to be populated.ddPrefix
- the prefix to use.
-
writeJar
protected void writeJar(java.lang.String baseName, java.io.File jarFile, java.util.Hashtable<java.lang.String,java.io.File> files, java.lang.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:
writeJar
in classGenericDeploymentTool
- Parameters:
baseName
- the base name.jarFile
- the jar file to populate.files
- the hash table of files to write.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:
validateConfigured
in interfaceEJBDeploymentTool
- Overrides:
validateConfigured
in classGenericDeploymentTool
- Throws:
BuildException
- if there is an error.
-
isRebuildRequired
protected boolean isRebuildRequired(java.io.File genericJarFile, java.io.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
- java.io.File The generic jar file.weblogicJarFile
- java.io.File The WebLogic jar file to check to see if it needs to be rebuilt.- Returns:
- true if the jar needs to be rebuilt.
-
getClassLoaderFromJar
protected java.lang.ClassLoader getClassLoaderFromJar(java.io.File classjar) throws java.io.IOExceptionHelper 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:
- the classloader for the jarfile.
- Throws:
java.io.IOException
- if there is a problem.
-