blob: f8fe3cb78b9c7f369ebca557488afb95e47c70fd [file] [log] [blame]
{
"http://purl.org/dc/terms/rights": "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.",
"http://purl.org/dc/terms/license": {"@id": "http://www.apache.org/licenses/LICENSE-2.0"},
"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
}