| { |
| "classLoaderSharing" : "workflow", |
| "script" : "class FileRegexFilter implements FileFilter {\n\n\tpublic FileRegexFilter(String regex) {\n\t\tthis.regex = regex;\n\t}\n\n\tpublic boolean accept(File file) {\n\t\treturn file.getName().matches(regex);\n\t}\n\n\tString regex = null;\n}\n\nif (regex == void || regex.equals(\"\")) {\n\tthrow new RuntimeException(\n\t\t\t\"The 'regex' parameter cannot be null. Please enter a valid file extension.\");\n}\n\nif (directory == void || directory.equals(\"\")) {\n\tthrow new RuntimeException(\n\t\t\t\"The 'directory' parameter cannot be null. Please enter a valid file directory.\");\n}\n\nFile dirObj = new File(directory);\n\nif (!dirObj.exists()) {\n\tthrow new RuntimeException(\"The 'directory' parameter specified:\" + directory\n\t\t\t+ \"does not exist. Please enter a valid file directory.\");\n}\n\nFile[] fileObjList = dirObj.listFiles(new FileRegexFilter(regex));\nList filelist = new ArrayList();\nfor (int i = 0; i < fileObjList.length; i++) {\n\tfilelist.add(fileObjList[i].getAbsolutePath());\n}\n", |
| "localworkerName" : "net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask", |
| "inputPorts" : [ { |
| "name" : "directory", |
| "depth" : 0, |
| "type" : "String" |
| }, { |
| "name" : "regex", |
| "depth" : 0, |
| "type" : "String" |
| } ], |
| "outputPorts" : [ { |
| "name" : "filelist", |
| "depth" : 1, |
| "granularDepth" : 1 |
| } ], |
| "isAltered" : false |
| } |