[Swift-commit] r7312 - in trunk: . resources src/org/griphyn/vdl/engine src/org/griphyn/vdl/karajan src/org/griphyn/vdl/karajan/lib src/org/griphyn/vdl/karajan/lib/swiftscript src/org/griphyn/vdl/mapping src/org/griphyn/vdl/mapping/file src/org/griphyn/vdl/type src/org/griphyn/vdl/type/impl

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Fri Nov 22 22:17:49 CST 2013


Author: hategan
Date: 2013-11-22 22:17:47 -0600 (Fri, 22 Nov 2013)
New Revision: 7312

Added:
   trunk/src/org/griphyn/vdl/mapping/NullMapper.java
   trunk/src/org/griphyn/vdl/mapping/RootHandle.java
   trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/CSVMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/ExternalMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/MappingParamFileGenerator.java
   trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapperParams.java
   trunk/src/org/griphyn/vdl/mapping/file/TestMapper.params
   trunk/src/org/griphyn/vdl/mapping/file/TestMapperParams.java
   trunk/src/org/griphyn/vdl/type/impl/ImmutableField.java
Modified:
   trunk/build.xml
   trunk/resources/Karajan.stg
   trunk/src/org/griphyn/vdl/engine/Karajan.java
   trunk/src/org/griphyn/vdl/karajan/HangChecker.java
   trunk/src/org/griphyn/vdl/karajan/lib/CreateArray.java
   trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java
   trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java
   trunk/src/org/griphyn/vdl/karajan/lib/New.java
   trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java
   trunk/src/org/griphyn/vdl/karajan/lib/Operators.java
   trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
   trunk/src/org/griphyn/vdl/karajan/lib/SwiftFunction.java
   trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
   trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
   trunk/src/org/griphyn/vdl/karajan/lib/UnitEnd.java
   trunk/src/org/griphyn/vdl/karajan/lib/UnitStart.java
   trunk/src/org/griphyn/vdl/karajan/lib/While.java
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java
   trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
   trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
   trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
   trunk/src/org/griphyn/vdl/mapping/DSHandle.java
   trunk/src/org/griphyn/vdl/mapping/DataNode.java
   trunk/src/org/griphyn/vdl/mapping/DependentException.java
   trunk/src/org/griphyn/vdl/mapping/DuplicateMappingChecker.java
   trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java
   trunk/src/org/griphyn/vdl/mapping/Mapper.java
   trunk/src/org/griphyn/vdl/mapping/MapperFactory.java
   trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
   trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
   trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
   trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/AirsnMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ROIFileNameElementMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java
   trunk/src/org/griphyn/vdl/type/Field.java
   trunk/src/org/griphyn/vdl/type/Type.java
   trunk/src/org/griphyn/vdl/type/impl/FieldImpl.java
   trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java
   trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java
Log:
1. Cleaned up mapping params to solve some memory issues as well as make it more reasonable: things that are not strictly related to mapping, such as declaration line, thread that created a piece of data and such now go into the data node. The mapper specific parameters are no implemented by separate classes for each mapper instead of a hashtable. These classes can be tedious to write, so they can be generated from a simple template, and such a generator is provided. 2 Added a RootHandle interface that is implemented by all the Root*Node classes. 3 Added CamelCase versions of mapper names, which I would hope would eventually become standard since it is what most of swift uses. 4. Made source line parameters integers instead of strings

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/build.xml	2013-11-23 04:17:47 UTC (rev 7312)
@@ -69,7 +69,7 @@
 		</copy>
 	</target>
 
-	<target name="dist" depends="generateVersion, antlr, compileSchema">
+	<target name="dist" depends="generateVersion, antlr, compileSchema, compileParams">
 		<ant antfile="${main.buildfile}" target="dist"/>
 		<mkdir dir="${dist.dir}/libexec"/>
 		<copy todir="${dist.dir}/libexec">
@@ -262,6 +262,30 @@
 			</classpath>
 		</java>
 	</target>
+	
+	<target name="compileParams">
+		<!-- Mapper parameters are java classes that are (mostly)  -->
+		<!-- generated from parameter files. This is done to avoid -->
+		<!-- costly hashtables attached to every single piece of   -->
+		<!-- swift root data. They could be written by hand (and   -->
+		<!-- some are), but it's a tedious process                 -->
+		
+		<!-- first compile the params compiler -->
+		<mkdir dir="${build.dir}"/>
+		<echo message="[swift] Compiling mapper params compiler"/>
+		<javac  srcdir="src"
+			destdir="${build.dir}"
+			includes="**/MappingParamFileGenerator.java"
+			includeAntRuntime="false"/>
+        <!-- then compile the files themselves -->
+        <echo message="[swift] Generating mapping parameter classes"/>
+        <java classname="org.griphyn.vdl.mapping.file.MappingParamFileGenerator" fork="true" failonerror="true">
+        	<arg value="src"/>
+        	<classpath>
+        		<pathelement location="${build.dir}"/>
+        	</classpath>
+        </java>
+	</target>
 
 	<!-- ================================================ -->
 	<!-- Compile                                          -->

Modified: trunk/resources/Karajan.stg
===================================================================
--- trunk/resources/Karajan.stg	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/resources/Karajan.stg	2013-11-23 04:17:47 UTC (rev 7312)
@@ -111,7 +111,7 @@
 >>
 
 swift_execute(outputs,inputs,attributes,application,name,line) ::= <<
-swift:unitStart("PROCEDURE", name="$name$", line="$line$", outputs="$outputs:list();separator=","$")
+swift:unitStart("PROCEDURE", name="$name$", line=$line$, outputs="$outputs:list();separator=","$")
 swift:execute(
 	$attributes$
 	swift:tr("$application.exec$")
@@ -120,7 +120,7 @@
 	$swift_arguments(attributes=application.attributes,arguments=application.arguments, stdin=application.stdin,stdout=application.stdout,stderr=application.stderr)$
 )
 $outputs:swift_closedataset();separator="\n"$
-swift:unitEnd("PROCEDURE", name="$name$", line="$line$")
+swift:unitEnd("PROCEDURE", name="$name$", line=$line$)
 >>
 
 log_param(dir) ::= <<
@@ -197,7 +197,7 @@
 >>
 
 iterate(declarations, statements, cond, var, refs, cleanups, trace, line) ::= <<
-swift:while($var$$if(trace)$, _traceline="$line$"$endif$$if(refs)$, refs="$refs;separator=" "$"$endif$) {
+swift:while($var$$if(trace)$, _traceline=$line$$endif$$if(refs)$, refs="$refs;separator=" "$"$endif$) {
 	if (!swift:getFieldValue($cond$)) {
 		$sub_comp(declarations=declarations, statements=statements, cleanups=cleanups)$
 		next(swiftop:inc($var$))
@@ -206,7 +206,7 @@
 >>
 
 foreach(var, in, indexVar, indexVarType, declarations, statements, line, refs, selfClose, cleanups) ::= <<
-swift:tParallelFor(\$, _traceline="$line$"$if(indexVar)$, _kvar="$indexVar$"$endif$, _vvar="$var$"$if(selfClose)$, selfClose=true$endif$$if(refs)$, refs="$refs;separator=" "$"$endif$,
+swift:tParallelFor(\$, _traceline=$line$$if(indexVar)$, _kvar="$indexVar$"$endif$, _vvar="$var$"$if(selfClose)$, selfClose=true$endif$$if(refs)$, refs="$refs;separator=" "$"$endif$,
 $! The iterator !$
 	getArrayIterator($in$)) {
 	(\$\$, $var$) := each(\$)
@@ -214,14 +214,14 @@
 	$indexVar$ := swift:new("$indexVarType$", value=\$\$)
 $endif$
 
-	swift:unitStart("FOREACH_IT", line="$line$") 
+	swift:unitStart("FOREACH_IT", line=$line$) 
 	$declarations;separator="\n"$
 $if(statements)$
 	$parallel(statements=statements)$
 	$cleanups:swift_cleandataset();separator="\n"$
 $endif$
 
-	swift:unitEnd("FOREACH_IT", line="$line$")
+	swift:unitEnd("FOREACH_IT", line=$line$)
 }
 >>
 
@@ -288,16 +288,16 @@
 variable(name, type, expr, mapping, nil, file, waitCount, input, datatype, isGlobal, line) ::= <<
 $name$ := 
 	$if(mapping)$
-	swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline="$line$"$endif$$if(input)$, input=true$endif$
+	swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline=$line$$endif$$if(input)$, input=true$endif$
 		$swift_mapping(mapping=mapping, file=file)$
 	)
 	$else$
 		$if(file)$
-			swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline="$line$"$endif$$if(input)$, input=true$endif$
+			swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline=$line$$endif$$if(input)$, input=true$endif$
 				$swift_mapping(mapping=mapping, file=file)$
 			)
 		$else$
-			swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline="$line$"$endif$$if(input)$, input=true$endif$)
+			swift:new("$type$", dbgname="$name$"$if(waitCount)$, waitCount=$waitCount$$endif$$if(line)$, _defline=$line$$endif$$if(input)$, input=true$endif$)
 		$endif$
 	$endif$
 $variable_log()$
@@ -323,7 +323,7 @@
 $if(partialClose)$
 sequential(
 $endif$
-swift:setFieldValue($if(line)$_traceline="$line$"$endif$
+swift:setFieldValue($if(line)$_traceline=$line$$endif$
 	$var$
 	$value$
 )

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -488,7 +488,7 @@
 			// add temporary mapping info in not primitive or array of primitive	    
 			if (!isPrimitiveOrArrayOfPrimitive(var.getType().getLocalPart())) {
     			StringTemplate mappingST = new StringTemplate("mapping");
-    			mappingST.setAttribute("descriptor", "concurrent_mapper");
+    			mappingST.setAttribute("descriptor", "concurrentMapper");
     			StringTemplate paramST = template("swift_parameter");
     			paramST.setAttribute("name", "prefix");
     			paramST.setAttribute("expr", "\"" + var.getName() + "-"
@@ -539,7 +539,7 @@
             StringTemplate variableDeclarationST = template("variable");
             // TODO factorise this and other code in variable()?
             StringTemplate pmappingST = new StringTemplate("mapping");
-            pmappingST.setAttribute("descriptor", "concurrent_mapper");
+            pmappingST.setAttribute("descriptor", "concurrentMapper");
             StringTemplate pparamST = template("swift_parameter");
             pparamST.setAttribute("name", "prefix");
             pparamST.setAttribute("expr", parameterVariableName + "-" + 
@@ -1694,7 +1694,9 @@
 
         call.setAttribute("datatype", type);
         call.setAttribute("call", call(c, subscope, true));
-        call.setAttribute("prefix", UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
+        if (!isPrimitiveOrArrayOfPrimitive(type)) {
+            call.setAttribute("prefix", UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
+        }
         return call;
     }
     

Modified: trunk/src/org/griphyn/vdl/karajan/HangChecker.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/HangChecker.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/HangChecker.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -50,7 +50,6 @@
 import org.globus.cog.karajan.scheduler.WeightedHostScoreScheduler;
 import org.griphyn.vdl.karajan.lib.SwiftFunction;
 import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class HangChecker extends TimerTask {
@@ -244,9 +243,12 @@
     }
     
     public static String varWithLine(DSHandle value) {
-        String line = value.getRoot().getParam(MappingParam.SWIFT_LINE);
+        Integer line = null;
+        String dbgname = null;
+        line = value.getRoot().getLine();
+        dbgname = value.getName();
         Path path = value.getPathFromRoot();
-        return value.getRoot().getParam(MappingParam.SWIFT_DBGNAME) + 
+        return dbgname + 
             (value == value.getRoot() ? "" : (path.isArrayIndex(0) ? path : "." + path)) + 
             (line == null ? "" : " (declared on line " + line + ")");
     }

Modified: trunk/src/org/griphyn/vdl/karajan/lib/CreateArray.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/CreateArray.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/CreateArray.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -27,13 +27,10 @@
 import org.globus.cog.karajan.analyzer.Signature;
 import org.globus.cog.karajan.futures.FutureFault;
 import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.MappingParamSet;
-import org.griphyn.vdl.mapping.OOBYield;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.RootArrayDataNode;
-import org.griphyn.vdl.type.Field;
+import org.griphyn.vdl.mapping.RootHandle;
+import org.griphyn.vdl.mapping.file.ConcurrentMapper;
 import org.griphyn.vdl.type.Type;
 
 public class CreateArray extends SetFieldValue {
@@ -56,10 +53,13 @@
 
 			Type type = checkTypes((List<?>) value);
 			
-			DSHandle handle = new RootArrayDataNode(type.arrayType());
-			if (hasMappableFields(type)) {
-			    setMapper(handle);
+			RootHandle handle = new RootArrayDataNode("arrayexpr", type.arrayType());
+			if (type.hasNonPrimitiveComponents()) {
+			    handle.init(new ConcurrentMapper());
 			}
+			else {
+			    handle.init(null);
+			}
 
 			if (logger.isInfoEnabled()) {
 			    logger.info("CREATEARRAY START array=" + handle.getIdentifier());
@@ -101,43 +101,6 @@
 		}
 	}
 
-    private void setMapper(DSHandle handle) {
-        // slap a concurrent mapper on this
-        MappingParamSet params = new MappingParamSet();
-        params.set(MappingParam.SWIFT_DESCRIPTOR, "concurrent_mapper");
-        params.set(MappingParam.SWIFT_DBGNAME, "arrayexpr");
-        try {
-            handle.init(params);
-        }
-        catch (OOBYield y) {
-            throw y.wrapped(this);
-        }
-        catch (HandleOpenException e) {
-            throw new ExecutionException(this, "Plain HandleOpenException caught", e);
-        }
-    }
-
-    private boolean hasMappableFields(Type type) {
-        if (type.isPrimitive()) {
-            return false;
-        }
-        else if (!type.isComposite()) {
-            return true;
-        }
-        else if (type.isArray()) {
-            return hasMappableFields(type.itemType());
-        }
-        else {
-            // struct
-            for (Field f : type.getFields()) {
-                if (hasMappableFields(f.getType())) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
     private Type checkTypes(List<?> value) {
         Type type = null;
         

Modified: trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -35,7 +35,6 @@
 import org.globus.cog.karajan.compiled.nodes.restartLog.RestartLog;
 import org.globus.cog.karajan.util.TypeUtil;
 import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class IsLogged extends SwiftFunction {
@@ -72,8 +71,11 @@
 	public static boolean isLogged(Context ctx, DSHandle var, Path path) throws ExecutionException {
 		@SuppressWarnings("unchecked")
         Map<LogEntry, Object> logData = (Map<LogEntry, Object>) ctx.getAttribute(RestartLog.LOG_DATA);
+		if (logData.isEmpty()) {
+		    return false;
+		}
 	    path = var.getPathFromRoot().append(path);
-        LogEntry entry = LogEntry.build(var.getRoot().getParam(MappingParam.SWIFT_RESTARTID) + "." + path.stringForm());
+        LogEntry entry = LogEntry.build(LogVar.getLogId(var, path));
         boolean found = false;
         synchronized (logData) {
             List<?> files = (List<?>) logData.get(entry);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -22,6 +22,7 @@
 
 import k.rt.Channel;
 import k.rt.Stack;
+import k.thr.LWThread;
 
 import org.globus.cog.karajan.analyzer.ArgRef;
 import org.globus.cog.karajan.analyzer.ChannelRef;
@@ -29,8 +30,9 @@
 import org.globus.cog.karajan.analyzer.VariableNotFoundException;
 import org.globus.cog.karajan.util.TypeUtil;
 import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
+import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 
 public class LogVar extends SwiftFunction {
     private ArgRef<DSHandle> var;
@@ -58,14 +60,21 @@
 	}
 	
 	public static void logVar(Channel<Object> log, DSHandle var, Path path) throws VariableNotFoundException {
-	    path = var.getPathFromRoot().append(path);
         String annotation;
-        if(var.getMapper() != null) {
-            annotation = "" + var.getMapper().map(path);
-        } else {
+        PhysicalFormat pf = var.map(path);
+        if (pf != null) {
+            annotation = "" + pf;
+        } 
+        else {
             annotation = "unmapped";
         }
-        log.add(var.getRoot().getParam(MappingParam.SWIFT_RESTARTID)
-                + "." + path.stringForm() + "!" + annotation);
+        log.add(getLogId(var, path) + "!" + annotation);
 	}
+	
+	public static String getLogId(DSHandle var, Path path) {
+		RootHandle root = var.getRoot();
+		LWThread thr = root.getThread();
+		return thr.getQualifiedName() + ":" + root.getName() + 
+		    "." + path.stringForm();
+	}
 }

Modified: trunk/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/New.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/New.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -27,6 +27,7 @@
 import k.rt.Context;
 import k.rt.ExecutionException;
 import k.rt.Stack;
+import k.thr.LWThread;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.analyzer.ArgRef;
@@ -40,25 +41,29 @@
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.DuplicateMappingChecker;
 import org.griphyn.vdl.mapping.ExternalDataNode;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.MappingParamSet;
-import org.griphyn.vdl.mapping.OOBYield;
+import org.griphyn.vdl.mapping.InvalidMapperException;
+import org.griphyn.vdl.mapping.Mapper;
+import org.griphyn.vdl.mapping.MapperFactory;
+import org.griphyn.vdl.mapping.NullMapper;
 import org.griphyn.vdl.mapping.RootArrayDataNode;
 import org.griphyn.vdl.mapping.RootDataNode;
-import org.griphyn.vdl.mapping.file.ConcurrentMapper;
+import org.griphyn.vdl.mapping.RootHandle;
+import org.griphyn.vdl.type.NoSuchTypeException;
 import org.griphyn.vdl.type.Type;
 import org.griphyn.vdl.type.Types;
 
 public class New extends SwiftFunction {
 	public static final Logger logger = Logger.getLogger(New.class);
 	
+	private static final Mapper NULL_MAPPER = new NullMapper();
+	
 	private ArgRef<String> type;
 	private ArgRef<Map<String, Object>> mapping;
 	private ArgRef<Object> value;
 	private ArgRef<String> dbgname;
 	private ArgRef<Number> waitCount;
 	private ArgRef<Boolean> input;
-	private ArgRef<String> _defline;
+	private ArgRef<Integer> _defline;
 	
 	private VarRef<Context> context;
 	private VarRef<String> cwd;
@@ -83,7 +88,7 @@
             throws CompilationException {
         Node fn = super.compile(w, scope);
         if (_defline.getValue() != null) {
-            setLine(Integer.parseInt(_defline.getValue()));
+            setLine(_defline.getValue());
         }
         tracer = Tracer.getTracer(this);
         return fn;
@@ -93,31 +98,37 @@
     public Object function(Stack stack) {
 		String typename = this.type.getValue(stack);
 		Object value = this.value.getValue(stack);
-        Map<String,Object> mapping = this.mapping.getValue(stack);
+        Map<String, Object> mapping = this.mapping.getValue(stack);
 		String dbgname = this.dbgname.getValue(stack);
 		Number waitCount = this.waitCount.getValue(stack);
 		boolean input = this.input.getValue(stack);
-		String line = this._defline.getValue(stack);
+		Integer line = this._defline.getValue(stack);
 		
-		MappingParamSet mps = new MappingParamSet();
-		mps.setAll(mapping);
-
-		if (dbgname != null) {
-			mps.set(MappingParam.SWIFT_DBGNAME, dbgname);
-		}
+		if (typename == null && value == null) {
+            throw new ExecutionException("You must specify either a type or a value");
+        }
+				
+		Mapper mapper;
 		
-		if (input) {
-		    mps.set(MappingParam.SWIFT_INPUT, true);
+		Type type = getType(typename);
+		if (type.hasNonPrimitiveComponents()) {
+		    String desc = (String) mapping.get("swift#descriptor");
+		    try {
+                mapper = MapperFactory.getMapper(desc);
+            }
+            catch (InvalidMapperException e) {
+                throw new ExecutionException(this, "Invalid mapper '" + desc + "'");
+            }
+		    mapping.remove("descriptor");
+		    mapper.setParameters(mapping);
+		    mapper.setBaseDir(cwd.getValue(stack));
 		}
-		
-		if (line != null) {
-		    mps.set(MappingParam.SWIFT_LINE, line);
+		else {
+		    mapper = NULL_MAPPER;
 		}
 		
-		String threadPrefix = getThreadPrefix();
+		LWThread thread = LWThread.currentThread();
 
-		mps.set(MappingParam.SWIFT_RESTARTID, threadPrefix + ":" + dbgname);
-
 		// input means never written to, but read at least once
 		int initialWriteRefCount;
 		boolean noWriters = input;
@@ -127,93 +138,59 @@
 		else {
 		    initialWriteRefCount = 0;
 		}
-
-		if (typename == null && value == null) {
-			throw new ExecutionException("You must specify either a type or a value");
-		}
 	
-		String mapper = (String) mps.get(MappingParam.SWIFT_DESCRIPTOR);
-		if ("concurrent_mapper".equals(mapper)) {
-		    mps.set(ConcurrentMapper.PARAM_THREAD_PREFIX, threadPrefix);
-		}
-		mps.set(MappingParam.SWIFT_BASEDIR, cwd.getValue(stack));
+		boolean initialize = true;
 		
 		try {
-			Type type;
-			if (typename == null) {
-				throw new ExecutionException("vdl:new requires a type specification for value: " + value);
-			}
-			else {
-				type = Types.getType(typename);
-			}
 			DSHandle handle;
 			if (typename.equals("external")) {
 			    if (tracer.isEnabled()) {
-			        tracer.trace(threadPrefix, dbgname + " = external");
+			        tracer.trace(thread, dbgname + " = external");
 			    }
-				handle = new ExternalDataNode();
+				handle = initHandle(new ExternalDataNode(dbgname), mapper, thread, line, input);
 			}
 			else if (type.isArray()) {
 				// dealing with array variable
-				handle = new RootArrayDataNode(type, getDMChecker(stack));
 				if (value != null) {
 					if (value instanceof RootArrayDataNode) {
 					    if (tracer.isEnabled()) {
-					        tracer.trace(threadPrefix, dbgname + " = " + Tracer.getVarName((RootDataNode) value));
+					        tracer.trace(thread, dbgname + " = " + Tracer.getVarName((RootDataNode) value));
 					    }
 						handle = (RootArrayDataNode) value;
 					}
 					else {
-						if (!(value instanceof List)) {
-							throw new ExecutionException("An array variable can only be initialized with a list of values");
-						}
-						if (tracer.isEnabled()) {
-                            tracer.trace(threadPrefix, dbgname + " = " + formatList((List<?>) value));
-                        }
-						int index = 0;
-						Iterator<?> i = ((List<?>) value).iterator();
-						while (i.hasNext()) {
-							// TODO check type consistency of elements with
-							// the type of the array
-							Object n = i.next();
-							if (n instanceof DSHandle) {
-								handle.getField(index).set((DSHandle) n);
-							}
-							else {
-								throw new RuntimeException(
-										"An array variable can only be initialized by a list of DSHandle values");
-							}
-							index++;
-						}
+					    handle = initHandle(createArrayFromList(stack, thread, dbgname, type), 
+					        mapper, thread, line, input); 		    
 					}
 					handle.closeShallow();
 				}
 				else {			    
 				    if (tracer.isEnabled()) {
-				        tracer.trace(threadPrefix, dbgname);
+				        tracer.trace(thread, dbgname);
                     }
-				}
-
-				handle.init(mps);
+				    handle = initHandle(createEmptyArray(stack, thread, dbgname, type), 
+                            mapper, thread, line, input);
+				}				
 			}
 			else if (value instanceof DSHandle) {
+			    // TODO Check this. Seems suspicious.
 			    if (tracer.isEnabled()) {
-			        tracer.trace(threadPrefix, dbgname + " = " + Tracer.getVarName((DSHandle) value));
+			        tracer.trace(thread, dbgname + " = " + Tracer.getVarName((DSHandle) value));
                 }
 				handle = (DSHandle) value;
 			}
 			else {
-				handle = new RootDataNode(type, getDMChecker(stack));
-				handle.init(mps);
+				handle = initHandle(new RootDataNode(dbgname, type, getDMChecker(stack)), 
+				    mapper, thread, line, input);
 				if (value != null) {
 				    if (tracer.isEnabled()) {
-				        tracer.trace(threadPrefix, dbgname + " = " + value);
+				        tracer.trace(thread, dbgname + " = " + value);
 				    }
 					handle.setValue(internalValue(type, value));
 				}
 				else {
 				    if (tracer.isEnabled()) {
-                        tracer.trace(threadPrefix, dbgname + " " + mps);
+                        tracer.trace(thread, dbgname + " " + mapper);
                     }
 				}
 			}
@@ -224,14 +201,67 @@
 			handle.setWriteRefCount(initialWriteRefCount);
 			return handle;
 		}
-		catch (OOBYield y) {
-		    throw y.wrapped(this);
-		}
 		catch (Exception e) {
 			throw new ExecutionException(this, e);
 		}
 	}
 
+    private DSHandle initHandle(RootHandle handle, Mapper mapper, LWThread thread, Integer line, boolean input) {
+        handle.setThread(thread);
+        if (line != null) {
+            handle.setLine(line);
+        }
+        handle.setInput(input);
+        handle.init(mapper);
+        return handle;
+    }
+
+    private RootHandle createArrayFromList(Stack stack, LWThread thread, String dbgname, Type type) 
+            throws NoSuchFieldException {
+        RootHandle handle = new RootArrayDataNode(dbgname, type, getDMChecker(stack));
+        if (!(value instanceof List)) {
+            throw new ExecutionException("An array variable can only be initialized with a list of values");
+        }
+        if (tracer.isEnabled()) {
+            tracer.trace(thread, dbgname + " = " + formatList((List<?>) value));
+        }
+        int index = 0;
+        Iterator<?> i = ((List<?>) value).iterator();
+        while (i.hasNext()) {
+            // TODO check type consistency of elements with
+            // the type of the array
+            Object n = i.next();
+            if (n instanceof DSHandle) {
+                handle.getField(index).set((DSHandle) n);
+            }
+            else {
+                throw new RuntimeException(
+                        "An array variable can only be initialized by a list of DSHandle values");
+            }
+            index++;
+        }
+        return handle;
+    }
+    
+    private RootHandle createEmptyArray(Stack stack, LWThread thread, String dbgname, Type type) 
+            throws NoSuchFieldException {
+        return new RootArrayDataNode(dbgname, type, getDMChecker(stack));
+    }
+
+    private Type getType(String typename) {
+        if (typename == null) {
+            throw new ExecutionException("vdl:new requires a type specification for value: " + value);
+        }
+        else {
+            try {
+                return Types.getType(typename);
+            }
+            catch (NoSuchTypeException e) {
+                throw new ExecutionException("Unknown type: " + typename, e);
+            }
+        }
+    }
+
     private DuplicateMappingChecker getDMChecker(Stack stack) {
         Context ctx = this.context.getValue(stack);
         return (DuplicateMappingChecker) ctx.getAttribute("SWIFT:DM_CHECKER");

Modified: trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -27,7 +27,6 @@
 import org.globus.cog.karajan.analyzer.Signature;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.InvalidPathException;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class NiceName extends SwiftFunction {
@@ -47,17 +46,18 @@
 			Path path = parsePath(this.path.getValue(stack));
 			DSHandle field = var.getField(path);
 			Path p = field.getPathFromRoot();
+			DSHandle root = field.getRoot();
 			if (p.equals(Path.EMPTY_PATH)) {
-				Object dbgname = field.getRoot().getParam(MappingParam.SWIFT_DBGNAME);
+				Object dbgname = root.getName();
 				if (dbgname == null) {
-					return "tmp"+field.getRoot().hashCode();
+					return "tmp" + root.hashCode();
 				}
 				else {
 					return dbgname;
 				}
 			}
 			else {
-				return field.getRoot().getParam(MappingParam.SWIFT_DBGNAME) + "." + p;
+				return root.getName() + "." + p;
 			}
 		}
 		catch (InvalidPathException e) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Operators.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Operators.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Operators.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -18,7 +18,6 @@
 package org.griphyn.vdl.karajan.lib;
 
 import k.rt.ExecutionException;
-import k.thr.LWThread;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.compiled.nodes.Node;

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -45,7 +45,6 @@
 import org.griphyn.vdl.karajan.WaitingThreadsMonitor;
 import org.griphyn.vdl.mapping.AbstractDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.InvalidPathException;
 import org.griphyn.vdl.mapping.Mapper;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.type.Type;
@@ -57,7 +56,7 @@
 	protected ArgRef<Object> path;
 	protected ArgRef<AbstractDataNode> value;
 	
-	protected ArgRef<String> _traceline;
+	protected ArgRef<Integer> _traceline;
 
 	@Override
     protected Signature getSignature() {
@@ -107,7 +106,7 @@
             throws CompilationException {
         Node fn = super.compile(w, scope);
         if (_traceline.getValue() != null) {
-        	setLine(Integer.parseInt(_traceline.getValue()));
+        	setLine(_traceline.getValue());
         }
         tracer = Tracer.getTracer(this);
         return fn;
@@ -129,16 +128,15 @@
 			DSHandle leaf = var.getField(path);
 			AbstractDataNode value = this.value.getValue(stack);
 			
-			String mdst = this.dst;
-			
-			if (mdst == null) {
-			    mdst = Tracer.getVarName(var);
-			    if (var.getParent() == null) {
-			        this.dst = mdst;
-			    }
-			}
-			
 			if (tracer.isEnabled()) {
+			    String mdst = this.dst;
+            
+                if (mdst == null) {
+                    mdst = Tracer.getVarName(var);
+                    if (var.getParent() == null) {
+                        this.dst = mdst;
+                    }
+                }
 			    log(leaf, value, LWThread.currentThread(), mdst);
 			}
 			    
@@ -282,7 +280,7 @@
 
     private static void copyNonComposite(DSHandle dest, DSHandle source, State state, int level) {
         Path dpath = dest.getPathFromRoot();
-        Mapper dmapper = dest.getRoot().getMapper();
+        Mapper dmapper = dest.getMapper();
         if (dmapper.canBeRemapped(dpath)) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Remapping " + dest + " to " + source);
@@ -306,7 +304,7 @@
             }
             else {
                 fc = new FileCopier(source.getMapper().map(source.getPathFromRoot()), 
-                    dest.getMapper().map(dpath));
+                    dmapper.map(dpath));
                 se.value(fc);
                 try {
                     fc.start();

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SwiftFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SwiftFunction.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SwiftFunction.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -47,7 +47,6 @@
 import org.globus.swift.catalog.transformation.File;
 import org.globus.swift.catalog.types.TCType;
 import org.griphyn.vdl.karajan.AssertFailedException;
-import org.griphyn.vdl.karajan.Loader;
 import org.griphyn.vdl.karajan.TCCache;
 import org.griphyn.vdl.karajan.functions.ConfigProperty;
 import org.griphyn.vdl.mapping.AbsFile;
@@ -61,6 +60,7 @@
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PathComparator;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 import org.griphyn.vdl.type.Type;
 import org.griphyn.vdl.type.Types;
 import org.griphyn.vdl.util.FQN;
@@ -184,12 +184,9 @@
 	}
 
 	private static String[] leavesFileNames(DSHandle var) throws ExecutionException, HandleOpenException {
-	    Mapper mapper;
-	    	    
-        synchronized (var.getRoot()) {
-            mapper = var.getMapper();
-        }
-        
+	    RootHandle root = var.getRoot();
+	    Mapper mapper = root.getMapper();
+	    	            
         if (mapper == null) {
             throw new ExecutionException(var.getType() + " is not a mapped type");
         }
@@ -216,19 +213,19 @@
 		return l.toArray(EMPTY_STRING_ARRAY);
 	}
 	
-	private static String leafFileName(DSHandle var) throws ExecutionException {
-	    return leafFileName(var, var.getMapper());
+	private static String leafFileName(DSHandle var) {
+	    return leafFileName(var, var.getRoot().getMapper());
 	}
-
-	private static String leafFileName(DSHandle var, Mapper mapper) throws ExecutionException {
+	
+	private static String leafFileName(DSHandle var, Mapper mapper) {
 		if (Types.STRING.equals(var.getType())) {
 			return relativize(String.valueOf(var.getValue()));
 		}
 		else {
-			if (var.getMapper() == null) {
+			if (mapper == null) {
 				throw new ExecutionException("Cannot invoke filename() on data without a mapper: " + var);
 			}
-			PhysicalFormat f = var.getMapper().map(var.getPathFromRoot());
+			PhysicalFormat f = mapper.map(var.getPathFromRoot());
 			if (f instanceof GeneralizedFileFormat) {
 				String filename = ((GeneralizedFileFormat) f).getURIAsString();
 				if (filename == null) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -42,7 +42,6 @@
 import org.globus.cog.karajan.compiled.nodes.UParallelFor;
 import org.globus.cog.karajan.parser.WrapperNode;
 import org.globus.cog.karajan.util.TypeUtil;
-import org.griphyn.vdl.karajan.Pair;
 import org.griphyn.vdl.util.VDL2Config;
 
 public class ThrottledParallelFor extends UParallelFor {
@@ -55,7 +54,7 @@
 	private ArgRef<String> refs;
 	private ArgRef<String> _kvar;
 	private ArgRef<String> _vvar;
-	private ArgRef<String> _traceline;
+	private ArgRef<Integer> _traceline;
 	
 	private boolean sc;
 	    
@@ -80,7 +79,7 @@
             throws CompilationException {
         srefs = StaticRefCount.build(scope, this.refs.getValue());
         if (_traceline.getValue() != null) {
-            setLine(Integer.parseInt(_traceline.getValue()));
+            setLine(_traceline.getValue());
         }
         forTracer = Tracer.getTracer(this, "FOREACH");
         iterationTracer = Tracer.getTracer(this, "ITERATION");

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -23,6 +23,7 @@
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.Mapper;
 import org.griphyn.vdl.mapping.Path;
+import org.griphyn.vdl.mapping.RootHandle;
 import org.griphyn.vdl.type.Types;
 import org.griphyn.vdl.util.VDL2Config;
 
@@ -63,7 +64,7 @@
         }
     }
     
-    private Tracer(String line, String name) {
+    private Tracer(int line, String name) {
         source = buildSource(line, name);
         enabled = true;
     }
@@ -78,8 +79,8 @@
     }
     
     private String buildSource(Node fe, String name) {
-        String line = findLine(fe);
-        if (line == null) {
+        int line = findLine(fe);
+        if (line == -1) {
             return null;
         }
         if (name == null) {
@@ -88,7 +89,7 @@
         return buildSource(line, name);      
     }
 
-    private String buildSource(String line, String name) {
+    private String buildSource(int line, String name) {
         StringBuilder sb = new StringBuilder();
         sb.append(name);
         sb.append(", line ");
@@ -107,8 +108,8 @@
         }
     }
 
-    private String findLine(Node fe) {
-        return String.valueOf(fe.getLine());
+    private int findLine(Node fe) {
+        return fe.getLine();
     }
 
     public boolean isEnabled() {
@@ -124,16 +125,16 @@
         logger.info(str);
     }
     
-    public void trace(String thread, String name, String line, Object msg) {
-        if (line == null) {
+    public void trace(String thread, String name, int line, Object msg) {
+        if (line == -1) {
             return;
         }
         String str = name + ", line " + line + ", thread " + threadName(thread) + ", "+ msg;
         logger.info(str);
     }
     
-    public void trace(String thread, String line, Object msg) {
-        if (line == null) {
+    public void trace(LWThread thread, int line, Object msg) {
+        if (line == -1) {
             return;
         }
         String str = source + ", line " + line + ", thread " + threadName(thread) + ", " + msg;
@@ -172,7 +173,7 @@
         }
     }
     
-    public static Tracer getTracer(String line, String name) {
+    public static Tracer getTracer(Integer line, String name) {
         if (globalTracingEnabled) {
             return new Tracer(line, name);
         }
@@ -270,7 +271,8 @@
     }
 
     public static Object fileName(AbstractDataNode n) {
-        Mapper m = n.getActualMapper();
+        RootHandle root = n.getRoot();
+        Mapper m = root.getActualMapper();
         if (m == null) {
             return "?" + getVarName(n);
         }

Modified: trunk/src/org/griphyn/vdl/karajan/lib/UnitEnd.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/UnitEnd.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/UnitEnd.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -21,18 +21,18 @@
     
     private ArgRef<String> type;
     private ArgRef<String> name;
-    private ArgRef<String> line;
+    private ArgRef<Integer> line;
     
     @Override
     protected Signature getSignature() {
-        return new Signature(params("type", optional("name", null), optional("line", null)));
+        return new Signature(params("type", optional("name", null), optional("line", -1)));
     }
     
     @Override
     public void run(LWThread thr) throws ExecutionException {
         String type = this.type.getValue();
         String name = this.name.getValue();
-        String line = this.line.getValue();
+        int line = this.line.getValue();
         
         UnitStart.log(false, type, thr, name, line);
         WaitingThreadsMonitor.removeOutput(thr);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/UnitStart.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/UnitStart.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/UnitStart.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -38,14 +38,14 @@
 
     private ArgRef<String> type;
     private ArgRef<String> name;
-    private ArgRef<String> line;
+    private ArgRef<Integer> line;
     private ArgRef<String> arguments;
     private ArgRef<String> outputs;
 
     @Override
     protected Signature getSignature() {
         return new Signature(params("type", optional("name", null),
-            optional("line", null),
+            optional("line", -1),
             optional("outputs", null), optional("arguments", null)));
     }
 
@@ -113,7 +113,7 @@
     protected void runBody(LWThread thr) {
         String type = this.type.getValue();
         String name = this.name.getValue();
-        String line = this.line.getValue();
+        Integer line = this.line.getValue();
 
         if (tracer != null && tracer.isEnabled()) {
             tracer.trace(thr, name + "("
@@ -163,7 +163,7 @@
     }
 
     protected static void log(boolean start, String type, LWThread thread,
-            String name, String line) {
+            String name, int line) {
         if (logger.isInfoEnabled()) {
             String threadName = SwiftFunction.getThreadPrefix(thread);
             if (type.equals("COMPOUND")) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/While.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/While.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/While.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -39,7 +39,7 @@
     
     private VarRef<Object> var;
     
-    private ArgRef<String> _traceline;
+    private ArgRef<Integer> _traceline;
     private List<StaticRefCount> srefs;
     private Tracer tracer;
     private ArgRef<String> refs;
@@ -53,7 +53,7 @@
             throws CompilationException {
         srefs = StaticRefCount.build(scope, this.refs.getValue());
         if (_traceline.getValue() != null) {
-            setLine(Integer.parseInt(_traceline.getValue()));
+            setLine(_traceline.getValue());
         }
         tracer = Tracer.getTracer(this);
         return super.compileBody(w, argScope, scope);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -64,7 +64,7 @@
 			readData(dest, (String) src.getValue());
 		}
 		else {
-			PhysicalFormat pf = src.getMapper().map(src.getPathFromRoot());
+			PhysicalFormat pf = src.map();
 			if (pf instanceof AbsFile) {
 				AbsFile af = (AbsFile) pf;
 				if (!af.getProtocol().equalsIgnoreCase("file")) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -63,7 +63,7 @@
 			dest.closeDeep();
 		}
 		else {
-			PhysicalFormat pf = src.getMapper().map(src.getPathFromRoot());
+			PhysicalFormat pf = src.map();
 			if (pf instanceof AbsFile) {
 				AbsFile af = (AbsFile) pf;
 				if (!af.getProtocol().equalsIgnoreCase("file")) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -68,7 +68,7 @@
 			writeData((String)dest.getValue(), src);
 		}
 		else {
-			PhysicalFormat pf = dest.getMapper().map(Path.EMPTY_PATH);
+			PhysicalFormat pf = dest.map();
 			if (pf instanceof AbsFile) {
 				AbsFile af = (AbsFile) pf;
 				if (!af.getProtocol().equalsIgnoreCase("file")) {

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -51,8 +51,6 @@
 
     public static final Logger logger = Logger.getLogger(AbstractDataNode.class);
 
-    public static final MappingParam PARAM_PREFIX = new MappingParam("prefix", null);
-
     /**
      * Datasets are identified within a run by this sequence number and the
      * partial ID field. The initial value is chosen to aid human recognition of
@@ -79,7 +77,7 @@
         catch (IOException e) {
         }
     }
-
+    
     private Field field;
     private Map<Comparable<?>, DSHandle> handles;
     private Object value;
@@ -89,7 +87,7 @@
     
     private int writeRefCount;
     private List<FutureListener> listeners;
-    
+        
     protected static final Tracer variableTracer = Tracer.getTracer("VARIABLE");
 
     protected AbstractDataNode(Field field) {
@@ -113,15 +111,16 @@
             }
         }
     }
-
-    public void init(MappingParamSet params) throws HandleOpenException {
-        throw new UnsupportedOperationException();
+    
+    public String getName() {
+        return getRoot().getName();
     }
     
-    public final void init(Map<String, Object> params) {
-        throw new UnsupportedOperationException();
+    @Override
+    public void setName(String name) {
+        throw new UnsupportedOperationException("setName can only be called on a root variable");
     }
-
+    
     public Type getType() {
         return field.getType();
     }
@@ -226,14 +225,7 @@
     }
 
     public String getDisplayableName() {
-        String prefix = getRoot().getParam(MappingParam.SWIFT_DBGNAME);
-        if (prefix == null) {
-            prefix = getRoot().getParam(PARAM_PREFIX);
-        }
-        if (prefix == null) {
-            prefix = "?";
-        }
-        return prefix;
+        return getName();
     }
     
     public String getFullName() {
@@ -246,26 +238,6 @@
             return name + "." + p;
         }
     }
-    
-    public String getDeclarationLine() {
-        String line = getRoot().getParam(MappingParam.SWIFT_LINE);
-        if (line == null || line.length() == 0) {
-        	return null;
-        }
-        else {
-        	return line;
-        }
-    }
-    
-    public String getThread() {
-        String restartId = getRoot().getParam(MappingParam.SWIFT_RESTARTID);
-        if (restartId != null) {
-            return restartId.substring(0, restartId.lastIndexOf(":"));
-        }
-        else {
-            return null;
-        }
-    }
 
     public DSHandle getField(Path path) throws InvalidPathException {
         if (path.isEmpty()) {
@@ -388,7 +360,6 @@
             }
             return dn;
         }
-
     }
         
     protected Field getChildField(Comparable<?> key) throws NoSuchFieldException {
@@ -396,7 +367,7 @@
             return Field.Factory.createField(key, getType().itemType());
         }
         else {
-            return Field.Factory.createField(key, getType().getField((String) key).getType());
+            return Field.Factory.getImmutableField(key, getType().getField((String) key).getType());
         }
     }
     
@@ -566,8 +537,8 @@
                 }
 
                 try {
-                    if(filemapped) {
-                        Object path = m.map(pathFromRoot);
+                    if (filemapped) {
+                        Object path = map();
                         if (logger.isInfoEnabled()) {
                             logger.info("FILENAME dataset=" + identifier + " filename=" + path);
                         }
@@ -648,7 +619,28 @@
     public Mapper getMapper() {
         return ((AbstractDataNode) getRoot()).getMapper();
     }
+    
+    @Override
+    public PhysicalFormat map(Path path) {
+        Mapper m = getMapper();
+        if (m == null) {
+            return null;
+        }
+        else {
+            Path p = getPathFromRoot().append(path);
+            return m.map(p);
+        }
+    }
 
+    @Override
+    public PhysicalFormat map() {
+        return map(Path.EMPTY_PATH);
+    }
+
+    public MappingParamSet getMappingParams() {
+        return getRoot().getMappingParams();
+    }
+
     protected Map<Comparable<?>, DSHandle> getHandles() {
         return handles;
     }
@@ -719,7 +711,7 @@
                 throw new RuntimeException(getFullName() + " has no value");
             }
             else {
-                throw new MissingDataException(this, getMapper().map(getPathFromRoot()));
+                throw new MissingDataException(this, map());
             }
         }
     }
@@ -768,7 +760,7 @@
             }
         }
         else if (!getType().isArray() && !getType().isPrimitive()) {
-            Mapper mapper = getRoot().getMapper();
+            Mapper mapper = getMapper();
             if (mapper != null) {
                 mapper.clean(getPathFromRoot());
             }
@@ -797,7 +789,8 @@
         }
         if (this.writeRefCount == 0) {
             if (variableTracer.isEnabled()) {
-                variableTracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " CLOSE write ref count is zero");
+                RootHandle root = getRoot();
+                variableTracer.trace(root.getThread(), root.getLine(), getDisplayableName() + " CLOSE write ref count is zero");
             }
             closeDeep();
         }

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -18,6 +18,7 @@
 package org.griphyn.vdl.mapping;
 
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.log4j.Logger;
@@ -32,73 +33,88 @@
 public abstract class AbstractMapper implements Mapper {
 
 	public static final Logger logger = Logger.getLogger(AbstractMapper.class);
-	public static final MappingParam PARAM_INPUT = new MappingParam("input", Boolean.FALSE);
 	
-	protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_INPUT);
-	}
+	private MappingParamSet params;
+	private String baseDir;
 	
-	protected void addParams(Set<String> s, MappingParam... params) {
-	    for (MappingParam p : params) {
-	        s.add(p.getName());
-	    }
+    public String getBaseDir() {
+        return baseDir;
     }
-	
+
+    public void setBaseDir(String baseDir) {
+        this.baseDir = baseDir;
+    }
+
     @Override
     public final Set<String> getSupportedParamNames() {
         Set<String> s = new HashSet<String>();
         getValidMappingParams(s);
         return s;
     }
+    
+    protected void getValidMappingParams(Set<String> s) {
+    }
+    
+    protected abstract MappingParamSet newParams();
+    
+    @SuppressWarnings("unchecked")
+    protected <T> T getParams() {
+        return (T) params;
+    }
+    
+    @Override
+    public void setParameters(Map<String, Object> params) {
+        this.params = newParams();
+        this.params.setAll(params);
+    }
 
-    protected MappingParamSet params;
+    @Override
+    public AbstractDataNode getFirstOpenParameter() {
+        if (params != null) {
+            return params.getFirstOpen();
+        }
+        else {
+            return null;
+        }
+    }
 
-	public synchronized void setParam(MappingParam param, Object value) {
-		if (params == null) {
-			params = new MappingParamSet();
-		}
-		params.set(param, value);
-	}
+    @Override
+    public void initialize(RootHandle root) {
+        params.unwrapPrimitives();
+    }
 
-	public synchronized Object getParam(MappingParam param) {
-		if (params != null) {
-			return params.get(param);
+    @Override
+	public boolean exists(Path path) {
+		if (logger.isDebugEnabled()) {
+			logger.debug("checking for existence of " + path);
 		}
-		else {
-			return null;
-		}
-	}
-
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		this.params = params;
-	}
-
-	public boolean exists(Path path) {
-		if(logger.isDebugEnabled())
-			logger.debug("checking for existence of "+path);
 		boolean r = ((AbsFile) map(path)).exists();
 		if(logger.isDebugEnabled()) {
-			if(r) {
-				logger.debug(""+path+" exists");
+			if (r) {
+				logger.debug(path + " exists");
 			} else {
-				logger.debug(""+path+" does not exist");
+				logger.debug(path + " does not exist");
 			}
 		}
 		return r;
 	}
 
+    @Override
 	public boolean canBeRemapped(Path path) {
 	    return false;
 	}
 
+    @Override
     public void remap(Path path, Mapper sourceMapper, Path sourcePath) {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public void clean(Path path) {
         // no cleaning by default
     }
 
+    @Override
     public boolean isPersistent(Path path) {
         // persistent unless explicitly overridden
         return true;
@@ -115,4 +131,23 @@
             FileGarbageCollector.getDefault().increaseUsageCount(pf);
         }
     }
+    
+    public abstract String getName();
+    
+    @Override
+    public String toString() {
+        Object desc = getName();
+        if (desc == null) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        sb.append("<");
+        sb.append(desc);
+        sb.append("; ");
+        if (params != null) {
+            params.toString(sb);
+        }
+        sb.append('>');
+        return sb.toString();
+    }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -34,7 +34,7 @@
     
 	private List<Comparable<?>> keyList;
 	
-	protected ArrayDataNode(Field field, DSHandle root, AbstractDataNode parent) {
+	protected ArrayDataNode(Field field, RootHandle root, AbstractDataNode parent) {
 		super(field, root, parent);
 	}
 	

Modified: trunk/src/org/griphyn/vdl/mapping/DSHandle.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DSHandle.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/DSHandle.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -46,11 +46,13 @@
     /** get the type of the dataset.
      */
     public Type getType();
+    
+    public String getName();
+    
+    public void setName(String name);
 
-    public void init(MappingParamSet params) throws HandleOpenException;
+    public RootHandle getRoot();
 
-    public DSHandle getRoot();
-
     public DSHandle getParent();
 
     /** returns the field below this node that is referred to by the
@@ -96,14 +98,19 @@
 
     public void set(DSHandle svar);
 
-    public String getParam(MappingParam name);
-
     public boolean isClosed();
 
     public void addListener(DSHandleListener listener);
 
     Mapper getMapper();
-
+    
+    /**
+     * Maps the specified path relative to this node
+     */
+    PhysicalFormat map(Path path);
+    
+    PhysicalFormat map();
+    
     public String getIdentifier();
 
     public String getIdentifyingString();

Modified: trunk/src/org/griphyn/vdl/mapping/DataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/DataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -24,10 +24,10 @@
 
 
 public class DataNode extends AbstractDataNode {
-	private DSHandle root;
+	private RootHandle root;
 	private AbstractDataNode parent;
 	
-	protected DataNode(Field field, DSHandle root, AbstractDataNode parent) {
+	protected DataNode(Field field, RootHandle root, AbstractDataNode parent) {
 		super(field);
 		if (parent != null && field.getId() == null) {
 		    throw new IllegalArgumentException("Internal error: field id is null");
@@ -36,7 +36,7 @@
 		this.parent = parent;
 	}
 	
-	public DSHandle getRoot() {
+	public RootHandle getRoot() {
 		return root;
 	}
 	
@@ -51,8 +51,4 @@
 	public void setParent(AbstractDataNode parent) {
 		this.parent = parent;
 	}
-
-	public String getParam(MappingParam p) {
-		return null;
-	}
 }

Modified: trunk/src/org/griphyn/vdl/mapping/DependentException.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DependentException.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/DependentException.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -43,13 +43,8 @@
 	}
 	
 	public String getVariableInfo() {
-        if (handle instanceof AbstractDataNode) {
-            AbstractDataNode n = (AbstractDataNode) handle;
-            return n.getDisplayableName() + ", line " + n.getDeclarationLine();
-        }
-        else {
-            return handle.toString();
-        }
+	    RootHandle root = handle.getRoot();
+	    return root.getName() + ", line " + root.getLine();
     }
 
 	public String toString() {

Modified: trunk/src/org/griphyn/vdl/mapping/DuplicateMappingChecker.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DuplicateMappingChecker.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/DuplicateMappingChecker.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -31,9 +31,10 @@
     }
     
     private static class Info {
-        private final String name, line;
+        private final String name;
+        private final Integer line;
         
-        public Info(String name, String line) {
+        public Info(String name, Integer line) {
             this.name = name;
             this.line = line;
         }
@@ -81,7 +82,7 @@
     private Info getInfo(DSHandle h) {
         if (h instanceof AbstractDataNode) {
             AbstractDataNode a = (AbstractDataNode) h;
-            return new Info(a.getDisplayableName(), a.getDeclarationLine());
+            return new Info(a.getDisplayableName(), a.getRoot().getLine());
         }
         else {
             return new Info(String.valueOf(h), null);

Modified: trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -22,39 +22,75 @@
 import java.util.List;
 import java.util.Map;
 
+import k.thr.LWThread;
+
 import org.apache.log4j.Logger;
 import org.griphyn.vdl.karajan.Loader;
 import org.griphyn.vdl.type.Types;
 import org.griphyn.vdl.type.impl.FieldImpl;
 
-public class ExternalDataNode extends AbstractDataNode {
+public class ExternalDataNode extends AbstractDataNode implements RootHandle {
 
 	static final String DATASET_URI_PREFIX = "dataset:external:";
 
 	public static final Logger logger = Logger.getLogger(ExternalDataNode.class);
 	
-	public static final MappingParam PARAM_PREFIX = new MappingParam("prefix", null);
-
 	private static long datasetIDCounter = 850000000000l;
 
 	private static final String datasetIDPartialID = Loader.getUUID();
 	
-	private MappingParamSet params;
+    // previously in mapper params
+    private int line = -1;
+    private LWThread thread;
+    private boolean input;
 
-	public ExternalDataNode() {
-	    super(new FieldImpl("", Types.EXTERNAL));
+	
+	public ExternalDataNode(String name) {
+	    super(new FieldImpl(name, Types.EXTERNAL));
 	}
 
+    public int getLine() {
+        return line;
+    }
+
+    public void setLine(int line) {
+        this.line = line;
+    }
+
+    public boolean isInput() {
+        return input;
+    }
+
+    public void setInput(boolean input) {
+        this.input = input;
+    }
+
+    public void setThread(LWThread thread) {
+        this.thread = thread;
+    }
+
+    public LWThread getThread() {
+        return thread;
+    }
+
+	public String getName() {
+        return (String) getField().getId();
+    }
+	
 	@Override
-    public void init(MappingParamSet params) {
-        this.params = params;
+    public void setName(String name) {
+        getField().setId(name);
     }
 
+	@Override
+    public void init(Mapper mapper) {
+    }
+
     public boolean isRestartable() {
 		return true;
 	}
 
-	public DSHandle getRoot() {
+	public RootHandle getRoot() {
 		return this;
 	}
 
@@ -118,13 +154,6 @@
         return null;
     }
 
-    public String getParam(MappingParam p) {
-        if (params == null) {
-            return null;
-        }
-        return (String) params.get(p);
-    }
-
     @Override
     public void closeDeep() {
         /*

Modified: trunk/src/org/griphyn/vdl/mapping/Mapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/Mapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/Mapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -18,6 +18,7 @@
 package org.griphyn.vdl.mapping;
 
 import java.util.Collection;
+import java.util.Map;
 import java.util.Set;
 
 /** This interface must be implemented by a Java class that represents
@@ -54,11 +55,7 @@
      *   but a necessary compromise.
      */
     boolean isStatic();
-
-    void setParams(MappingParamSet params) throws HandleOpenException;
-
-    Object getParam(MappingParam name);
-
+    
     /**
      * Specifies whether paths mapped by this mapper can be re-mapped
      * if needed (such as when aliasing another variable)
@@ -77,8 +74,18 @@
      */
     void clean(Path paths);
     
-    
     boolean isPersistent(Path path);
     
     Set<String> getSupportedParamNames();
+    
+    void setParameters(Map<String, Object> params);
+    
+    /**
+     * Called after all parameters have been closed
+     */
+    void initialize(RootHandle root);
+    
+    void setBaseDir(String baseDir);
+    
+    AbstractDataNode getFirstOpenParameter();
 }

Modified: trunk/src/org/griphyn/vdl/mapping/MapperFactory.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MapperFactory.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/MapperFactory.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -21,6 +21,7 @@
 package org.griphyn.vdl.mapping;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -42,39 +43,41 @@
 	private static Map<String, Class<? extends Mapper>> mappers;
 	
 	private static Map<String, Set<String>> validParams;
+	private static Set<String> deprecated;
+	private static Set<String> warned;
 
 	static {
 	    mappers = new HashMap<String, Class<? extends Mapper>>();
+	    deprecated = new HashSet<String>();
 	    validParams = new HashMap<String, Set<String>>();
+	    warned = new HashSet<String>();
 	    
 		// the following are general purpose file mappers
-		registerMapper("simple_mapper", SimpleFileMapper.class);
-		registerMapper("single_file_mapper", SingleFileMapper.class);
-		registerMapper("fixed_array_mapper", FixedArrayFileMapper.class);
-		registerMapper("concurrent_mapper", ConcurrentMapper.class);
-		registerMapper("filesys_mapper", FileSystemArrayMapper.class);
-		registerMapper("regexp_mapper", RegularExpressionMapper.class);
-		registerMapper("structured_regexp_mapper",
+		registerMapper("SimpleMapper", "simple_mapper", SimpleFileMapper.class);
+		registerMapper("SingleFileMapper", "single_file_mapper", SingleFileMapper.class);
+		registerMapper("FixedArrayMapper", "fixed_array_mapper", FixedArrayFileMapper.class);
+		registerMapper("ConcurrentMapper", "concurrent_mapper", ConcurrentMapper.class);
+		registerMapper("FilesysMapper", "filesys_mapper", FileSystemArrayMapper.class);
+		registerMapper("RegexpMapper", "regexp_mapper", RegularExpressionMapper.class);
+		registerMapper("StructuredRegexpMapper", "structured_regexp_mapper",
 			StructuredRegularExpressionMapper.class);
-		registerMapper("csv_mapper", CSVMapper.class);
-		registerMapper("array_mapper", ArrayFileMapper.class);
+		registerMapper("CSVMapper", "csv_mapper", CSVMapper.class);
+		registerMapper("ArrayMapper", "array_mapper", ArrayFileMapper.class);
 
 		// the following are application-specific mappers
-		registerMapper("airsn_mapper", AirsnMapper.class);
-		registerMapper("roi_mapper", ROIMapper.class);
-		registerMapper("ext", ExternalMapper.class);
-		registerMapper("test_mapper", TestMapper.class);
+		registerMapper("AIRSNMapper", "airsn_mapper", AirsnMapper.class);
+		registerMapper("ROIMapper", "roi_mapper", ROIMapper.class);
+		registerMapper("Ext", "ext", ExternalMapper.class);
+		registerMapper("TestMapper", "test_mapper", TestMapper.class);
 	}
 
-	public synchronized static Mapper getMapper(String type, MappingParamSet params) throws InvalidMapperException {
+	public synchronized static Mapper getMapper(String type) throws InvalidMapperException {
 		Class<? extends Mapper> cls = mappers.get(type);
 		if (cls == null) {
 			throw new InvalidMapperException("No such mapper: "+type);
 		}
 		try {
-			Mapper mapper = cls.newInstance();
-			mapper.setParams(params);
-			return mapper;
+			return cls.newInstance();
 		}
 		catch (Exception e) {
 			throw new InvalidMapperException(type + ": " + e.getMessage(), e);
@@ -86,15 +89,24 @@
 	}
 	
     @SuppressWarnings("unchecked")
-    public static void registerMapper(String type, String cls) throws ClassNotFoundException {
-	    registerMapper(type, (Class<? extends Mapper>) MapperFactory.class.getClassLoader().loadClass(cls));
+    public static void registerMapper(String type, String deprecatedType, String cls) throws ClassNotFoundException {
+	    registerMapper(type, deprecatedType, 
+	        (Class<? extends Mapper>) MapperFactory.class.getClassLoader().loadClass(cls));
 	}
 
-    public synchronized static void registerMapper(String type, Class<? extends Mapper> cls) {
+    public synchronized static void registerMapper(String type, String deprecatedType, Class<? extends Mapper> cls) {
 		mappers.put(type, cls);
+		if (deprecatedType != null) {
+		    deprecated.add(deprecatedType);
+		    mappers.put(deprecatedType, cls);
+		}
 		try {
 		    Mapper m = cls.newInstance();
-		    validParams.put(type, m.getSupportedParamNames());
+		    Set<String> params = m.getSupportedParamNames();
+		    validParams.put(type, params);
+		    if (deprecatedType != null) {
+		        validParams.put(deprecatedType, params);
+		    }
 		}
 		catch (Exception e) {
 		    throw new RuntimeException("Cannot instantiate a '" + type + "'", e);

Modified: trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -4,74 +4,84 @@
 package org.griphyn.vdl.mapping;
 
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Map;
 
 import org.griphyn.vdl.karajan.lib.Tracer;
 
-public class MappingParamSet {
-    private Map<String, Object> params;
+
+public abstract class MappingParamSet {
     
-    public MappingParamSet() {
-        params = new HashMap<String, Object>();
-    }
-
-    public void set(MappingParam p, Object value) {
-        params.put(p.getName(), value);
-    }
-
-    public void setAll(Map<String, Object> m) {
-        if (m != null) {
-            for (Map.Entry<String, Object> e : m.entrySet()) {
-                params.put(e.getKey(), e.getValue());
+    public void set(String name, Object value) {
+        try {
+            if (!set0(name, value)) {
+                throw new IllegalArgumentException("Unsupported parameter: '" + name + "'");
             }
         }
+        catch (ClassCastException e) {
+            throw new IllegalArgumentException("Invalid class (" + 
+                value.getClass().getName() + ") for parameter '" + name + "'");
+        }
     }
 
-    public Object get(MappingParam p) {
-        return params.get(p.getName());
+    protected boolean set0(String name, Object value) {
+        return false;
     }
     
-    public boolean isPresent(MappingParam p) {
-        return params.containsKey(p.getName());
+    public AbstractDataNode getFirstOpen() {
+        return null;
     }
-
-    public AbstractDataNode getFirstOpenParamValue() {
-        for (Map.Entry<String, Object> entry : params.entrySet()) {
-            Object v = entry.getValue();
-            if (v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
-                return (AbstractDataNode) v;        
-            }
+    
+    public abstract Collection<String> getNames();
+    
+    public void toString(StringBuilder sb) {
+    }
+    
+    protected void addParam(StringBuilder sb, String name, Object value) {
+        sb.append(", ");
+        sb.append(name);
+        sb.append(" = ");
+        sb.append(Tracer.unwrapHandle(value));
+    }
+    
+    protected boolean checkOpen(Object v) {
+        if (v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
+            return true;        
         }
-        return null;
+        else {
+            return false;
+        }
     }
 
-    public Collection<String> names() {
-        return params.keySet();
+    public void unwrapPrimitives() {
     }
-
-    @Override
-    public String toString() {
-        Object desc = get(MappingParam.SWIFT_DESCRIPTOR);
-        if (desc == null) {
-            return "";
+    
+    /** 
+     * Unwraps objects stored in AbstractDataNodes 
+     */
+    public Object unwrap(Object value) {
+        if (value instanceof AbstractDataNode) {
+            AbstractDataNode handle = (AbstractDataNode) value;
+            if (!handle.isPrimitive()) {
+                throw new IllegalArgumentException("Cannot unwrap non-primitive data");
+            }
+            return handle.getValue();
         }
-        StringBuilder sb = new StringBuilder();
-        sb.append("<");
-        sb.append(desc);
-        sb.append("; ");
-        sb.append("input = " + get(MappingParam.SWIFT_INPUT));
-        for (String name : names()) {
-            if (name.indexOf('#') >= 0) {
-                // skip internal parameters
-                continue;
+        else {
+            return value;
+        }
+    }
+        
+    public void setAll(Map<String, Object> m) {
+        if (m != null) {
+            for (Map.Entry<String, Object> e : m.entrySet()) {
+                set0(e.getKey(), e.getValue());
             }
-            sb.append(", ");
-            sb.append(name);
-            sb.append(" = ");
-            sb.append(Tracer.unwrapHandle(params.get(name)));
         }
-        sb.append('>');
-        return sb.toString();
     }
+
+    private void append(StringBuilder sb, String name, Object value) {
+        sb.append(name);
+        sb.append(" = ");
+        sb.append(value);
+    }
 }

Added: trunk/src/org/griphyn/vdl/mapping/NullMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/NullMapper.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/NullMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,83 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 18, 2013
+ */
+package org.griphyn.vdl.mapping;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+
+public class NullMapper implements Mapper {
+    public NullMapper() {
+    }
+
+    @Override
+    public PhysicalFormat map(Path path) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean exists(Path path) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<Path> existing() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isStatic() {
+        return false;
+    }
+
+    @Override
+    public boolean canBeRemapped(Path path) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void remap(Path path, Mapper sourceMapper, Path sourcePath) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void clean(Path paths) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isPersistent(Path path) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Set<String> getSupportedParamNames() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public void setParameters(Map<String, Object> params) {
+    }
+
+    @Override
+    public void initialize(RootHandle root) {
+    }
+
+    @Override
+    public void setBaseDir(String baseDir) {
+    }
+
+    @Override
+    public AbstractDataNode getFirstOpenParameter() {
+        return null;
+    }
+}

Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -19,6 +19,7 @@
 
 import k.rt.Future;
 import k.rt.FutureListener;
+import k.thr.LWThread;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.futures.FutureNotYetAvailable;
@@ -26,72 +27,102 @@
 import org.griphyn.vdl.type.Field;
 import org.griphyn.vdl.type.Type;
 
-public class RootArrayDataNode extends ArrayDataNode implements FutureListener {
+public class RootArrayDataNode extends ArrayDataNode implements FutureListener, RootHandle {
 
     Logger logger = Logger.getLogger(RootArrayDataNode.class);
     
 	private boolean initialized = false;
 	private Mapper mapper;
-	private MappingParamSet params;
 	private AbstractDataNode waitingMapperParam;
-	private DuplicateMappingChecker dmc;
-
+	private DuplicateMappingChecker dmc;
+	
+    // previously in mapper params
+    private int line = -1;
+    private LWThread thread;
+    private boolean input;
+
+	
+	public RootArrayDataNode(Type type) {
+	    this("?", type);
+	}
 	/**
 	 * Instantiate a root array data node with specified type.
 	 */
-	public RootArrayDataNode(Type type) {
-		super(Field.Factory.createField(null, type), null, null);
+	public RootArrayDataNode(String name, Type type) {
+		super(Field.Factory.getImmutableField(name, type), null, null);
 	}
 	
-	public RootArrayDataNode(Type type, DuplicateMappingChecker dmc) {
-	    this(type);
+	public RootArrayDataNode(String name, Type type, DuplicateMappingChecker dmc) {
+	    this(name, type);
 	    this.dmc = dmc;
-	}
-
-	public void init(MappingParamSet params) throws HandleOpenException {
-		this.params = params;
-		if (this.params == null) {
-			initialized();
+	}
+	
+    public int getLine() {
+        return line;
+    }
+
+    public void setLine(int line) {
+        this.line = line;
+    }
+
+    public boolean isInput() {
+        return input;
+    }
+
+    public void setInput(boolean input) {
+        this.input = input;
+    }
+
+    public void setThread(LWThread thread) {
+        this.thread = thread;
+    }
+
+    public LWThread getThread() {
+        return thread;
+    }
+	
+	public String getName() {
+        return (String) getField().getId();
+    }
+	
+	@Override
+    public void setName(String name) {
+        getField().setId(name);
+    }
+
+	@Override
+	public void init(Mapper mapper) {
+		this.mapper = mapper;
+		if (this.mapper == null) {
+			initialized();
+			if (isInput()) {
+                // Empty array. Clearly only in test cases.
+                closeDeep();
+            }
 		}
 		else {
 			innerInit();
 		}
 	}
 
-	private synchronized void innerInit() throws HandleOpenException {
+	private synchronized void innerInit() {
 		if (logger.isDebugEnabled()) {
 		    logger.debug("innerInit: " + this);
 		}
 	    
-		waitingMapperParam = params.getFirstOpenParamValue();
+		waitingMapperParam = mapper.getFirstOpenParameter();
         if (waitingMapperParam != null) {
             waitingMapperParam.addListener(this);
             if (variableTracer.isEnabled()) {
-                variableTracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " WAIT " 
+                variableTracer.trace(getThread(), getLine(), getName() + " WAIT " 
                     + Tracer.getVarName(waitingMapperParam));
             }
             return;
         }
-	    
-		String desc = (String) params.get(MappingParam.SWIFT_DESCRIPTOR);
-		if (desc == null) {
-			initialized();
-			Boolean input = (Boolean) params.get(MappingParam.SWIFT_INPUT);
-			if (input != null && input.booleanValue()) {
-			    // Empty array. Clearly only in test cases.
-			    closeDeep();
-			}
-			return;
-		}
-		try {
-			mapper = MapperFactory.getMapper(desc, params);
-			getField().setId(PARAM_PREFIX.getStringValue(mapper));
-			initialized();
-			checkInputs();
-		}
-		catch (InvalidMapperException e) {
-			throw new RuntimeException(e);
-		}
+	    
+        mapper.initialize(this);
+		initialized();
+		checkInputs();
 		if (isClosed()) {
 		    notifyListeners();
 		}
@@ -99,7 +130,7 @@
 
 	private void checkInputs() {
 		try {
-			RootDataNode.checkInputs(params, mapper, this, dmc);
+			RootDataNode.checkInputs(this, dmc);
 		}
 		catch (DependentException e) {
 			setValue(new MappingDependentException(this, e));
@@ -110,22 +141,12 @@
 	    try {
             innerInit();
         }
-        catch (OOBYield e) {
-            throw e.wrapped();
-        }
         catch (Exception e) {
             this.setValue(new MappingException(this, e));
         }
     }
-
-	public String getParam(MappingParam p) {
-		if (params == null) {
-			return null;
-		}
-		return (String) params.get(p);
-	}
-
-	public DSHandle getRoot() {
+	
+	public RootHandle getRoot() {
 		return this;
 	}
 
@@ -162,7 +183,7 @@
         initialized = true;
         waitingMapperParam = null;
         if (variableTracer.isEnabled()) {
-            variableTracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED " + params);
+            variableTracer.trace(getThread(), getLine(), getName() + " INITIALIZED " + mapper);
         }
     }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -22,6 +22,7 @@
 
 import k.rt.Future;
 import k.rt.FutureListener;
+import k.thr.LWThread;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.futures.FutureNotYetAvailable;
@@ -29,34 +30,76 @@
 import org.griphyn.vdl.type.Field;
 import org.griphyn.vdl.type.Type;
 
-public class RootDataNode extends AbstractDataNode implements FutureListener {
+public class RootDataNode extends AbstractDataNode implements FutureListener, RootHandle {
 
     static Logger logger = Logger.getLogger(RootDataNode.class);
     
-	private boolean initialized=false;
+	private boolean initialized = false;
 	private Mapper mapper;
-	private MappingParamSet params;
 	private AbstractDataNode waitingMapperParam;
 	private DuplicateMappingChecker dmc;
 	
-	public RootDataNode(Type type, DuplicateMappingChecker dmc) {
-		super(Field.Factory.createField(null, type));
+    // previously in mapper params
+    private int line = -1;
+    private LWThread thread;
+    private boolean input;
+
+	
+	public RootDataNode(String name, Type type, DuplicateMappingChecker dmc) {
+		super(Field.Factory.getImmutableField(name, type));
 		this.dmc = dmc;
 	}
 	
-	public RootDataNode(Type type) {
-	    this(type, null);
+	public RootDataNode(Type type, Object value) {
+        this("?", type, value);
+    }
+	
+	public RootDataNode(String name, Type type) {
+	    this(name, type, null);
 	}
 	
-	public RootDataNode(Type type, Object value) {
-	    this(type);
+	public RootDataNode(String name, Type type, Object value) {
+	    this(name, type);
 	    initialized();
 	    setValue(value);
 	}
+	
+	    public int getLine() {
+        return line;
+    }
 
-	public void init(MappingParamSet params) throws HandleOpenException {
-		this.params = params;
-		if (this.params == null) { 
+    public void setLine(int line) {
+        this.line = line;
+    }
+
+    public boolean isInput() {
+        return input;
+    }
+
+    public void setInput(boolean input) {
+        this.input = input;
+    }
+
+    public void setThread(LWThread thread) {
+        this.thread = thread;
+    }
+
+    public LWThread getThread() {
+        return thread;
+    }
+	
+	public String getName() {
+	    return (String) getField().getId();
+	}
+
+	@Override
+    public void setName(String name) {
+	    getField().setId(name);
+    }
+	
+    public void init(Mapper mapper) {
+		this.mapper = mapper;
+		if (mapper == null) { 
 			initialized();
 		} 
 		else {
@@ -67,36 +110,25 @@
 	/** must have this.params set to the appropriate parameters before
 	    being called. 
 	 * @throws HandleOpenException */
-	private synchronized void innerInit() throws HandleOpenException {
-	    waitingMapperParam = params.getFirstOpenParamValue();
+	private synchronized void innerInit() {
+	    waitingMapperParam = mapper.getFirstOpenParameter();
 	    if (waitingMapperParam != null) {
             waitingMapperParam.addListener(this);
             if (variableTracer.isEnabled()) {
-                variableTracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " WAIT " 
+                variableTracer.trace(getThread(), getLine(), getDisplayableName() + " WAIT " 
                     + Tracer.getVarName(waitingMapperParam));
             }
             return;
 	    }
 	    
-		String desc = (String) params.get(MappingParam.SWIFT_DESCRIPTOR);
-		if (desc == null) {
-			initialized();
-			return;
-		}
-		try {
-			mapper = MapperFactory.getMapper(desc, params);
-			getField().setId(PARAM_PREFIX.getStringValue(mapper));
-			// initialized means that this data has its mapper initialized
-			// this should be called before checkInputs because the latter
-			// may trigger calls to things that try to access this data node's
-			// mapper
-            initialized();
-			checkInputs();
-		}
-		catch (InvalidMapperException e) {
-			throw new RuntimeException
-			("InvalidMapperException caught in mapper initialization", e);
-		}
+		// initialized means that this data has its mapper initialized
+		// this should be called before checkInputs because the latter
+		// may trigger calls to things that try to access this data node's
+		// mapper
+	    mapper.initialize(this);
+        initialized();
+		checkInputs();
+		
 		if (isClosed()) {
 		    notifyListeners();
 		}
@@ -104,7 +136,7 @@
 
 	private void checkInputs() {
 		try {
-			checkInputs(params, mapper, this, dmc);
+			checkInputs(this, dmc);
 		}
 		catch (DependentException e) {
 			setValue(new MappingDependentException(this, e));
@@ -115,21 +147,17 @@
 		try {
             innerInit();
         }
-        catch (OOBYield e) {
-            throw e.wrapped();
-        }
         catch (Exception e) {
             this.setValue(new MappingException(this, e));
         }
 	}
 
 
-	static protected void checkInputs(MappingParamSet params, Mapper mapper, AbstractDataNode root, 
-	        DuplicateMappingChecker dmc) {
-		Boolean input = (Boolean) params.get(MappingParam.SWIFT_INPUT);
-		if (input != null && input.booleanValue()) {
+	static protected void checkInputs(RootHandle root, DuplicateMappingChecker dmc) {
+	    Mapper mapper = root.getActualMapper();
+		if (root.isInput()) {
 			addExisting(mapper, root);
-			checkConsistency(root, true, mapper, dmc);
+			checkConsistency(root, root, dmc);
 		}
 		else if (mapper.isStatic()) {
 		    if (root.isClosed()) {
@@ -148,8 +176,8 @@
 				    // path is valid - we'll get an exception if not
 					DSHandle h = root.getField(p);
 					if (variableTracer.isEnabled()) {
-					    variableTracer.trace(root.getThread(), root.getDeclarationLine(), 
-					        root.getDisplayableName() + " MAPPING " + p + ", " + mapper.map(p));
+					    variableTracer.trace(root.getThread(), root.getLine(), 
+					        root.getName() + " MAPPING " + p + ", " + mapper.map(p));
 					}
 				}
 				catch (InvalidPathException e) {
@@ -162,19 +190,20 @@
 			if (root.isArray()) {
 			    root.closeArraySizes();
 			}
-			checkConsistency(root, false, mapper, dmc);
+			checkConsistency(root, root, dmc);
 		}
 	}
 
-	private static void addExisting(Mapper mapper, AbstractDataNode root) {
+	private static void addExisting(Mapper mapper, RootHandle root) {
 	    boolean any = false;
+	    MappingParamSet mps = root.getMappingParams();
 		for (Path p : mapper.existing()) {
             try {
                 DSHandle field = root.getField(p);
                 field.setValue(FILE_VALUE);
                 if (variableTracer.isEnabled()) {
-                    variableTracer.trace(root.getThread(), root.getDeclarationLine(), 
-                        root.getDisplayableName() + " MAPPING " + p + ", " + mapper.map(p));
+                    variableTracer.trace(root.getThread(), root.getLine(), 
+                        root.getName() + " MAPPING " + p + ", " + mapper.map(p));
                 }
                 any = true;
             }
@@ -190,17 +219,17 @@
         }
         root.closeDeep();
         if (!any && variableTracer.isEnabled()) {
-            variableTracer.trace(root.getThread(), root.getDeclarationLine(), 
-                root.getDisplayableName() + " MAPPING no files found");
+            variableTracer.trace(root.getThread(), root.getLine(), 
+                root.getName() + " MAPPING no files found");
         }
     }
 
-    public static void checkConsistency(DSHandle handle, boolean input, Mapper mapper, DuplicateMappingChecker dmc) {
+    public static void checkConsistency(RootHandle root, DSHandle handle, DuplicateMappingChecker dmc) {
 		if (handle.getType().isArray()) {
 			// any number of indices is ok
 			try {
 			    for (DSHandle dh : handle.getFields(Path.CHILDREN)) {
-					checkConsistency(dh, input, mapper, dmc);
+					checkConsistency(root, dh, dmc);
 				}
 			}
 			catch (HandleOpenException e) {
@@ -217,8 +246,8 @@
 			Type type = handle.getType();
 			if (!type.isPrimitive() && !type.isComposite()) {
 			    // mapped. Feed the DMC.
-			    PhysicalFormat f = mapper.map(handle.getPathFromRoot());
-			    if (input) {
+			    PhysicalFormat f = root.getActualMapper().map(handle.getPathFromRoot());
+			    if (root.isInput()) {
 			        dmc.addRead(f, handle);
 			    }
 			    else {
@@ -228,7 +257,7 @@
 			for (String fieldName : type.getFieldNames()) {
 				Path fieldPath = Path.parse(fieldName);
 				try {
-					checkConsistency(handle.getField(fieldPath), input, mapper, dmc);
+					checkConsistency(root, handle.getField(fieldPath), dmc);
 				}
 				catch (InvalidPathException e) {
 					throw new RuntimeException("Data set initialization failed for " + handle
@@ -237,15 +266,8 @@
 			}
 		}
 	}
-
-	public String getParam(MappingParam p) {
-		if (params == null) {
-			return null;
-		}
-		return (String) params.get(p);
-	}
-
-	public DSHandle getRoot() {
+	
+	public RootHandle getRoot() {
 		return this;
 	}
 
@@ -265,7 +287,7 @@
 		if (waitingMapperParam == null) {
 		    return null;
 		}
-		else {        
+		else {
 		    throw new FutureNotYetAvailable(waitingMapperParam);
 		}
 	}
@@ -287,7 +309,7 @@
 		initialized = true;
 		waitingMapperParam = null;
 		if (variableTracer.isEnabled()) {
-            variableTracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED " + params);
+            variableTracer.trace(getThread(), getLine(), getName() + " INITIALIZED " + mapper);
         }
 	}
 }

Added: trunk/src/org/griphyn/vdl/mapping/RootHandle.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootHandle.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/RootHandle.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,31 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 21, 2013
+ */
+package org.griphyn.vdl.mapping;
+
+import k.thr.LWThread;
+
+public interface RootHandle extends DSHandle {
+    void init(Mapper mapper);
+    void setThread(LWThread thread);
+    void setLine(int line);
+    void setInput(boolean input);
+    
+    boolean isInput();
+    LWThread getThread();
+    int getLine();
+    
+    String getName();
+    
+    Mapper getActualMapper();
+    boolean isArray();
+    void closeArraySizes();
+    
+    MappingParamSet getMappingParams();
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -26,19 +26,17 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import java.util.StringTokenizer;
 import java.util.Set;
+import java.util.StringTokenizer;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.util.Base64;
 import org.griphyn.vdl.mapping.AbsFile;
-import org.griphyn.vdl.mapping.AbstractDataNode;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 
 /** A base class to build mappers which map based on filename patterns.
   * It provides a large amount of default behaviour which can be
@@ -65,18 +63,11 @@
   * </ul>
   */
 
-public abstract class AbstractFileMapper extends AbstractMapper {
-	public static final MappingParam PARAM_PREFIX = new MappingParam("prefix", null);
-	public static final MappingParam PARAM_SUFFIX = new MappingParam("suffix", null);
-	public static final MappingParam PARAM_PATTERN = new MappingParam("pattern", null);
-	public static final MappingParam PARAM_LOCATION = new MappingParam("location", null);
+public abstract class AbstractFileMapper extends AbstractMapper {  
 	
-	private String location, prefix, suffix, pattern; 
-	
-	
 	@Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_PREFIX, PARAM_SUFFIX, PARAM_PATTERN, PARAM_LOCATION);
+	    s.addAll(AbstractFileMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 
@@ -91,8 +82,6 @@
 		this.elementMapper = elementMapper;
 	}
 	
-	
-
 	/** Creates an AbstractFileMapper without specifying a
 	  * FileNameElementMapper. The elementMapper must be specified
 	  * in another way, such as through the setElementMapper method.
@@ -109,37 +98,46 @@
 		this.elementMapper = elementMapper;
 	}
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
+	@Override
+    public MappingParamSet newParams() {
+        return new AbstractFileMapperParams();
+    }
+
+    @Override
+	public void initialize(RootHandle root) {
+		super.initialize(root);
+		AbstractFileMapperParams cp = getParams(); 
 		StringBuilder pattern = new StringBuilder();
 		boolean wildcard = false; 
-		if (PARAM_PREFIX.isPresent(this)) {
-		    prefix = PARAM_PREFIX.getStringValue(this);
-		    pattern.append(prefix);
+		if (cp.getPrefix() != null) {
+		    pattern.append(cp.getPrefix());
 		    pattern.append('*');
 		    wildcard = true;
 		}
-		if (PARAM_PATTERN.isPresent(this)) {
-            pattern.append(PARAM_PATTERN.getStringValue(this));
+		if (cp.getPattern() != null) {
+            pattern.append(cp.getPattern());
             wildcard = false;
         }
-		if (PARAM_SUFFIX.isPresent(this)) {
-			suffix = PARAM_SUFFIX.getStringValue(this);
+		if (cp.getSuffix() != null) {
 			if (!wildcard) {
 			    pattern.append('*');
 			}
-			pattern.append(suffix);
+			pattern.append(cp.getSuffix());
 		}
-		location = PARAM_LOCATION.getStringValue(this);
-        prefix = PARAM_PREFIX.getStringValue(this);
-        suffix = PARAM_SUFFIX.getStringValue(this);
-        this.pattern = pattern.toString();
+		cp.setPattern(pattern.toString());
 	}
-
+	
+	@Override
 	public PhysicalFormat map(Path path) {
+	    AbstractFileMapperParams cp = getParams();
+	    return map(cp, path, cp.getPrefix());
+	}
+
+	protected PhysicalFormat map(AbstractFileMapperParams cp, Path path, String prefix) {
 		if(logger.isDebugEnabled())
 			logger.debug("mapper id="+this.hashCode()+" starting to map "+path);
 		StringBuffer sb = new StringBuffer();
+		String location = cp.getLocation();
 		maybeAppend(sb, location);
 		if (location != null && !location.endsWith("/")) {
 			sb.append('/');
@@ -199,6 +197,7 @@
 			}
 			level++;
 		}
+		String suffix = cp.getSuffix();
 		if (suffix != null) {
 			sb.append(suffix);
 		}
@@ -227,12 +226,15 @@
         }
     }
 
+    @Override
     public Collection<Path> existing() {
 		if (logger.isDebugEnabled()) {
 			logger.debug("list existing paths for mapper id=" + this.hashCode());
 		}
 		List<Path> result = new ArrayList<Path>();
 		final AbsFile f;
+		AbstractFileMapperParams cp = getParams();
+		String location = cp.getLocation();
 		if (location == null) {
 			f = new AbsFile(".");
 		}
@@ -243,13 +245,14 @@
 			}
 		}
 		logger.debug("Processing file list.");
+		String pattern = cp.getPattern();
 		List<AbsFile> files = glob(f, pattern);
 		if (files != null) {
 			for (AbsFile file : files) {
 				if (logger.isDebugEnabled()) {
 				    logger.debug("Processing existing file " + file.getName());
 				}
-				Path p = rmap(file.getName());
+				Path p = rmap(cp, file.getName());
 				if (p != null) {
 					if (logger.isDebugEnabled()) {
 					    logger.debug("reverse-mapped to path " + p);
@@ -342,12 +345,6 @@
         l.addAll(files);
     }
 
-
-    private String getVarName() {
-        AbstractDataNode var = (AbstractDataNode) getParam(MappingParam.SWIFT_HANDLE);
-        return var == null ? "" : var.getDisplayableName();
-    }
-
     /** Returns the SwiftScript path for a supplied filename.
 	  *
 	  * Splits the filename into components using the separator
@@ -365,11 +362,11 @@
 	  * @param name the filename to map to a path
 	  * @return a Path to the supplied filename, null on failure
 	  */
-
-	public Path rmap(String name) {
+	public Path rmap(AbstractFileMapperParams cp, String name) {
 		logger.debug("rmap "+name);
 
-		if(prefix != null) {
+		String prefix = cp.getPrefix();
+		if (prefix != null) {
 			if (name.startsWith(prefix)) {
 				name = name.substring(prefix.length());
 			} 
@@ -378,7 +375,8 @@
 			}
 		}
 
-		if(suffix != null) {
+		String suffix = cp.getSuffix();
+		if (suffix != null) {
 			if (name.endsWith(suffix)) {
 				name = name.substring(0,name.length() - suffix.length());
 			}
@@ -433,15 +431,6 @@
 		}
 	}
 
-	public String getLocation() {
-		return location;
-	}
-
-	public String getPrefix() {
-		return prefix;
-	}
-
-
 	/** Converts a unix-style glob pattern into a regular expression. */
 	public static String replaceWildcards(String wild) {
 		StringBuffer buffer = new StringBuffer();

Added: trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,4 @@
+String prefix = null
+String suffix = null
+String pattern = null
+String location = null
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,114 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class AbstractFileMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("prefix", "suffix", "pattern", "location");
+
+	private Object prefix = null;
+	private Object suffix = null;
+	private Object pattern = null;
+	private Object location = null;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+
+	public String getPrefix() {
+		return (String) prefix;
+	}
+
+	public void setSuffix(String suffix) {
+		this.suffix = suffix;
+	}
+
+	public String getSuffix() {
+		return (String) suffix;
+	}
+
+	public void setPattern(String pattern) {
+		this.pattern = pattern;
+	}
+
+	public String getPattern() {
+		return (String) pattern;
+	}
+
+	public void setLocation(String location) {
+		this.location = location;
+	}
+
+	public String getLocation() {
+		return (String) location;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("prefix")) {
+			this.prefix = value;
+		}
+		else if (name.equals("suffix")) {
+			this.suffix = value;
+		}
+		else if (name.equals("pattern")) {
+			this.pattern = value;
+		}
+		else if (name.equals("location")) {
+			this.location = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(prefix)) {
+			return (AbstractDataNode) prefix;
+		}
+		else if (checkOpen(suffix)) {
+			return (AbstractDataNode) suffix;
+		}
+		else if (checkOpen(pattern)) {
+			return (AbstractDataNode) pattern;
+		}
+		else if (checkOpen(location)) {
+			return (AbstractDataNode) location;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "prefix", prefix);
+		addParam(sb, "suffix", suffix);
+		addParam(sb, "pattern", pattern);
+		addParam(sb, "location", location);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		prefix = unwrap(prefix);
+		suffix = unwrap(suffix);
+		pattern = unwrap(pattern);
+		location = unwrap(location);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/AirsnMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AirsnMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/AirsnMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -29,8 +29,13 @@
 		super(new AirsnFileNameElementMapper());
 	}
 
-	public Path rmap(String name) {
-		if (!name.startsWith(getPrefix() + "_") && !name.startsWith(getPrefix() + ".")) {
+    @Override
+    public String getName() {
+        return "AIRSNMapper";
+    }
+
+    public Path rmap(AbstractFileMapperParams cp, String name) {	    
+		if (!name.startsWith(cp.getPrefix() + "_") && !name.startsWith(cp.getPrefix() + ".")) {
 			return null;
 		}
 		Path path = Path.EMPTY_PATH;

Modified: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -1,20 +1,3 @@
-/*
- * Copyright 2012 University of Chicago
- * 
- * Licensed 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.
- */
-
-
 package org.griphyn.vdl.mapping.file;
 
 import java.util.ArrayList;
@@ -29,27 +12,31 @@
 import org.griphyn.vdl.mapping.AbstractMapper;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.InvalidPathException;
-import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
 
+
 public class ArrayFileMapper extends AbstractMapper {
     static Logger logger = Logger.getLogger(ArrayFileMapper.class);
     
-	public static final MappingParam PARAM_FILES = new MappingParam("files");
-	
+    
 	@Override
+    public String getName() {
+        return "ArrayMapper";
+    }
+
+    @Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_FILES);
+	    s.addAll(ArrayFileMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 
+	@Override
 	public Collection<Path> existing() {
+	    ArrayFileMapperParams cp = getParams();
 		List<Path> l = new ArrayList<Path>();
-		DSHandle dn = (DSHandle) PARAM_FILES.getRawValue(this);
-		if (dn == null) {
-		    throw new RuntimeException("Missing 'files' mapper attribute");
-		}
+		DSHandle dn = (DSHandle) cp.getFiles();
 		Map<?, DSHandle> m = dn.getArrayValue();
 		Set<?> s = m.keySet();
 		Iterator<?> i = s.iterator();
@@ -60,6 +47,7 @@
 		return l;
 	}
 
+	@Override
 	public PhysicalFormat map(Path path) {
 		if (path.isEmpty()) {
 			throw new IllegalArgumentException("Path cannot be empty");
@@ -67,16 +55,18 @@
 		if (!path.isArrayIndex(0)) {
 			throw new IllegalArgumentException("First element of path "+path.toString()+" must be an array index");
 		}
+		ArrayFileMapperParams cp = getParams();
         // we could typecheck more elegantly here to make sure that
         // we really do have an array of strings as parameter.
-        DSHandle dn = (DSHandle) PARAM_FILES.getRawValue(this);
+        DSHandle dn = (DSHandle) cp.getFiles();
         assert(dn.isClosed());
         logger.debug("dn: " + dn);
         
         DSHandle srcNode = null;
         try {
         	srcNode = dn.getField(path);
-        } catch(InvalidPathException e) {
+        } 
+        catch (InvalidPathException e) {
         	logger.error("Invalid path exception "+e+" for path "+path,e);
         	return null;
         }
@@ -84,7 +74,12 @@
         return new AbsFile(returnValue);
 	}
 
-	public boolean isStatic() {
+	@Override
+    public MappingParamSet newParams() {
+        return new ArrayFileMapperParams();
+    }
+
+    public boolean isStatic() {
 		return true;
 	}
 	

Added: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1 @@
+Object files
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,66 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class ArrayFileMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("files");
+
+	private Object files;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setFiles(Object files) {
+		this.files = files;
+	}
+
+	public Object getFiles() {
+		return files;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("files")) {
+			this.files = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(files)) {
+			return (AbstractDataNode) files;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "files", files);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (files == null) {
+			throw new IllegalArgumentException("Missing required argument 'files'");
+		}
+		files = unwrap(files);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -34,112 +34,83 @@
 import org.griphyn.vdl.mapping.AbstractMapper;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.GeneralizedFileFormat;
-import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.InvalidMappingParameterException;
-import org.griphyn.vdl.mapping.Mapper;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 import org.griphyn.vdl.type.Types;
 
-public class CSVMapper extends AbstractMapper {
-	public static final MappingParam PARAM_FILE = new MappingParam("file");
-
-	/** whether the file has a line describing header info. default is true. */
-	public static final MappingParam PARAM_HEADER = new MappingParam("header", "true");
-
-	/** the number of lines to skip at the start of the file. default is 0. */
-	public static final MappingParam PARAM_SKIP = new MappingParam("skip", "0");
-
-	/** delimiter between header fields. defaults to the value of the
-	"delim" field. */
-	public static final MappingParam PARAM_HDELIMITER = new MappingParam("hdelim");
-
-	/** delimiters between content fields. default is space, tab, comma */
-	public static final MappingParam PARAM_DELIMITER = new MappingParam("delim", " \t,");
-	
-	
+public class CSVMapper extends AbstractMapper {
+    
 	@Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_FILE, PARAM_HEADER, PARAM_SKIP, PARAM_HDELIMITER, PARAM_DELIMITER);
+	    s.addAll(CSVMapperParams.NAMES);
 	    super.getValidMappingParams(s);
     }
-
-	/** list of column names */
-	private List cols = new ArrayList();
-
-	/** column name to index map */
-	private Map colindex = new HashMap();
-
-	/** the content of the CSV file */
-	private List content = new ArrayList();
-
-	/** whether the CSV file has been read already. */
-	private boolean read = false;
 	
-	private String delim, hdelim;
-	private boolean header;
-	private int skip;
+	private List<String> cols = new ArrayList<String>();
+    private Map<String, Integer> colindex = new HashMap<String, Integer>();
+    private List<List<String>> content = new ArrayList<List<String>>();
+    private boolean read = false;
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
-		if (!PARAM_FILE.isPresent(this)) {
+	@Override
+    public String getName() {
+        return "CSVMapper";
+    }
+
+    public void initialize(RootHandle root) {
+		super.initialize(root);
+		CSVMapperParams cp = getParams();
+		if (cp.getFile() == null) {
 			throw new InvalidMappingParameterException("CSV mapper must have a file parameter.");
-		}
-		if (!PARAM_HDELIMITER.isPresent(this)) {
-		    Object raw = PARAM_DELIMITER.getRawValue(this);
-		    if (raw != null) {
-		        params.set(PARAM_HDELIMITER, PARAM_DELIMITER.getRawValue(this));
-		    }
-		    else {
-		        params.set(PARAM_HDELIMITER, PARAM_DELIMITER.getValue(this));
-		    }
 		}
-		delim = PARAM_DELIMITER.getStringValue(this);
-        hdelim = PARAM_HDELIMITER.getStringValue(this);
-        header = PARAM_HEADER.getBooleanValue(this);
-        skip = PARAM_SKIP.getIntValue(this);
+		if (cp.getHdelim() == null) {
+		    cp.setHdelim(cp.getDelim());
+		}
 	}
 
-	private synchronized void readFile() {
+	private synchronized void readFile(CSVMapperParams cp) {
 		if (read) {
 			return;
-		}
+		}
+				
+		String file = getCSVFile(cp);
 		
-		String file = getCSVFile(); 
-		
 		try {
 			BufferedReader br = 
 			    new BufferedReader(new FileReader(file));
 
 			String line;
-			StringTokenizer st;
+			StringTokenizer st;
+			boolean header = Boolean.TRUE.equals(cp.getHeader());
 
 			if (header) {
 				line = br.readLine();
 				if (line == null) {
 				    throw new RuntimeException("Invalid CSV file (" + file + "): missing header.");
 				}
-				st = new StringTokenizer(line, hdelim);
-				int ix = 0;
+				st = new StringTokenizer(line, cp.getHdelim());
+				int ix = 0;
+				
 				while (st.hasMoreTokens()) {
 					String column = st.nextToken();
-					column.replaceAll("\\s", "_");
+					column.replaceAll("\\s", "_");
+					
 					cols.add(column);
 					colindex.put(column, new Integer(ix));
 					++ix;
 				}
 			}
-			while (skip > 0) {
-				br.readLine();
-				--skip;
+			while (cp.getSkip() > 0) {
+				br.readLine();
+				cp.setSkip(cp.getSkip() - 1);
 			}
 
 			int i = 0;
 			line = br.readLine();
 			if (line != null && !header) {
-				st = new StringTokenizer(line, delim);
+				st = new StringTokenizer(line, cp.getDelim());
 				int j = 0;
 				while (j < st.countTokens()) {
 					String colname = "column" + j;
@@ -150,8 +121,8 @@
 			}
 
 			while (line != null) {
-				st = new StringTokenizer(line, delim);
-				List colContent = new ArrayList();
+				st = new StringTokenizer(line, cp.getDelim());
+				List<String> colContent = new ArrayList<String>();
 				while (st.hasMoreTokens()) {
 					String tok = st.nextToken();
 					colContent.add(tok);
@@ -170,37 +141,39 @@
 		}
 	}
 
-	private String getCSVFile() {
+	private String getCSVFile(CSVMapperParams cp) {
 	    String result = null;
-	    Object object = PARAM_FILE.getRawValue(this);
-        DSHandle handle = (DSHandle) object;
+        DSHandle handle = cp.getFile();
         GeneralizedFileFormat fileFormat;
         if (handle.getType().equals(Types.STRING)) {
             String path = (String) handle.getValue();
             fileFormat = new AbsFile(path);
         }
         else {
-            Mapper mapper = handle.getMapper();
-            PhysicalFormat format = mapper.map(Path.EMPTY_PATH);
+            PhysicalFormat format = handle.map();
             fileFormat = (GeneralizedFileFormat) format;
         }
         result  = fileFormat.getPath();
         return result;
     }
-
-    public Collection existing() {
-		readFile();
-		List l = new ArrayList();
-		Iterator itl = content.iterator();
+
+	@Override
+    public Collection<Path> existing() {
+	    CSVMapperParams cp = getParams();
+		readFile(cp);
+				
+		List<Path> l = new ArrayList<Path>();
+		
+		Iterator<List<String>> itl = content.iterator();
 		int ii = 0;
 		while (itl.hasNext()) {
 			Path path = Path.EMPTY_PATH;
 			path = path.addFirst(ii, true);
-			List colContent = (List) itl.next();
-			Iterator itc = colContent.iterator();
+			List<String> colContent = itl.next();
+			Iterator<String> itc = colContent.iterator();
 			int j = 0;
 			while (itc.hasNext()) {
-				Path p = path.addLast((String)cols.get(j));
+				Path p = path.addLast(cols.get(j));
 				l.add(p);
 				itc.next();
 				j++;
@@ -209,18 +182,22 @@
 		}
 		return l;
 	}
-
+
+	@Override
 	public boolean isStatic() {
 		return false;
 	}
-
+
+	@Override
 	public PhysicalFormat map(Path path) {
 		if (path == null || path == Path.EMPTY_PATH) {
 			return null;
-		}
+		}
+		
+		CSVMapperParams cp = getParams();
+		
+		readFile(cp);
 
-		readFile();
-
 		Iterator<Path.Entry> pi = path.iterator();
 		Path.Entry pe = pi.next();
 		if (!pe.isIndex()) {
@@ -236,13 +213,13 @@
 		if (i > content.size()) {
 			return null;
 		}
-		List cl = (List) content.get(i);
+		List<String> cl = content.get(i);
 		if (cl == null) {
 			return null;
 		}
 
 		if (!pi.hasNext()) {
-			return new AbsFile((String) cl.get(0));
+			return new AbsFile(cl.get(0));
 		}
 
 		pe = pi.next();
@@ -250,7 +227,12 @@
 		if (!colindex.containsKey(col)) {
 			return null;
 		}
-		int ci = ((Integer) colindex.get(col)).intValue();
-		return new AbsFile((String) cl.get(ci));
-	}
+		int ci = colindex.get(col).intValue();
+		return new AbsFile(cl.get(ci));
+	}
+
+    @Override
+    public MappingParamSet newParams() {
+        return new CSVMapperParams();
+    }
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,6 @@
+ at import org.griphyn.vdl.mapping.DSHandle
+DSHandle file = null
+Boolean header = false
+Integer skip = 0
+String hdelim = null
+String delim  = " \t,"

Added: trunk/src/org/griphyn/vdl/mapping/file/CSVMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/CSVMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/CSVMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,131 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+import org.griphyn.vdl.mapping.DSHandle;
+
+
+public class CSVMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("file", "header", "skip", "hdelim", "delim");
+
+	private Object file = null;
+	private Object header = false;
+	private Object skip = 0;
+	private Object hdelim = null;
+	private Object delim = " \t,";
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setFile(DSHandle file) {
+		this.file = file;
+	}
+
+	public DSHandle getFile() {
+		return (DSHandle) file;
+	}
+
+	public void setHeader(Boolean header) {
+		this.header = header;
+	}
+
+	public Boolean getHeader() {
+		return (Boolean) header;
+	}
+
+	public void setSkip(Integer skip) {
+		this.skip = skip;
+	}
+
+	public Integer getSkip() {
+		return (Integer) skip;
+	}
+
+	public void setHdelim(String hdelim) {
+		this.hdelim = hdelim;
+	}
+
+	public String getHdelim() {
+		return (String) hdelim;
+	}
+
+	public void setDelim(String delim) {
+		this.delim = delim;
+	}
+
+	public String getDelim() {
+		return (String) delim;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("file")) {
+			this.file = value;
+		}
+		else if (name.equals("header")) {
+			this.header = value;
+		}
+		else if (name.equals("skip")) {
+			this.skip = value;
+		}
+		else if (name.equals("hdelim")) {
+			this.hdelim = value;
+		}
+		else if (name.equals("delim")) {
+			this.delim = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(file)) {
+			return (AbstractDataNode) file;
+		}
+		else if (checkOpen(header)) {
+			return (AbstractDataNode) header;
+		}
+		else if (checkOpen(skip)) {
+			return (AbstractDataNode) skip;
+		}
+		else if (checkOpen(hdelim)) {
+			return (AbstractDataNode) hdelim;
+		}
+		else if (checkOpen(delim)) {
+			return (AbstractDataNode) delim;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "file", file);
+		addParam(sb, "header", header);
+		addParam(sb, "skip", skip);
+		addParam(sb, "hdelim", hdelim);
+		addParam(sb, "delim", delim);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		header = unwrap(header);
+		skip = unwrap(skip);
+		hdelim = unwrap(hdelim);
+		delim = unwrap(delim);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -26,38 +26,36 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.griphyn.vdl.mapping.HandleOpenException;
+import k.thr.LWThread;
+
 import org.griphyn.vdl.mapping.Mapper;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 
-public class ConcurrentMapper extends AbstractFileMapper {
-	public static final MappingParam PARAM_THREAD_PREFIX = new MappingParam("thread_prefix", "");
-	
-	
-	@Override
-    protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_THREAD_PREFIX);
-        super.getValidMappingParams(s);
-    }
-	
-	private Map<Path, PhysicalFormat> remappedPaths;
+public class ConcurrentMapper extends AbstractFileMapper {	
+    private Map<Path, PhysicalFormat> remappedPaths;
+    private LWThread thread;
 
 	public ConcurrentMapper() {
 		super(new ConcurrentElementMapper());
 	}
+	
+	@Override
+    public String getName() {
+        return "ConcurrentMapper";
+    }
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		String prefix = PARAM_PREFIX.getStringValue(params);
-		prefix = "_concurrent/" + (prefix == null ? "" : prefix + "-") + 
-		    PARAM_THREAD_PREFIX.getValue(params);
-		PARAM_PREFIX.setValue(params, prefix);
-		super.setParams(params);
-	}
-	
+    @Override
+    public void initialize(RootHandle root) {
+        super.initialize(root);
+        this.thread = root.getThread();
+    }
+
+    @Override
     public synchronized Collection<Path> existing() {
+        AbstractFileMapperParams cp = getParams();
+        
         Collection<Path> c = super.existing();
         if (remappedPaths != null) {
             Set<Path> s = new HashSet<Path>(c);
@@ -69,24 +67,33 @@
         }
     }
 
+	@Override
     public synchronized PhysicalFormat map(Path path) {
+	    AbstractFileMapperParams cp = getParams();
+        
         if (remappedPaths != null) {
             Object o = remappedPaths.get(path);
             if (o != null) {
                 return (PhysicalFormat) o;
             }
         }
-        return super.map(path);
+        String prefix = cp.getPrefix();
+        String modifiedPrefix = "_concurrent/" + (prefix == null ? "" : prefix + "-") + 
+                thread.getQualifiedName();
+        return super.map(cp, path, modifiedPrefix);
     }
 
-    public Path rmap(String name) {
+	@Override
+    public Path rmap(AbstractFileMapperParams cp, String name) {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public boolean canBeRemapped(Path path) {
         return true;
     }
 
+    @Override
     public synchronized void remap(Path path, Mapper sourceMapper, Path sourcePath) {
         // this will prevent cleaning of the old file
         // which doesn't need to be cleaned

Modified: trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -32,63 +32,65 @@
 import org.apache.log4j.Logger;
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
 
 public class ExternalMapper extends AbstractMapper {
-	public static final Logger logger = Logger.getLogger(ExternalMapper.class);
-
-	private Map<Path, AbsFile> map;
-	private Map<String, Path> rmap;
-
-	public static final MappingParam PARAM_EXEC = new MappingParam("exec");
+	public static final Logger logger = Logger.getLogger(ExternalMapper.class);	
 	
-	
+	private Map<Path, AbsFile> map;
+    private Map<String, Path> rmap;
+    
 	@Override
+    public String getName() {
+        return "Ext";
+    }
+
+    @Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_EXEC);
+	    s.addAll(ExternalMapperParams.NAMES);
 	    s.add("*");
         super.getValidMappingParams(s);
     }
 
 	private static final String[] STRING_ARRAY = new String[0];
-
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
+
+	@Override
+	public void initialize(RootHandle root) {
+		super.initialize(root);
+		
+		ExternalMapperParams cp = getParams();
 		map = new HashMap<Path, AbsFile>();
 		rmap = new HashMap<String, Path>();
-		String exec = PARAM_EXEC.getStringValue(this);
-		String bdir = MappingParam.SWIFT_BASEDIR.getStringValue(this);
+		String exec = cp.getExec();
+		String bdir = getBaseDir();
 		if (bdir != null && !exec.startsWith("/")) {
 			exec = bdir + File.separator + exec;
 		}
 		List<String> cmd = new ArrayList<String>();
-		cmd.add(exec);
-		for (String name : params.names()) {
-			if (!name.contains("#") && !name.equals("exec")) {
-				MappingParam tp = new MappingParam(name);
-				cmd.add('-' + name);
-				cmd.add(tp.getStringValue(this));
-			}
+		cmd.add(exec);
+		Map<String, Object> other = cp.getOtherParams();
+		for (Map.Entry<String, Object> e : other.entrySet()) {
+		    cmd.add('-' + e.getKey());
+			cmd.add(String.valueOf(e.getValue()));
 		}
 		try {
 		    if (logger.isDebugEnabled()) {
-		        logger.debug("invoking external mapper for " + getParam(MappingParam.SWIFT_DBGNAME) + ": " + cmd);
+		        logger.debug("invoking external mapper: " + cmd);
 		    }
 			Process p = Runtime.getRuntime().exec(cmd.toArray(STRING_ARRAY));
 			List<String> lines = fetchOutput(p.getInputStream());
 			if (logger.isDebugEnabled()) {
-			    logger.debug("external mapper for " + getParam(MappingParam.SWIFT_DBGNAME) + " output: " + lines);
+			    logger.debug("external mapper output: " + lines);
 			}
 			int ec = p.waitFor();
 			if (ec != 0) {
 				throw new RuntimeException("External executable failed. Exit code: " + ec + "\n\t"
 						+ join(lines) + "\n\t" + join(fetchOutput(p.getErrorStream())));
 			}
-			processLines(lines);
+			processLines(cp, lines);
 		}
 		catch (IOException e) {
 			throw new RuntimeException(e);
@@ -119,7 +121,7 @@
 		return lines;
 	}
 
-	private void processLines(List<String> lines) {
+	private void processLines(ExternalMapperParams cp, List<String> lines) {
 		for (String line : lines) {
 			int s = line.indexOf(' ');
 			int t = line.indexOf('\t');
@@ -134,23 +136,30 @@
 			rmap.put(spath, p);
 		}
 	}
-
-	public Collection<Path> existing() {
+
+	@Override
+	public Collection<Path> existing() {
 		return map.keySet();
 	}
-
-	public Path rmap(String name) {
+
+	public Path rmap(String name) {
 		if (name == null || name.equals("")) {
 			return null;
 		}
 		return rmap.get(name);
 	}
-
+
+	@Override
 	public PhysicalFormat map(Path path) {
 		return map.get(path);
 	}
 
 	public boolean isStatic() {
 		return true;
-	}
+	}
+
+    @Override
+    public MappingParamSet newParams() {
+        return new ExternalMapperParams();
+    }
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/ExternalMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ExternalMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/ExternalMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,81 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class ExternalMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("exec");
+
+	private Object exec;
+	private Map<String, Object> other = new HashMap<String, Object>();
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setExec(String exec) {
+		this.exec = exec;
+	}
+
+	public String getExec() {
+		return (String) exec;
+	}
+	
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("exec")) {
+			this.exec = value;
+		}
+		else {
+			if (!super.set0(name, value)) {
+			    other.put(name, value);
+			}
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(exec)) {
+			return (AbstractDataNode) exec;
+		}
+		else {
+		    for (Object o : other.values()) {
+		        if (checkOpen(o)) {
+		            return (AbstractDataNode) o;
+		        }
+		    }
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "exec", exec);
+		for (Map.Entry<String, Object> e : other.entrySet()) {
+		    addParam(sb, e.getKey(), e.getValue());
+		}
+		super.toString(sb);
+	}
+	@Override
+	public void unwrapPrimitives() {
+		exec = unwrap(exec);
+		for (Map.Entry<String, Object> e : other.entrySet()) {
+		    e.setValue(unwrap(e.getValue()));
+		}
+		super.unwrapPrimitives();
+	}
+
+	public Map<String, Object> getOtherParams() {
+	    return other;
+	}
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -17,36 +17,44 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.Path;
+import org.griphyn.vdl.mapping.PhysicalFormat;
 
-import org.griphyn.vdl.mapping.AbsFile;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-
-public class FileSystemArrayMapper extends AbstractFileMapper {
-	private Map<Object, String> filenames = new HashMap<Object, String>();
-	private int count = 0;
-	
-	public Path rmap(String name) {
+public class FileSystemArrayMapper extends AbstractFileMapper {    
+    private Map<Object, String> filenames = new HashMap<Object, String>();
+    private int count = 0;
+
+    @Override
+    public String getName() {
+        return "FilesysMapper";
+    }
+
+    @Override
+	public Path rmap(AbstractFileMapperParams cp, String name) {
 		if (name == null || name.equals("")) {
 			return null;
-		}
+		}
 		filenames.put(count, name);
 		Path p = Path.EMPTY_PATH;
 		p = p.addFirst(count, true);
-		++count;
+		++count;
 		return p;
 	}
-	
+	
+    @Override
 	public PhysicalFormat map(Path path) {
 		if (path.size()!=1) {
 			return null;
 		}
 		if (!path.isArrayIndex(0)) {
 			return null;
-		}
-		String location = getLocation();
+		}
+		AbstractFileMapperParams cp = getParams();
+		String location = cp.getLocation();
 		Object index = path.getFirst();
 		String filename = filenames.get(index);
 		if (filename == null) {

Modified: trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -21,27 +21,24 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.InvalidMappingParameterException;
-import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
+import org.griphyn.vdl.type.Types;
 
 
 /** Maps a string (separated by space, comma or semicolon) of filenames to
     an array. */
 public class FixedArrayFileMapper extends AbstractMapper {
-	public static final MappingParam PARAM_FILES = new MappingParam("files");
-	
-	
-	@Override
+
+    @Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_FILES);
+	    s.addAll(FixedArrayFileMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 	
@@ -50,34 +47,47 @@
 	public FixedArrayFileMapper() {
 		super();
 	}
+	
+    @Override
+    public String getName() {
+        return "FixedArrayMapper";
+    }
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
-		String cfiles = PARAM_FILES.getStringValue(this);
-		if (cfiles == null) {
-			throw new InvalidMappingParameterException("Missing required mapper parameter: "
-					+ PARAM_FILES);
+
+    @Override
+	public void initialize(RootHandle root) {
+		super.initialize(root);
+		FixedArrayFileMapperParams cp = getParams();
+		DSHandle files = (DSHandle) cp.getFiles();
+		if (files.getType().isArray() && Types.STRING.equals(files.getType().itemType())) {
+		    int i = 0;
+		    Collection<DSHandle> a = files.getArrayValue().values();
+		    this.files = new String[a.size()];
+		    for (DSHandle n : a) {
+		        this.files[i] = (String) n.getValue();
+		        i++;
+		    }
 		}
-		StringTokenizer st = new StringTokenizer(cfiles, " ,;");
-		files = new String[st.countTokens()];
-		for (int i = 0; st.hasMoreTokens(); i++) {
-			files[i] = st.nextToken();
+		else if (Types.STRING.equals(files.getType())) {
+		    String v = (String) files.getValue();
+		    this.files = v.split("[\\s,;]");
 		}
-		params.set(PARAM_FILES, files);
 	}
 
 	protected String[] getFiles() {
 		return files;
 	}
 
+	@Override
 	public Collection<Path> existing() {
 		List<Path> l = new ArrayList<Path>();
-		for (int i = 0; i < getFiles().length; i++) {
+		for (int i = 0; i < files.length; i++) {
 			l.add(Path.EMPTY_PATH.addLast(i, true));
 		}
 		return l;
 	}
 
+	@Override
 	public PhysicalFormat map(Path path) {
 		if (!path.isArrayIndex(0)) {
 			throw new IllegalArgumentException(path.toString());
@@ -97,4 +107,9 @@
 	public boolean isStatic() {
 		return true;
 	}
+
+    @Override
+    protected MappingParamSet newParams() {
+        return new FixedArrayFileMapperParams();
+    }
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1 @@
+Object files
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,66 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class FixedArrayFileMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("files");
+
+	private Object files;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setFiles(Object files) {
+		this.files = files;
+	}
+
+	public Object getFiles() {
+		return files;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("files")) {
+			this.files = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(files)) {
+			return (AbstractDataNode) files;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "files", files);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (files == null) {
+			throw new IllegalArgumentException("Missing required argument 'files'");
+		}
+		files = unwrap(files);
+		super.unwrapPrimitives();
+	}
+
+
+}

Added: trunk/src/org/griphyn/vdl/mapping/file/MappingParamFileGenerator.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/MappingParamFileGenerator.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/MappingParamFileGenerator.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,356 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 20, 2013
+ */
+package org.griphyn.vdl.mapping.file;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MappingParamFileGenerator {
+    public static void main(String[] args) {
+        try {
+            generate(args[0]);
+            System.exit(0);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void generate(String basedir) throws IOException {
+        File bd = new File(basedir);
+        if (!bd.isDirectory()) {
+            throw new IllegalArgumentException("Not a directory: " + basedir);
+        }
+        generateRecursive(bd, bd);
+    }
+    
+    private static void generateRecursive(File dir, File base) throws IOException {
+        File[] ps = dir.listFiles();
+        for (File f : ps) {
+            if (f.isDirectory()) {
+                generateRecursive(f, base);
+            }
+            else if (f.getName().endsWith(".params")) {
+                generate(f, base);
+            }
+        }
+    }
+    
+    private static class Param {
+        public String type, name, value;
+        public boolean internal;
+        
+        public Param(String type, String name, String value, boolean internal) {
+            this.type = type;
+            this.name = name;
+            this.value = value;
+            this.internal = internal;
+        }
+    }
+
+    private static void generate(File f, File base) throws IOException {
+        BufferedReader br = new BufferedReader(new FileReader(f));
+        List<Param> params = new ArrayList<Param>();
+        String line = br.readLine();
+        Map<String, Object> opts = new HashMap<String, Object>();
+        List<String> imports = new ArrayList<String>();
+        opts.put("import", imports);
+        while (line != null) {
+            if (line.startsWith("#")) {
+                // comment
+            }
+            else if (line.trim().isEmpty()) {
+                // empty line
+            }
+            else if (line.startsWith("@")) {
+                String[] s = line.substring(1).trim().split("\\s+", 2);
+                if (s[0].equals("import")) {
+                    imports.add(s[1]);
+                }
+                else if (s[0].equals("extends")) {
+                    opts.put("extends", s[1]);
+                }
+                else if (s[0].equals("internal")) {
+                    params.add(buildParam(s[1], true));
+                }
+                else if (s[0].equals("suppressUnusedWarning")) {
+                    opts.put("suppressUnusedWarning", Boolean.TRUE);
+                }
+                else {
+                    throw new IllegalArgumentException("Unknown directive: '" + s[0] + "'");
+                }
+            }
+            else {
+                params.add(buildParam(line, false));
+            }
+            line = br.readLine();
+        }
+        br.close();
+        
+        String pkg = f.getParentFile().getAbsolutePath().substring(base.getAbsolutePath().length() + 1).replace('/', '.');
+        File nf = new File(makeFileName(f));
+        writeFile(nf, pkg, params, opts);
+    }
+    
+    private static Param buildParam(String line, boolean internal) {
+        String value = null;
+        if (line.contains("=")) {
+            String[] s = line.trim().split("=", 2);
+            value = s[1].trim();
+            line = s[0];
+        }
+        String[] s = line.trim().split("\\s+");
+        return new Param(join(s, " ", 0, s.length - 1), s[s.length - 1], value, internal);
+    }
+
+    private static String join(String[] s, String sep, int start, int end) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = start; i < end; i++) {
+            if (i != start) {
+                sb.append(sep);
+            }
+            sb.append(s[i]);
+        }
+        return sb.toString();
+    }
+
+    private static final List<String> IMPORTS = Arrays.asList("java.util.Arrays", "java.util.Collection", 
+        "java.util.List", "org.griphyn.vdl.mapping.AbstractDataNode", "org.griphyn.vdl.mapping.MappingParamSet");
+
+    private static void writeFile(File nf, String pkg, List<Param> params, Map<String, Object> opts) throws IOException {
+        String name = nf.getName().substring(0, nf.getName().lastIndexOf('.'));
+        BufferedWriter bw = new BufferedWriter(new FileWriter(nf));
+        bw.write("package ");
+        bw.write(pkg);
+        bw.write(";\n\n");
+        
+        for (String imp : IMPORTS) {
+            bw.write("import ");
+            bw.write(imp);
+            bw.write(";\n");
+        }
+        @SuppressWarnings("unchecked")
+        List<String> l = (List<String>) opts.get("import");
+        for (String imp : l) {
+            bw.write("import ");
+            bw.write(imp);
+            bw.write(";\n");
+        }
+        
+        
+        if (!opts.containsKey("extends")) {
+            opts.put("extends", "MappingParamSet");
+        }
+        
+        bw.write("\n\n");
+        if (opts.containsKey("suppressUnusedWarning")) {
+            bw.write("@SuppressWarnings(\"unused\")\n");
+        }
+        bw.write("public class ");
+        bw.write(name);
+        bw.write(" extends ");
+        bw.write(opts.get("extends").toString());
+        bw.write(" {\n\n");
+        
+        bw.write("\tpublic static final List<String> NAMES = Arrays.asList(");
+        join(bw, params, "\"", "\", \"", "\"", false);
+        bw.write(");\n\n");
+        
+        for (Param p : params) {
+            bw.write("\tprivate ");
+            if (p.internal) {
+                bw.write(p.type);
+            }
+            else {
+                bw.write("Object");
+            }
+            bw.write(" ");
+            bw.write(p.name);
+            if (p.value != null) {
+                bw.write(" = ");
+                bw.write(p.value);
+            }
+            bw.write(";\n");
+        }
+        bw.write("\n");
+        
+        bw.write("\t at Override\n");
+        bw.write("\tpublic Collection<String> getNames() {\n");
+        bw.write("\t\treturn NAMES;\n");
+        bw.write("\t}\n\n");
+        
+        generateGettersAndSetters(bw, params);
+        
+        if (!allInternal(params)) {
+            generateDynamicSetter(bw, params);
+            generateGetFirstOpen(bw, params);
+            
+            generateToString(bw, params);
+            generateUnwrap(bw, params);
+        }
+        
+        bw.write("\n}\n");
+        
+        bw.close();
+    }
+
+    private static boolean allInternal(List<Param> params) {
+        int c = 0;
+        for (Param p : params) {
+            if (!p.internal) {
+                c++;
+            }
+        }
+        return c == 0;
+    }
+
+    private static void generateToString(BufferedWriter bw, List<Param> params) throws IOException {
+        bw.write("\t at Override\n");
+        bw.write("\tpublic void toString(StringBuilder sb) {\n");
+        for (Param p : params) {
+            if (!p.internal) {
+                bw.write(String.format("\t\taddParam(sb, \"%s\", %s);\n", p.name, p.name));
+            }
+        }
+        bw.write("\t\tsuper.toString(sb);\n");
+        bw.write("\t}\n\n");
+    }
+    
+    private static void generateUnwrap(BufferedWriter bw, List<Param> params) throws IOException {
+        bw.write("\t at Override\n");
+        bw.write("\tpublic void unwrapPrimitives() {\n");
+        for (Param p : params) {
+            if (!p.internal) {
+                if (p.value == null) {
+                    // mandatory
+                    bw.write(String.format("\t\tif (%s == null) {\n", p.name));
+                    bw.write(String.format("\t\t\tthrow new IllegalArgumentException(\"Missing required argument '%s'\");\n", p.name));
+                    bw.write("\t\t}\n");
+                }
+                if (!p.type.equals("DSHandle")) {
+                    bw.write(String.format("\t\t%s = unwrap(%s);\n", p.name, p.name));
+                }
+            }
+        }
+        bw.write("\t\tsuper.unwrapPrimitives();\n");
+        bw.write("\t}\n\n");
+    }
+
+    private static void generateGettersAndSetters(BufferedWriter bw, List<Param> params) throws IOException {
+        for (Param p : params) {
+            bw.write(String.format("\tpublic void set%s(%s %s) {\n", capitalize(p.name), p.type, p.name));
+            bw.write(String.format("\t\tthis.%s = %s;\n", p.name, p.name));
+            bw.write("\t}\n\n");
+            
+            bw.write(String.format("\tpublic %s get%s() {\n", p.type, capitalize(p.name)));
+            if (p.type.equals("Object") || p.internal) {
+                bw.write(String.format("\t\treturn %s;\n", p.name));
+            }
+            else {
+                bw.write(String.format("\t\treturn (%s) %s;\n", p.type, p.name));
+            }
+            bw.write("\t}\n\n");
+        }
+    }
+    
+    private static void generateDynamicSetter(BufferedWriter bw, List<Param> params) throws IOException {
+        bw.write("\t at Override\n");
+        bw.write("\tprotected boolean set0(String name, Object value) {\n");
+        boolean first = true;
+        for (Param p : params) {
+            if (p.internal) {
+                continue;
+            }
+            bw.write("\t\t");
+            if (first) {
+                first = false;
+            }
+            else {
+                bw.write("else ");
+            }
+            bw.write(String.format("if (name.equals(\"%s\")) {\n", p.name));
+            bw.write(String.format("\t\t\tthis.%s = value;\n", p.name));
+            bw.write("\t\t}\n");
+        }
+        bw.write("\t\telse {\n");
+        bw.write("\t\t\treturn super.set0(name, value);\n");
+        bw.write("\t\t}\n");
+        bw.write("\t\treturn true;\n");
+        bw.write("\t}\n\n");
+    }
+    
+    private static void generateGetFirstOpen(BufferedWriter bw, List<Param> params) throws IOException {
+        bw.write("\t at Override\n");
+        bw.write("\tpublic AbstractDataNode getFirstOpen() {\n");
+        boolean first = true;
+        for (Param p : params) {
+            if (p.internal) {
+                continue;
+            }
+            bw.write("\t\t");
+            if (first) {
+                first = false;
+            }
+            else {
+                bw.write("else ");
+            }
+            bw.write(String.format("if (checkOpen(%s)) {\n", p.name));
+            bw.write(String.format("\t\t\treturn (AbstractDataNode) %s;\n", p.name));
+            bw.write("\t\t}\n");
+        }
+        bw.write("\t\telse {\n");
+        bw.write("\t\t\treturn super.getFirstOpen();\n");
+        bw.write("\t\t}\n");
+        bw.write("\t}\n\n");
+    }
+
+
+    private static Object capitalize(String n) {
+        return Character.toUpperCase(n.charAt(0)) + n.substring(1);
+    }
+
+    private static void join(BufferedWriter bw, List<Param> params, String before, String between, 
+            String after, boolean internals) throws IOException {
+        List<String> l = new ArrayList<String>();
+        for (Param p : params) {
+            if (internals || !p.internal) {
+                l.add(p.name);
+            }
+        }
+        if (l.isEmpty()) {
+            return;
+        }
+        bw.write(before);
+        bw.write(l.get(0));
+        if (l.size() != 1) {
+            for (int i = 1; i < l.size(); i++) {
+                bw.write(between);
+                bw.write(l.get(i));
+            }
+        }
+        bw.write(after);
+    }
+
+    private static String makeFileName(File f) {
+        String abs = f.getAbsolutePath();
+        int i = abs.lastIndexOf('.');
+        return abs.substring(0, i) + "Params.java";
+    }
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/ROIFileNameElementMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ROIFileNameElementMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/ROIFileNameElementMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -17,15 +17,15 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.HashMap;
+import java.util.Map;
 
 public class ROIFileNameElementMapper implements FileNameElementMapper {
-	private Map basenames;
+	private Map<Integer, String> basenames;
 	int index;
 	
 	public ROIFileNameElementMapper () {
-		basenames = new HashMap();
+		basenames = new HashMap<Integer, String>();
 		index = 0;
 	}
 	
@@ -47,11 +47,11 @@
 	}
 
 	public String mapIndex(int index) {
-		return (String)(basenames.get(new Integer(index)));
+		return basenames.get(index);
 	}
 
 	public int rmapIndex(String pathElement) {
-		basenames.put(new Integer(index), pathElement);
+		basenames.put(index, pathElement);
 		return index++;
 	}
 

Modified: trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -22,18 +22,25 @@
 import java.util.StringTokenizer;
 
 import org.griphyn.vdl.mapping.Path;
-
+
+//TODO Is this still being used?
 public class ROIMapper extends AbstractFileMapper {
 	private int count;
-	private Map names;
+	private Map<String, Integer> names;
 	
 	public ROIMapper() {
 		super(new ROIFileNameElementMapper());
-		names = new HashMap();
+		names = new HashMap<String, Integer>();
 		count = 0;
 	}
-
-	public Path rmap(String name) {
+
+	@Override
+    public String getName() {
+        return "ROIMapper";
+    }
+
+    @Override
+	public Path rmap(AbstractFileMapperParams cp, String name) {
 		if (name.indexOf(".ROI") == -1) {
 			return null;
 		}
@@ -46,7 +53,7 @@
 		String basename = name.substring(0, ri);
 		
 		// get the right index
-		Integer idx = (Integer) names.get(basename);
+		Integer idx = names.get(basename);
 		boolean notseen = (idx == null);
 		
 		StringTokenizer st = new StringTokenizer(name.substring(ri+1), ".");
@@ -67,7 +74,7 @@
 					if (notseen) {
 						// we have not processed the name
 						elementMapper.rmapIndex(basename);
-						names.put(basename, new Integer(count));
+						names.put(basename, count);
 						++count;
 					}
 					path = path.addLast("image");
@@ -78,7 +85,7 @@
 				if (notseen) {
 					// we have not processed the name
 					elementMapper.rmapIndex(basename);
-					names.put(basename, new Integer(count));
+					names.put(basename, count);
 					++count;
 				}
 			} else {

Modified: trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -28,38 +28,43 @@
 
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
+import org.griphyn.vdl.mapping.RootHandle;
+import org.griphyn.vdl.type.Types;
 
-public class RegularExpressionMapper extends AbstractMapper {
-	public static final MappingParam PARAM_SOURCE = new MappingParam("source");
-	public static final MappingParam PARAM_MATCH = new MappingParam("match");
-	public static final MappingParam PARAM_TRANSFORM = new MappingParam("transform");
-	
-	private String match, source, transform;
-	
-	
+public class RegularExpressionMapper extends AbstractMapper {	
 	@Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_SOURCE, PARAM_MATCH, PARAM_TRANSFORM);
+	    s.addAll(RegularExpressionMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 
 	public RegularExpressionMapper() {
-	}
+	}	
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
-		if (!PARAM_MATCH.isPresent(this)) {
-			throw new RuntimeException("Missing parameter match!");
-		}
-		match = PARAM_MATCH.getStringValue(this);
-        source = PARAM_SOURCE.getStringValue(this);
-        transform = PARAM_TRANSFORM.getStringValue(this);
+	@Override
+    protected MappingParamSet newParams() {
+        return new RegularExpressionMapperParams();
+    }
+
+    @Override
+    public String getName() {
+        return "RegexpMapper";
+    }
+
+    @Override
+    public void initialize(RootHandle root) {
+		super.initialize(root);
+		RegularExpressionMapperParams cp = getParams();
+		if (!cp.getSource().getType().isPrimitive()) {
+            throw new IllegalArgumentException("Non-primitive value specified for 'source';" +
+            		" maybe you meant @filename(" + cp.getSource().toString() + ")?");
+        }
+		else if (!Types.STRING.equals(cp.getSource().getType())) {
+		    throw new IllegalArgumentException("'source' parameter must be a string");
+		}
 	}
 
 	public Collection<Path> existing() {
@@ -70,24 +75,19 @@
 		}
 	}
 
-	public PhysicalFormat map(Path path) {
-	    if (PARAM_MATCH.getRawValue(this) instanceof DSHandle) {
-	        DSHandle h = (DSHandle) PARAM_MATCH.getRawValue(this);
-	        if (!h.getType().isPrimitive()) {
-	            throw new IllegalArgumentException("Non-primitive value specified for " + 
-	                PARAM_MATCH.getName() + "; maybe you meant @filename(" + h.getPathFromRoot() + ")?");
-	        }
-	    }
-		
-		Pattern p = Pattern.compile(match);
+	public PhysicalFormat map(Path path) {
+	    RegularExpressionMapperParams cp = getParams();
+
+	    String source = (String) cp.getSource().getValue();
+	    Pattern p = Pattern.compile(cp.getMatch());
 		Matcher m = p.matcher(source);
 		if (!m.find()) {
-			throw new RuntimeException("No match found! source='" + source + "' match = '" + match
-					+ "'");
+			throw new RuntimeException("No match found! source='" + source + 
+			    "' match = '" + cp.getMatch() + "'");
 		}
 		// find group number to replace
 		Pattern p2 = Pattern.compile("(\\\\\\d)");
-		Matcher m2 = p2.matcher(transform);
+		Matcher m2 = p2.matcher(cp.getTransform());
 		StringBuffer sb = new StringBuffer();
 		while (m2.find()) {
                         String group = m2.group(1);
@@ -114,14 +114,7 @@
 		params.put("source", "2mass-j1223.fits");
 		params.put("match", "(.*)\\.(.*)");
 		params.put("transform", "\\1_area.\\2");
-		MappingParamSet mps = new MappingParamSet();
-		mps.setAll(params);
-		try {
-            reMapper.setParams(mps);
-        }
-        catch (HandleOpenException e) {
-            e.printStackTrace();
-        }
+		reMapper.setParameters(params);
 		System.out.println(reMapper.map(Path.EMPTY_PATH));
 	}
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,4 @@
+ at import org.griphyn.vdl.mapping.DSHandle
+DSHandle source
+String match
+String transform = null
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,103 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+import org.griphyn.vdl.mapping.DSHandle;
+
+
+public class RegularExpressionMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("source", "match", "transform");
+
+	private Object source;
+	private Object match;
+	private Object transform = null;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setSource(DSHandle source) {
+		this.source = source;
+	}
+
+	public DSHandle getSource() {
+		return (DSHandle) source;
+	}
+
+	public void setMatch(String match) {
+		this.match = match;
+	}
+
+	public String getMatch() {
+		return (String) match;
+	}
+
+	public void setTransform(String transform) {
+		this.transform = transform;
+	}
+
+	public String getTransform() {
+		return (String) transform;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("source")) {
+			this.source = value;
+		}
+		else if (name.equals("match")) {
+			this.match = value;
+		}
+		else if (name.equals("transform")) {
+			this.transform = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(source)) {
+			return (AbstractDataNode) source;
+		}
+		else if (checkOpen(match)) {
+			return (AbstractDataNode) match;
+		}
+		else if (checkOpen(transform)) {
+			return (AbstractDataNode) transform;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "source", source);
+		addParam(sb, "match", match);
+		addParam(sb, "transform", transform);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (source == null) {
+			throw new IllegalArgumentException("Missing required argument 'source'");
+		}
+		if (match == null) {
+			throw new IllegalArgumentException("Missing required argument 'match'");
+		}
+		match = unwrap(match);
+		transform = unwrap(transform);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -20,28 +20,36 @@
  */
 package org.griphyn.vdl.mapping.file;
 
-import org.griphyn.vdl.mapping.HandleOpenException;
 import java.util.Set;
-import org.griphyn.vdl.mapping.MappingParam;
+
 import org.griphyn.vdl.mapping.MappingParamSet;
+import org.griphyn.vdl.mapping.RootHandle;
 
 public class SimpleFileMapper extends AbstractFileMapper {
-	public static final MappingParam PARAM_PADDING = new MappingParam("padding", new Integer(4));
-	
-	
-	@Override
+
+    @Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_PADDING);
-        super.getValidMappingParams(s);
+	    s.addAll(SimpleFileMapperParams.NAMES);
+	    super.getValidMappingParams(s);
     }
 
 	public SimpleFileMapper() {
 		super();
 	}
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
-		int precision = PARAM_PADDING.getIntValue(this);
-		setElementMapper(new DefaultFileNameElementMapper(precision));
+	@Override
+    public MappingParamSet newParams() {
+        return new SimpleFileMapperParams();
+    }
+
+    @Override
+    public String getName() {
+        return "SimpleMapper";
+    }
+
+    public void initialize(RootHandle root) {
+		super.initialize(root);
+		SimpleFileMapperParams cp = getParams();
+		setElementMapper(new DefaultFileNameElementMapper(cp.getPadding()));
 	}
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,3 @@
+ at suppressUnusedWarning
+ at extends AbstractFileMapperParams
+Integer padding = 4
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,64 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+ at SuppressWarnings("unused")
+public class SimpleFileMapperParams extends AbstractFileMapperParams {
+
+	public static final List<String> NAMES = Arrays.asList("padding");
+
+	private Object padding = 4;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setPadding(Integer padding) {
+		this.padding = padding;
+	}
+
+	public Integer getPadding() {
+		return (Integer) padding;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("padding")) {
+			this.padding = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(padding)) {
+			return (AbstractDataNode) padding;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "padding", padding);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		padding = unwrap(padding);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -22,10 +22,7 @@
 import java.util.Collections;
 import java.util.Set;
 
-import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.HandleOpenException;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
@@ -33,13 +30,10 @@
 /** Maps every Path to a single file name (specified by the "file" parameter).
   */
 public class SingleFileMapper extends AbstractMapper {
-
-	public static final MappingParam PARAM_FILE = new MappingParam("file");	
-	private AbsFile file;
 	
 	@Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_FILE);
+	    s.addAll(SingleFileMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 
@@ -47,14 +41,20 @@
 		super();
 	}
 
-	@Override
-    public void setParams(MappingParamSet params) throws HandleOpenException {
-        super.setParams(params);
-        file = new AbsFile(PARAM_FILE.getStringValue(this));
+    @Override
+    protected MappingParamSet newParams() {
+        return new SingleFileMapperParams();
     }
 
+    @Override
+    public String getName() {
+        return "SingleFileMapper";
+    }
+
+    @Override
     public Collection<Path> existing() {
-		if (file.exists()) {
+        SingleFileMapperParams cp = getParams();
+		if (cp.getFile().exists()) {
 			return Arrays.asList(new Path[] {Path.EMPTY_PATH});
 		}
 		else {
@@ -62,8 +62,10 @@
 		}
 	}
 
+    @Override
 	public PhysicalFormat map(Path path) {
-		return file;
+        SingleFileMapperParams cp = getParams();
+        return cp.getFile();
 	}
 
 	public boolean isStatic() {

Added: trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,64 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class SingleFileMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("file");
+
+	private Object file;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public AbsFile getFile() {
+		return (AbsFile) file;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("file")) {
+			this.file = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(file)) {
+			return (AbstractDataNode) file;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "file", file);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (file == null) {
+			throw new IllegalArgumentException("Missing required argument 'file'");
+		}
+		file = new AbsFile((String) unwrap(file));
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -30,8 +30,6 @@
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.InvalidPathException;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
 
@@ -39,36 +37,27 @@
 
         public static final Logger logger =
             Logger.getLogger(StructuredRegularExpressionMapper.class);
-
-        public static final MappingParam PARAM_SOURCE = new MappingParam("source");
-	public static final MappingParam PARAM_MATCH = new MappingParam("match");
-	public static final MappingParam PARAM_TRANSFORM = new MappingParam("transform");
-	
-	private String match, transform;
 		
 	@Override
     protected void getValidMappingParams(Set<String> s) {
-	    addParams(s, PARAM_SOURCE, PARAM_MATCH, PARAM_TRANSFORM);
+	    s.addAll(StructuredRegularExpressionMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
 
 	public StructuredRegularExpressionMapper() {
 	}
+
+	@Override
+    public String getName() {
+        return "StructuredRegexpMapper";
+    }
+
+    @Override
+	public Collection<Path> existing() {
+	    StructuredRegularExpressionMapperParams cp = getParams();
 
-	public void setParams(MappingParamSet params) throws HandleOpenException {
-		super.setParams(params);
-		if (!PARAM_MATCH.isPresent(this)) {
-			throw new RuntimeException("Missing parameter match!");
-		}
-		
-		match = PARAM_MATCH.getStringValue(this);
-        transform = PARAM_TRANSFORM.getStringValue(this);
-	}
+		DSHandle sourceHandle = cp.getSource();
 
-	public Collection<Path> existing() {
-
-		DSHandle sourceHandle = (DSHandle) PARAM_SOURCE.getRawValue(this);
-
 		Collection<Path> output = new ArrayList<Path>();
 		Collection<DSHandle> sourceFields;
 		try {
@@ -89,12 +78,15 @@
 
 		return output;
 	}
+
+	@Override
+	public PhysicalFormat map(Path path) {
+	    if (logger.isDebugEnabled()) {
+	        logger.debug("map(): path: " + path);
+	    }
+        StructuredRegularExpressionMapperParams cp = getParams();
 
-	public PhysicalFormat map(Path path) {
-
-                logger.debug("map(): path: " + path); 
-
-		DSHandle sourceHandle = (DSHandle) PARAM_SOURCE.getRawValue(this);
+		DSHandle sourceHandle = cp.getSource();
 		DSHandle hereHandle;
 		try {
 			hereHandle = sourceHandle.getField(path);
@@ -102,22 +94,22 @@
 		catch (InvalidPathException ipe) {
 			throw new RuntimeException("Cannot get requested path " + path
 					+ " from source data structure");
-		}
-
-		PhysicalFormat source = hereHandle.getRoot().getMapper().map(hereHandle.getPathFromRoot());
+		}
+		
+		PhysicalFormat source = hereHandle.getMapper().map(hereHandle.getPathFromRoot());
 		if (!source.getType().equals("file")) {
 			throw new RuntimeException(
 					"Cannot use the regular expression mapper with a source that has a mapper that is not file-based");
 		}
-		Pattern p = Pattern.compile(match);
+		Pattern p = Pattern.compile(cp.getMatch());
 		Matcher m = p.matcher(((AbsFile) source).getPath());
 		if (!m.find()) {
-			throw new RuntimeException("No match found! source='" + source + "' match = '" + match
+			throw new RuntimeException("No match found! source='" + source + "' match = '" + cp.getMatch()
 					+ "'");
 		}
 		// find group number to replace
 		Pattern p2 = Pattern.compile("(\\\\\\d)");
-		Matcher m2 = p2.matcher(transform);
+		Matcher m2 = p2.matcher(cp.getTransform());
 		StringBuffer sb = new StringBuffer();
 		while (m2.find()) {
 			String group = m2.group(1);

Added: trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,4 @@
+ at import org.griphyn.vdl.mapping.DSHandle
+DSHandle source
+String match
+String transform = null
\ No newline at end of file

Added: trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,103 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+import org.griphyn.vdl.mapping.DSHandle;
+
+
+public class StructuredRegularExpressionMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("source", "match", "transform");
+
+	private Object source;
+	private Object match;
+	private Object transform = null;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setSource(DSHandle source) {
+		this.source = source;
+	}
+
+	public DSHandle getSource() {
+		return (DSHandle) source;
+	}
+
+	public void setMatch(String match) {
+		this.match = match;
+	}
+
+	public String getMatch() {
+		return (String) match;
+	}
+
+	public void setTransform(String transform) {
+		this.transform = transform;
+	}
+
+	public String getTransform() {
+		return (String) transform;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("source")) {
+			this.source = value;
+		}
+		else if (name.equals("match")) {
+			this.match = value;
+		}
+		else if (name.equals("transform")) {
+			this.transform = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(source)) {
+			return (AbstractDataNode) source;
+		}
+		else if (checkOpen(match)) {
+			return (AbstractDataNode) match;
+		}
+		else if (checkOpen(transform)) {
+			return (AbstractDataNode) transform;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "source", source);
+		addParam(sb, "match", match);
+		addParam(sb, "transform", transform);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (source == null) {
+			throw new IllegalArgumentException("Missing required argument 'source'");
+		}
+		if (match == null) {
+			throw new IllegalArgumentException("Missing required argument 'match'");
+		}
+		match = unwrap(match);
+		transform = unwrap(transform);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/mapping/file/TestMapper.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -23,48 +23,42 @@
 
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.Mapper;
-import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
 
 
 public class TestMapper extends AbstractMapper {
-    public static final MappingParam PARAM_FILE = new MappingParam("file");
-    public static final MappingParam PARAM_TEMP = new MappingParam("temp", false);
-    public static final MappingParam PARAM_REMAPPABLE = new MappingParam("remappable", false);
-    public static final MappingParam PARAM_STATIC = new MappingParam("static", true);
     
     @Override
     protected void getValidMappingParams(Set<String> s) {
-        addParams(s, PARAM_FILE, PARAM_TEMP, PARAM_REMAPPABLE, PARAM_STATIC);
+        s.addAll(TestMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
     
-    private PhysicalFormat remap, map;
+    private PhysicalFormat remap, map;    
     
-    private boolean remappable, temp, _static;
-    private String file;
+    @Override
+    protected MappingParamSet newParams() {
+        return new TestMapperParams();
+    }
 
     @Override
-    public void setParams(MappingParamSet params) throws HandleOpenException {
-        super.setParams(params);
-        remappable = PARAM_REMAPPABLE.getBooleanValue(this);
-        temp = PARAM_TEMP.getBooleanValue(this);
-        _static = PARAM_STATIC.getBooleanValue(this);
-        file = PARAM_FILE.getStringValue(this);
+    public String getName() {
+        return "TestMapper";
     }
 
     @Override
     public boolean canBeRemapped(Path path) {
-        return remappable;
+        TestMapperParams cp = getParams();
+        return cp.getRemappable();
     }
 
     @Override
     public void remap(Path path, Mapper sourceMapper, Path sourcePath) {
-        if (remappable) {
+        TestMapperParams cp = getParams();
+        if (cp.getRemappable()) {
             remap = sourceMapper.map(sourcePath);
             System.out.println("Remapping " + path + " -> " + remap);
             ensureCollectionConsistency(sourceMapper, sourcePath);
@@ -76,8 +70,9 @@
 
     @Override
     public void clean(Path path) {
+        TestMapperParams cp = getParams();
         PhysicalFormat pf = map(path);
-        if (temp) {
+        if (cp.getTemp()) {
             System.out.println("Cleaning file " + pf);
             FileGarbageCollector.getDefault().decreaseUsageCount(pf);
         }
@@ -88,13 +83,15 @@
 
     @Override
     public boolean isPersistent(Path path) {
-        return !temp;
+        TestMapperParams cp = getParams();
+        return !cp.getTemp();
     }
 
     public PhysicalFormat map(Path path) {
+        TestMapperParams cp = getParams();
         if (remap == null) {
             if (map == null) {
-                map = new AbsFile(file);
+                map = new AbsFile(cp.getFile());
             }
             return map;
         }
@@ -108,6 +105,7 @@
     }
 
     public boolean isStatic() {
-        return _static;
+        TestMapperParams cp = getParams();
+        return cp.getStatic_();
     }
 }

Added: trunk/src/org/griphyn/vdl/mapping/file/TestMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/TestMapper.params	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/TestMapper.params	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,4 @@
+String file
+Boolean temp = false
+Boolean remappable = false
+Boolean static_ = true

Added: trunk/src/org/griphyn/vdl/mapping/file/TestMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/TestMapperParams.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/file/TestMapperParams.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,117 @@
+package org.griphyn.vdl.mapping.file;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.griphyn.vdl.mapping.AbstractDataNode;
+import org.griphyn.vdl.mapping.MappingParamSet;
+
+
+public class TestMapperParams extends MappingParamSet {
+
+	public static final List<String> NAMES = Arrays.asList("file", "temp", "remappable", "static_");
+
+	private Object file;
+	private Object temp = false;
+	private Object remappable = false;
+	private Object static_ = true;
+
+	@Override
+	public Collection<String> getNames() {
+		return NAMES;
+	}
+
+	public void setFile(String file) {
+		this.file = file;
+	}
+
+	public String getFile() {
+		return (String) file;
+	}
+
+	public void setTemp(Boolean temp) {
+		this.temp = temp;
+	}
+
+	public Boolean getTemp() {
+		return (Boolean) temp;
+	}
+
+	public void setRemappable(Boolean remappable) {
+		this.remappable = remappable;
+	}
+
+	public Boolean getRemappable() {
+		return (Boolean) remappable;
+	}
+
+	public void setStatic_(Boolean static_) {
+		this.static_ = static_;
+	}
+
+	public Boolean getStatic_() {
+		return (Boolean) static_;
+	}
+
+	@Override
+	protected boolean set0(String name, Object value) {
+		if (name.equals("file")) {
+			this.file = value;
+		}
+		else if (name.equals("temp")) {
+			this.temp = value;
+		}
+		else if (name.equals("remappable")) {
+			this.remappable = value;
+		}
+		else if (name.equals("static_")) {
+			this.static_ = value;
+		}
+		else {
+			return super.set0(name, value);
+		}
+		return true;
+	}
+
+	@Override
+	public AbstractDataNode getFirstOpen() {
+		if (checkOpen(file)) {
+			return (AbstractDataNode) file;
+		}
+		else if (checkOpen(temp)) {
+			return (AbstractDataNode) temp;
+		}
+		else if (checkOpen(remappable)) {
+			return (AbstractDataNode) remappable;
+		}
+		else if (checkOpen(static_)) {
+			return (AbstractDataNode) static_;
+		}
+		else {
+			return super.getFirstOpen();
+		}
+	}
+
+	@Override
+	public void toString(StringBuilder sb) {
+		addParam(sb, "file", file);
+		addParam(sb, "temp", temp);
+		addParam(sb, "remappable", remappable);
+		addParam(sb, "static_", static_);
+		super.toString(sb);
+	}
+
+	@Override
+	public void unwrapPrimitives() {
+		if (file == null) {
+			throw new IllegalArgumentException("Missing required argument 'file'");
+		}
+		file = unwrap(file);
+		temp = unwrap(temp);
+		remappable = unwrap(remappable);
+		static_ = unwrap(static_);
+		super.unwrapPrimitives();
+	}
+
+
+}

Modified: trunk/src/org/griphyn/vdl/type/Field.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/Field.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/type/Field.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -17,7 +17,11 @@
 
 package org.griphyn.vdl.type;
 
-import org.griphyn.vdl.type.impl.FieldImpl;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.griphyn.vdl.type.impl.FieldImpl;
+import org.griphyn.vdl.type.impl.ImmutableField;
 
 public interface Field {
 	/**
@@ -42,7 +46,9 @@
 	 * set the type of the field
 	 * @param type
 	 */
-	public void setType(Type type);
+	public void setType(Type type);
+	
+	
 
 	/**
 	 * A factory class with static methods for creating instances
@@ -50,14 +56,27 @@
 	 */
 
 	public static final class Factory
-	{
+	{
+	    private static final Map<Field, Field> fieldCache = new HashMap<Field, Field>(); 
 		public static Field newInstance() {
 			return new FieldImpl();
 		}
 		
 		public static Field createField(Comparable<?> id, Type type) {
 			return new FieldImpl(id, type);
-		}		
+		}
+		
+		public static synchronized Field getImmutableField(Comparable<?> id, Type type) {
+		    Field f = new ImmutableField(id, type);
+		    Field cached = fieldCache.get(f);
+		    if (cached == null) {
+		        fieldCache.put(f, f);
+		        return f;
+		    }
+		    else {
+		        return cached;
+		    }
+		}
 	}
 }
 

Modified: trunk/src/org/griphyn/vdl/type/Type.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/Type.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/type/Type.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -185,5 +185,7 @@
 			return new TypeImpl(namespace, name, primitive);
 		}
 
-	}
+	}
+
+    public boolean hasNonPrimitiveComponents();
 }

Modified: trunk/src/org/griphyn/vdl/type/impl/FieldImpl.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/FieldImpl.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/type/impl/FieldImpl.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -62,5 +62,26 @@
 
 	public void setType(Type type) {
 		this.type = type;
-	}
+	}
+
+    @Override
+    public int hashCode() {
+        return (id == null ? 0 : id.hashCode()) + (type == null ? 0 : type.hashCode());  
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof Field) {
+            Field f = (Field) obj;
+            return comp(f.getId(), id) && comp(f.getType(), type);
+        }
+        return super.equals(obj);
+    }
+
+    private boolean comp(Object o1, Object o2) {
+        if (o1 == null) {
+            return o2 == null;
+        }
+        return o1.equals(o2);
+    }
 }

Added: trunk/src/org/griphyn/vdl/type/impl/ImmutableField.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/ImmutableField.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/type/impl/ImmutableField.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -0,0 +1,34 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 18, 2013
+ */
+package org.griphyn.vdl.type.impl;
+
+import org.griphyn.vdl.type.Type;
+
+public class ImmutableField extends FieldImpl {
+
+    public ImmutableField(Comparable<?> id, Type type) {
+        super(id, type);
+    }
+
+    @Override
+    public void setId(Comparable<?> id) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setArray() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setType(Type type) {
+        throw new UnsupportedOperationException();
+    }
+}

Modified: trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -31,7 +31,8 @@
 public class TypeImpl extends UnresolvedType {
 	private boolean primitive;
 	private Map<String, Field> fields;
-	private Type baseType;
+	private Type baseType;
+	private Boolean hasNonPrimitiveComponents;
 	
 	public TypeImpl() {
 		this((URI) null, null, false);
@@ -127,11 +128,44 @@
 		primitive = true;
 	}
 	
-
     public boolean isComposite() {
         return isArray() || !fields.isEmpty();
-    }
+    }
+    
+    public synchronized boolean hasNonPrimitiveComponents() {
+        if (hasNonPrimitiveComponents == null) {
+            if (isPrimitive()) {
+                hasNonPrimitiveComponents = false;
+            }
+            else if (!isComposite()) {
+                // mapped
+                hasNonPrimitiveComponents = true;
+            }
+            else if (isArray()) {
+                if (keyType().hasNonPrimitiveComponents()) {
+                    hasNonPrimitiveComponents = true;
+                }
+                else if (itemType().hasNonPrimitiveComponents()) {
+                    hasNonPrimitiveComponents = true;
+                }
+                else {
+                    hasNonPrimitiveComponents = false;
+                }
+            }
+            else {
+                // struct
+                for (Field f : getFields()) {
+                    if (f.getType().hasNonPrimitiveComponents()) {
+                        return hasNonPrimitiveComponents = true;
+                    }
+                }
+                hasNonPrimitiveComponents = false;
+            }
+        }
+        return hasNonPrimitiveComponents;
+    }
 
+
     public static class Array extends TypeImpl {
 		private Field field;
 		private Type keyType;

Modified: trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java	2013-11-23 04:13:01 UTC (rev 7311)
+++ trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java	2013-11-23 04:17:47 UTC (rev 7312)
@@ -84,7 +84,12 @@
 		throw new UnsupportedOperationException("addField");
 	}
 	
-	public String getName() {
+	@Override
+    public boolean hasNonPrimitiveComponents() {
+        throw new UnsupportedOperationException();
+    }
+
+    public String getName() {
 		return name;
 	}
 




More information about the Swift-commit mailing list