package org.griphyn.vdl.karajan.lib.swiftscript;

import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
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.RootDataNode;
import org.griphyn.vdl.type.NoSuchTypeException;
import org.griphyn.vdl.type.Types;

public class FileName extends VDLFunction {
	static {
		setArguments(FileName.class, new Arg[] { PA_VAR });
	}

	public Object function(VariableStack stack) throws ExecutionException {
		String s = argList(filename(stack), true);
		DSHandle handle;

		try {
			handle = new RootDataNode(Types.STRING);
		}
		catch (NoSuchTypeException nste) {
			throw new RuntimeException(nste);
		}

		handle.setValue(s);

		handle.closeShallow();
		return handle;
	}
}

@@ -281,110 +281,20 @@
 ing.
-DSHandle;%0Aimport org.griphyn.vdl.mapping.RootDataNode;%0Aimport org.griphyn.vdl.type.NoSuchTypeException
+RootDataNode
 ;%0Aim
@@ -563,49 +563,14 @@
 ;%0A%09%09
-DSHandle handle;%0A%0A%09%09try %7B%0A%09%09%09handle = new
+return
  Roo
@@ -578,16 +578,24 @@
 DataNode
+.newNode
 (Types.S
@@ -603,157 +603,12 @@
 RING
-);%0A%09%09%7D%0A%09%09catch (NoSuchTypeException nste) %7B%0A%09%09%09throw new RuntimeException(nste);%0A%09%09%7D%0A%0A%09%09handle.setValue(s);%0A%0A%09%09handle.closeShallow();%0A%09%09return handle
+, s)
 ;%0A%09%7D

simplified things a little