blob: 2649026865739c09def8fe442ceb6dd92fe4d62f [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" : "if (command == void || command.equals(\"\")) {\n\tthrow new RuntimeException(\"The 'command' port cannot be null.\");\n}\nProcess proc = null;\nRuntime rt = Runtime.getRuntime();\n\nString osName = System.getProperty(\"os.name\");\nString[] cmdArray = null;\nif (osName.contains(\"Windows\")) {\n\tcmdArray = new String[] { \"cmd.exe\", \"/c\", command };\n} else {// TODO: investigate if this will work in Linux and OSX\n\tcmdArray = new String[] { command };\n}\n\n// concatenate the arrays\nif ((args == void) || (args == null)) {\n\targs = new ArrayList();\n}\n\nint argSize = cmdArray.length + args.size();\nArrayList appArray = new ArrayList(argSize);\nfor (int i = 0; i < cmdArray.length; i++) {\n\tappArray.add(cmdArray[i]);\n}\n\nfor (int i = 0; i < args.size(); i++) {\n\tappArray.add(args.get(i));\n}\n\nString[] applist = new String[argSize];\nappArray.toArray(applist);\nproc = rt.exec(applist);\n\n// Get the input stream and read from it\nInputStream in = proc.getInputStream();\n\nint c;\nStringBuffer sb = new StringBuffer();\nwhile ((c = in.read()) != -1) {\n\tsb.append((char) c);\n}\nin.close();\nresult = sb.toString();\n \n",
"localworkerName" : "net.sourceforge.taverna.scuflworkers.io.LocalCommand",
"inputPorts" : [ {
"name" : "command",
"depth" : 0,
"type" : "String"
}, {
"name" : "args",
"depth" : 1,
"type" : "String"
} ],
"outputPorts" : [ {
"name" : "result",
"depth" : 0,
"granularDepth" : 0
} ],
"isAltered" : false
}