[Swift-commit] r2958 - trunk/src/org/griphyn/vdl/karajan/lib/swiftscript
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Tue Jun 16 10:19:51 CDT 2009
Author: benc
Date: 2009-06-16 10:19:51 -0500 (Tue, 16 Jun 2009)
New Revision: 2958
Modified:
trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileNames.java
Log:
Make @filenames return a DSHandle representing an array of strings, rather than a (Java level) array containing DSHandles representing strings.
Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileNames.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileNames.java 2009-06-15 15:06:54 UTC (rev 2957)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileNames.java 2009-06-16 15:19:51 UTC (rev 2958)
@@ -8,7 +8,10 @@
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.karajan.lib.VDLFunction;
import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.InvalidPathException;
+import org.griphyn.vdl.mapping.Path;
import org.griphyn.vdl.mapping.RootDataNode;
+import org.griphyn.vdl.mapping.RootArrayDataNode;
import org.griphyn.vdl.type.Types;
public class FileNames extends VDLFunction {
@@ -18,10 +21,16 @@
public Object function(VariableStack stack) throws ExecutionException {
String[] f = filename(stack);
- DSHandle[] h = new DSHandle[f.length];
- for (int i = 0; i < f.length; i++) {
- h[i] = RootDataNode.newNode(Types.STRING, relativize(f[i]));
+ DSHandle returnArray = new RootArrayDataNode(Types.STRING.arrayType());
+ try {
+ for (int i = 0; i < f.length; i++) {
+ Path p = parsePath("["+i+"]", stack);
+ DSHandle h = returnArray.getField(p);
+ h.setValue(relativize(f[i]));
+ }
+ } catch (InvalidPathException e) {
+ throw new ExecutionException("Unexpected invalid path exception",e);
}
- return h;
+ return returnArray;
}
}
More information about the Swift-commit
mailing list