Methods Summary |
---|
protected void | addDeploymentTool(EJBDeploymentTool deploymentTool)Add a deployment tool to the list of deployment tools that will be
processed
deploymentTool.setTask(this);
deploymentTools.add(deploymentTool);
|
public BorlandDeploymentTool | createBorland()Adds a deployment tool for Borland server.
log("Borland deployment tools", Project.MSG_VERBOSE);
BorlandDeploymentTool tool = new BorlandDeploymentTool();
tool.setTask(this);
deploymentTools.add(tool);
return tool;
|
public org.apache.tools.ant.types.Path | createClasspath()Adds to the classpath used to locate the super classes and
interfaces of the classes that will make up the EJB JAR.
if (config.classpath == null) {
config.classpath = new Path(getProject());
}
return config.classpath.createPath();
|
public org.apache.tools.ant.taskdefs.optional.ejb.EjbJar$DTDLocation | createDTD()Create a DTD location record. This stores the location of a DTD. The
DTD is identified by its public Id. The location may either be a file
location or a resource location.
DTDLocation dtdLocation = new DTDLocation();
config.dtdLocations.add(dtdLocation);
return dtdLocation;
|
public IPlanetDeploymentTool | createIplanet()Adds a deployment tool for iPlanet Application Server.
log("iPlanet Application Server deployment tools", Project.MSG_VERBOSE);
IPlanetDeploymentTool tool = new IPlanetDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public JbossDeploymentTool | createJboss()Adds a deployment tool for JBoss server.
JbossDeploymentTool tool = new JbossDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public JonasDeploymentTool | createJonas()Adds a deployment tool for JOnAS server.
log("JOnAS deployment tools", Project.MSG_VERBOSE);
JonasDeploymentTool tool = new JonasDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public org.apache.tools.ant.types.FileSet | createSupport()Adds a fileset for support elements.
FileSet supportFileSet = new FileSet();
config.supportFileSets.add(supportFileSet);
return supportFileSet;
|
public WeblogicDeploymentTool | createWeblogic()Adds a deployment tool for Weblogic server.
WeblogicDeploymentTool tool = new WeblogicDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public WeblogicTOPLinkDeploymentTool | createWeblogictoplink()Adds a deployment tool for Weblogic when using the Toplink
Object-Relational mapping.
log("The <weblogictoplink> element is no longer required. Please use "
+ "the <weblogic> element and set newCMP=\"true\"",
Project.MSG_INFO);
WeblogicTOPLinkDeploymentTool tool
= new WeblogicTOPLinkDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public WebsphereDeploymentTool | createWebsphere()Adds a deployment tool for Websphere 4.0 server.
WebsphereDeploymentTool tool = new WebsphereDeploymentTool();
addDeploymentTool(tool);
return tool;
|
public void | execute()Invoked by Ant after the task is prepared, when it is ready to execute
this task.
This will configure all of the nested deployment tools to allow them to
process the jar. If no deployment tools have been configured a generic
tool is created to handle the jar.
A parser is configured and then each descriptor found is passed to all
the deployment tool elements for processing.
validateConfig();
if (deploymentTools.size() == 0) {
GenericDeploymentTool genericTool = new GenericDeploymentTool();
genericTool.setTask(this);
genericTool.setDestdir(destDir);
genericTool.setGenericJarSuffix(genericJarSuffix);
deploymentTools.add(genericTool);
}
for (Iterator i = deploymentTools.iterator(); i.hasNext();) {
EJBDeploymentTool tool = (EJBDeploymentTool) i.next();
tool.configure(config);
tool.validateConfigured();
}
try {
// Create the parser using whatever parser the system dictates
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setValidating(true);
SAXParser saxParser = saxParserFactory.newSAXParser();
DirectoryScanner ds = getDirectoryScanner(config.descriptorDir);
ds.scan();
String[] files = ds.getIncludedFiles();
log(files.length + " deployment descriptors located.",
Project.MSG_VERBOSE);
// Loop through the files. Each file represents one deployment
// descriptor, and hence one bean in our model.
for (int index = 0; index < files.length; ++index) {
// process the deployment descriptor in each tool
for (Iterator i = deploymentTools.iterator(); i.hasNext();) {
EJBDeploymentTool tool = (EJBDeploymentTool) i.next();
tool.processDescriptor(files[index], saxParser);
}
}
} catch (SAXException se) {
String msg = "SAXException while creating parser."
+ " Details: "
+ se.getMessage();
throw new BuildException(msg, se);
} catch (ParserConfigurationException pce) {
String msg = "ParserConfigurationException while creating parser. "
+ "Details: " + pce.getMessage();
throw new BuildException(msg, pce);
}
|
public java.lang.String | getCmpversion()Gets the CMP version.
return this.cmpVersion;
|
public java.io.File | getDestdir()Gets the destination directory.
return this.destDir;
|
public void | setBasejarname(java.lang.String inValue)Set the base name of the EJB JAR that is to be created if it is not
to be determined from the name of the deployment descriptor files.
config.baseJarName = inValue;
if (config.namingScheme == null) {
config.namingScheme = new NamingScheme();
config.namingScheme.setValue(NamingScheme.BASEJARNAME);
} else if (!config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME)) {
throw new BuildException("The basejarname attribute is not "
+ "compatible with the "
+ config.namingScheme.getValue() + " naming scheme");
}
|
public void | setBasenameterminator(java.lang.String inValue)The string which terminates the bean name.
The convention used by this task is
that bean descriptors are named as the BeanName with some suffix. The
baseNameTerminator string separates the bean name and the suffix and
is used to determine the bean name.
config.baseNameTerminator = inValue;
|
public void | setClasspath(org.apache.tools.ant.types.Path classpath)Set the classpath to use when resolving classes for inclusion in the jar.
config.classpath = classpath;
|
public void | setCmpversion(org.apache.tools.ant.taskdefs.optional.ejb.EjbJar$CMPVersion version)Sets the CMP version.
this.cmpVersion = version.getValue();
|
public void | setDependency(java.lang.String analyzer)Set the analyzer to use when adding in dependencies to the JAR.
config.analyzer = analyzer;
|
public void | setDescriptordir(java.io.File inDir)Set the descriptor directory. The descriptor directory contains the
EJB deployment descriptors. These are XML files that declare the
properties of a bean in a particular deployment scenario. Such
properties include, for example, the transactional nature of the bean
and the security access control to the bean's methods.
config.descriptorDir = inDir;
|
public void | setDestdir(java.io.File inDir)Set the destination directory. The EJB jar files will be written into
this directory. The jar files that exist in this directory are also
used when determining if the contents of the jar file have changed.
Note that this parameter is only used if no deployment tools are
specified. Typically each deployment tool will specify its own
destination directory.
this.destDir = inDir;
|
public void | setFlatdestdir(boolean inValue)Controls whether the
destination JARs are written out in the destination directory with
the same hierarchical structure from which the deployment descriptors
have been read. If this is set to true the generated EJB jars are
written into the root of the destination directory, otherwise they
are written out in the same relative position as the deployment
descriptors in the descriptor directory.
config.flatDestDir = inValue;
|
public void | setGenericjarsuffix(java.lang.String inString)Set the suffix for the generated jar file. When generic jars are
generated, they have a suffix which is appended to the the bean name
to create the name of the jar file. Note that this suffix includes
the extension fo te jar file and should therefore end with an
appropriate extension such as .jar or .ear
this.genericJarSuffix = inString;
|
public void | setManifest(java.io.File manifest)Set the Manifest file to use when jarring. As of EJB 1.1, manifest
files are no longer used to configure the EJB. However, they still
have a vital importance if the EJB is intended to be packaged in an
EAR file. By adding "Class-Path" settings to a Manifest file, the EJB
can look for classes inside the EAR file itself, allowing for easier
deployment. This is outlined in the J2EE specification, and all J2EE
components are meant to support it.
config.manifest = manifest;
|
public void | setNaming(org.apache.tools.ant.taskdefs.optional.ejb.EjbJar$NamingScheme namingScheme)Set the naming scheme used to determine the name of the generated jars
from the deployment descriptor
config.namingScheme = namingScheme;
if (!config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME)
&& config.baseJarName != null) {
throw new BuildException("The basejarname attribute is not "
+ "compatible with the "
+ config.namingScheme.getValue() + " naming scheme");
}
|
public void | setSrcdir(java.io.File inDir)Sets the source directory, which is the directory that
contains the classes that will be added to the EJB jar. Typically
this will include the home and remote interfaces and the bean class.
config.srcDir = inDir;
|
private void | validateConfig()Validate the config that has been configured from the build file
if (config.srcDir == null) {
throw new BuildException("The srcDir attribute must be specified");
}
if (config.descriptorDir == null) {
config.descriptorDir = config.srcDir;
}
if (config.namingScheme == null) {
config.namingScheme = new NamingScheme();
config.namingScheme.setValue(NamingScheme.DESCRIPTOR);
} else if (config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME)
&& config.baseJarName == null) {
throw new BuildException("The basejarname attribute must "
+ "be specified with the basejarname naming scheme");
}
|