📄 partask.java
字号:
package org.jbpm.ant;
import java.io.File;
import java.io.IOException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Jar;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.zip.ZipOutputStream;
/**
* An extension of <jar>to create a jBpm process archive archive. Contains special treatment for files
* processdefinition.xml.
*
* (The Par task is a shortcut for specifying the particular layout of a PAR file. The same thing can be accomplished
* by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task.)
*
* The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the
* Par task.
*
* Behavior: [1] processdefinitionxml attribute must be specified. The file specified there will end up as
* ./processdefinition.xml in the resulting PAR [2] The nested classes element specifies a FileSet. It is optional. All
* files included in this fileset will end up in the classes directory of the par file
*
* @author Raka Angga Jananuraga (don_raka@jbpm.org)
*/
public class ParTask extends Jar {
private File processDefinitionDescriptor;
public ParTask() {
archiveType = "par";
emptyBehavior = "create";
}
public void setProcessdefinitionxml(File descr) {
processDefinitionDescriptor = descr;
if (!processDefinitionDescriptor.exists()) {
throw new BuildException("Process definition descriptor: " + processDefinitionDescriptor + " does not exist.");
} else {
ZipFileSet fs = new ZipFileSet();
fs.setFile(processDefinitionDescriptor);
fs.setFullpath("processdefinition.xml");
addFileset(fs);
return;
}
}
public void addClasses(ZipFileSet fs) {
fs.setPrefix("classes/");
addFileset(fs);
}
protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException {
if (processDefinitionDescriptor == null && !isInUpdateMode()) {
throw new BuildException("processdefinitionxml attribute is required", getLocation());
}
super.initZipOutputStream(zOut);
return;
}
protected void zipFile(File file, ZipOutputStream zOut, String vPath, int mode) throws IOException {
super.zipFile(file, zOut, vPath, mode);
}
protected void cleanUp() {
super.cleanUp();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -