blob: 656453e53272aed53c06f45b3c1d78260350003d [file] [log] [blame]
{
"classLoaderSharing" : "workflow",
"script" : "class FileExtFilter implements FileFilter {\n\n\tpublic FileExtFilter(String ext) {\n\t\tthis.ext = ext;\n\t}\n\n\tpublic boolean accept(File file) {\n\t\treturn file.getName().endsWith(ext);\n\t}\n\n\tString ext = null;\n}\n\nif (extension == void || extension.equals(\"\")) {\n\tthrow new RuntimeException(\n\t\t\t\"The 'extension' 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 FileExtFilter(extension));\nList filelist = new ArrayList();\nfor (int i = 0; i < fileObjList.length; i++) {\n\tfilelist.add(fileObjList[i].getAbsolutePath());\n}\n\n\n",
"localworkerName" : "net.sourceforge.taverna.scuflworkers.io.FileListByExtTask",
"inputPorts" : [ {
"name" : "directory",
"depth" : 0,
"type" : "String"
}, {
"name" : "extension",
"depth" : 0,
"type" : "String"
} ],
"outputPorts" : [ {
"name" : "filelist",
"depth" : 1,
"granularDepth" : 1
} ],
"isAltered" : false
}