📄 deploypartask.java
字号:
package org.jbpm.ant;
import java.io.*;
import java.util.*;
import java.util.jar.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.*;
import org.jbpm.*;
public class DeployParTask extends MatchingTask {
private List fileSets = new LinkedList();
private File propertiesFile = null;
public void addFileset(FileSet fileSet) {
fileSets.add(fileSet);
}
public void setProperties(File propertiesFile) {
this.propertiesFile = propertiesFile;
}
public void execute() throws BuildException {
try {
Properties properties = new Properties();
properties.load( new FileInputStream( propertiesFile ) );
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration( properties );
log( "using configuration file: " + propertiesFile);
log( "using configuration: " + jbpmConfiguration.getProperties());
JbpmServiceLocator serviceLocator = new JbpmServiceLocator( jbpmConfiguration );
DefinitionService definitionService = serviceLocator.getDefinitionService();
Iterator iter = getFiles().iterator();
while (iter.hasNext()) {
File file = (File) iter.next();
log( "deploying process archive " + file + "..." );
JarInputStream jarInputStream = new JarInputStream( new FileInputStream( file ) );
definitionService.deployProcessArchive( jarInputStream );
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException( "couldn't deploy process archives : " + e.getMessage() );
}
}
private List getFiles() {
List files = new LinkedList();
for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {
FileSet fs = (FileSet) i.next();
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] dsFiles = ds.getIncludedFiles();
for (int j = 0; j < dsFiles.length; j++) {
File f = new File(dsFiles[j]);
if ( !f.isFile() ) {
f = new File( ds.getBasedir(), dsFiles[j] );
}
files.add( f );
}
}
return files;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -