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

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

public class WeblogicDeploymentTool
extends GenericDeploymentTool


Field Summary
protected static java.lang.String DEFAULT_WL_DTD_LOCATION
           
protected static java.lang.String DEFAULT_WL51_EJB11_DTD_LOCATION
           
protected static java.lang.String DEFAULT_WL60_EJB11_DTD_LOCATION
           
protected static java.lang.String DEFAULT_WL60_EJB20_DTD_LOCATION
           
static java.lang.String PUBLICID_EJB11
           
static java.lang.String PUBLICID_EJB20
           
static java.lang.String PUBLICID_WEBLOGIC_EJB
           
protected 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
EJB_DD, META_DIR
 
Constructor Summary
WeblogicDeploymentTool()
           
 
Method Summary
protected  void addVendorFiles(java.util.Hashtable ejbFiles, java.lang.String baseName)
          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.
protected  DescriptorHandler getDescriptorHandler(java.io.File srcDir)
           
protected  DescriptorHandler getWeblogicDescriptorHandler(java.io.File srcDir)
           
protected  boolean isRebuildRequired(java.io.File genericJarFile, java.io.File weblogicJarFile)
          Helper method to check to see if a weblogic EBJ1.1 jar needs to be rebuilt using ejbc.
 void setArgs(java.lang.String args)
          sets some additional args to send to ejbc.
 void setCompiler(java.lang.String compiler)
          The compiler (switch -compiler) to use
 void setEJBdtd(java.lang.String inString)
          Setter used to store the location of the Sun's Generic EJB DTD.
 void setKeepgenerated(java.lang.String inValue)
          Sets whether -keepgenerated is passed to ejbc (that is, the .java source files are kept).
 void setKeepgeneric(boolean inValue)
          Setter used to store the value of keepGeneric
 void setNewCMP(boolean newCMP)
          Set the value of the newCMP scheme.
 void setOldCMP(boolean oldCMP)
          Set the value of the oldCMP scheme.
 void setRebuild(boolean rebuild)
          Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbc
 void setSuffix(java.lang.String inString)
          Setter used to store the suffix for the generated weblogic jar file.
 void setWeblogicdtd(java.lang.String inString)
          Setter used to store the location of the ejb-jar DTD.
 void setWLClasspath(Path wlClasspath)
           
 void setWLdtd(java.lang.String inString)
          Setter used to store the location of the weblogic DTD.
 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 org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool
addFileToJar, checkAndAddInherited, configure, createClasspath, getClassLoaderForBuild, getCombinedClasspath, getConfig, getDestDir, getTask, log, processDescriptor, setClasspath, setDestdir, setGenericJarSuffix, setTask, usingBaseJarName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLICID_EJB11

public static final java.lang.String PUBLICID_EJB11

PUBLICID_EJB20

public static final java.lang.String PUBLICID_EJB20

PUBLICID_WEBLOGIC_EJB

public static final java.lang.String PUBLICID_WEBLOGIC_EJB

DEFAULT_WL51_EJB11_DTD_LOCATION

protected static final java.lang.String DEFAULT_WL51_EJB11_DTD_LOCATION

DEFAULT_WL60_EJB11_DTD_LOCATION

protected static final java.lang.String DEFAULT_WL60_EJB11_DTD_LOCATION

DEFAULT_WL60_EJB20_DTD_LOCATION

protected static final java.lang.String DEFAULT_WL60_EJB20_DTD_LOCATION

DEFAULT_WL_DTD_LOCATION

protected static final java.lang.String DEFAULT_WL_DTD_LOCATION

WL_DD

protected static final java.lang.String WL_DD

WL_CMP_DD

protected static final java.lang.String WL_CMP_DD
Constructor Detail

WeblogicDeploymentTool

public WeblogicDeploymentTool()
Method Detail

createWLClasspath

public Path createWLClasspath()
Get the classpath to the weblogic classpaths

setWLClasspath

public void setWLClasspath(Path wlClasspath)

setCompiler

public void setCompiler(java.lang.String compiler)
The compiler (switch -compiler) to use

setRebuild

public void setRebuild(boolean rebuild)
Set the rebuild flag to false to only update changes in the jar rather than rerunning ejbc

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)
Setter used to store the value of keepGeneric
Parameters:
inValue - a string, either 'true' or 'false'.

setKeepgenerated

public void setKeepgenerated(java.lang.String inValue)
Sets whether -keepgenerated is passed to ejbc (that is, the .java source files are kept).
Parameters:
inValue - either 'true' or 'false'

setArgs

public void setArgs(java.lang.String args)
sets some additional args to send to ejbc.

setWeblogicdtd

public void setWeblogicdtd(java.lang.String inString)
Setter used to store the location of the ejb-jar 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.

setWLdtd

public void setWLdtd(java.lang.String inString)
Setter used to store the location of the weblogic 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.

setEJBdtd

public void setEJBdtd(java.lang.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 - 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

setNewCMP

public void setNewCMP(boolean newCMP)
Set the value of the newCMP scheme. 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.

getDescriptorHandler

protected DescriptorHandler getDescriptorHandler(java.io.File srcDir)
Overrides:
getDescriptorHandler in class GenericDeploymentTool

getWeblogicDescriptorHandler

protected DescriptorHandler getWeblogicDescriptorHandler(java.io.File srcDir)

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.
Overrides:
addVendorFiles in class GenericDeploymentTool

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.
Overrides:
writeJar in class GenericDeploymentTool

validateConfigured

public void validateConfigured()
                        throws BuildException
Called to validate that the tool parameters have been configured.
Overrides:
validateConfigured in class GenericDeploymentTool

isRebuildRequired

protected boolean isRebuildRequired(java.io.File genericJarFile,
                                    java.io.File weblogicJarFile)
Helper method to check to see if a weblogic EBJ1.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 regened 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 dicriptors 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 doesnt 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.

getClassLoaderFromJar

protected java.lang.ClassLoader getClassLoaderFromJar(java.io.File classjar)
                                               throws java.io.IOException
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.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.