Earpublic class Ear extends Jar Creates a EAR archive. Based on WAR task |
Fields Summary |
---|
private static final org.apache.tools.ant.util.FileUtils | FILE_UTILS | private File | deploymentDescriptor | private boolean | descriptorAdded |
Constructors Summary |
---|
public Ear()Create an Ear task.
super();
archiveType = "ear";
emptyBehavior = "create";
|
Methods Summary |
---|
public void | addArchives(org.apache.tools.ant.types.ZipFileSet fs)Adds zipfileset.
// We just set the prefix for this fileset, and pass it up.
// Do we need to do this? LH
fs.setPrefix("/");
super.addFileset(fs);
| protected void | cleanUp()Make sure we don't think we already have a application.xml next
time this task gets executed.
descriptorAdded = false;
super.cleanUp();
| protected void | initZipOutputStream(org.apache.tools.zip.ZipOutputStream zOut)Initialize the output stream.
// If no webxml file is specified, it's an error.
if (deploymentDescriptor == null && !isInUpdateMode()) {
throw new BuildException("appxml attribute is required", getLocation());
}
super.initZipOutputStream(zOut);
| public void | setAppxml(java.io.File descr)File to incorporate as application.xml.
deploymentDescriptor = descr;
if (!deploymentDescriptor.exists()) {
throw new BuildException("Deployment descriptor: "
+ deploymentDescriptor
+ " does not exist.");
}
// Create a ZipFileSet for this file, and pass it up.
ZipFileSet fs = new ZipFileSet();
fs.setFile(deploymentDescriptor);
fs.setFullpath("META-INF/application.xml");
super.addFileset(fs);
| public void | setEarfile(java.io.File earFile)Set the destination file.
setDestFile(earFile);
| protected void | zipFile(java.io.File file, org.apache.tools.zip.ZipOutputStream zOut, java.lang.String vPath, int mode)Overridden from Zip class to deal with application.xml
// If the file being added is META-INF/application.xml, we
// warn if it's not the one specified in the "appxml"
// attribute - or if it's being added twice, meaning the same
// file is specified by the "appxml" attribute and in a
// <fileset> element.
if (vPath.equalsIgnoreCase("META-INF/application.xml")) {
if (deploymentDescriptor == null
|| !FILE_UTILS.fileNameEquals(deploymentDescriptor, file)
|| descriptorAdded) {
log("Warning: selected " + archiveType
+ " files include a META-INF/application.xml which will"
+ " be ignored (please use appxml attribute to "
+ archiveType + " task)", Project.MSG_WARN);
} else {
super.zipFile(file, zOut, vPath, mode);
descriptorAdded = true;
}
} else {
super.zipFile(file, zOut, vPath, mode);
}
|
|