blob: 06906b67fb429315ecf9ca1c4bd0923abc3a33bd [file] [log] [blame]
<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>class FileRegexFilter implements FileFilter {
public FileRegexFilter(String regex) {
this.regex = regex;
}
public boolean accept(File file) {
return file.getName().matches(regex);
}
String regex = null;
}
if (regex == void || regex.equals("")) {
throw new RuntimeException(
"The 'regex' parameter cannot be null. Please enter a valid file extension.");
}
if (directory == void || directory.equals("")) {
throw new RuntimeException(
"The 'directory' parameter cannot be null. Please enter a valid file directory.");
}
File dirObj = new File(directory);
if (!dirObj.exists()) {
throw new RuntimeException("The 'directory' parameter specified:" + directory
+ "does not exist. Please enter a valid file directory.");
}
File[] fileObjList = dirObj.listFiles(new FileRegexFilter(regex));
List filelist = new ArrayList();
for (int i = 0; i &lt; fileObjList.length; i++) {
filelist.add(fileObjList[i].getAbsolutePath());
}
</script>
<dependencies />
<inputs>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
<name>directory</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
<name>regex</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>filelist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>