[Swift-commit] r5927 - in trunk/src/org/griphyn/vdl: karajan karajan/lib mapping mapping/file

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Sep 15 03:59:46 CDT 2012


Author: hategan
Date: 2012-09-15 03:59:46 -0500 (Sat, 15 Sep 2012)
New Revision: 5927

Added:
   trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
Modified:
   trunk/src/org/griphyn/vdl/karajan/Monitor.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/PartialCloseDataset.java
   trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
   trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
   trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
   trunk/src/org/griphyn/vdl/mapping/DSHandle.java
   trunk/src/org/griphyn/vdl/mapping/DataNode.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/MappingParam.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/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/FixedArrayFileMapper.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/StructuredRegularExpressionMapper.java
Log:
typesafe (or namesafe?) class for mapper parameters; all swift internal parameters are prefixed with "swift#"

Modified: trunk/src/org/griphyn/vdl/karajan/Monitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Monitor.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/Monitor.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -37,13 +37,9 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
@@ -67,6 +63,7 @@
 import org.griphyn.vdl.mapping.ArrayDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.DependentException;
+import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class Monitor implements ActionListener, MouseListener {
@@ -228,6 +225,9 @@
 		for (Map.Entry<DSHandle, Future> en : copy.entrySet()) {
 			Future f = en.getValue();
 			AbstractDataNode handle = (AbstractDataNode) en.getKey();
+			if (handle.isClosed()) {
+				continue;
+			}
 			String value = "-";
 			try {
 				if (handle.getValue() != null) {
@@ -244,8 +244,10 @@
 			    ps.println(handle.getType() + " " + handle.getDisplayableName() + " " + value + " " + f);
 			}
 			catch (Exception e) {
-			    ps.println(handle.getDisplayableName() + " - error");
-			    e.printStackTrace(ps);
+				if (!handle.isClosed()) {
+				    ps.println(handle.getDisplayableName() + " - error");
+				    e.printStackTrace(ps);
+				}
 			}
 			ps.println("----");
 		}
@@ -280,9 +282,9 @@
     }
 
     public static String varWithLine(DSHandle value) {
-		String line = value.getRoot().getParam("line");
+		String line = value.getRoot().getParam(MappingParam.SWIFT_LINE);
 		Path path = value.getPathFromRoot();
-		return value.getRoot().getParam("dbgname") + 
+		return value.getRoot().getParam(MappingParam.SWIFT_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	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/CreateArray.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,7 +17,6 @@
 
 package org.griphyn.vdl.karajan.lib;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -28,6 +27,8 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.futures.FutureFault;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.RootArrayDataNode;
 import org.griphyn.vdl.type.Field;
@@ -102,9 +103,9 @@
 
     private void setMapper(DSHandle handle) {
         // slap a concurrent mapper on this
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("descriptor", "concurrent_mapper");
-        params.put("dbgname", "arrayexpr");
+        MappingParamSet params = new MappingParamSet();
+        params.set(MappingParam.SWIFT_DESCRIPTOR, "concurrent_mapper");
+        params.set(MappingParam.SWIFT_DBGNAME, "arrayexpr");
         handle.init(params);
     }
 

Modified: trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -29,6 +29,7 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.nodes.restartLog.LogEntry;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class IsLogged extends VDLFunction {
@@ -51,7 +52,7 @@
 	
 	public static boolean isLogged(VariableStack stack, DSHandle var, Path path) throws ExecutionException {
 	    path = var.getPathFromRoot().append(path);
-        LogEntry entry = LogEntry.build(var.getRoot().getParam("swift#restartid") + "." + path.stringForm());
+        LogEntry entry = LogEntry.build(var.getRoot().getParam(MappingParam.SWIFT_RESTARTID) + "." + path.stringForm());
         Map map = getLogData(stack);
         boolean found = false;
         synchronized (map) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -27,6 +27,7 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.nodes.restartLog.RestartLog;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 
 public class LogVar extends VDLFunction {
@@ -57,7 +58,7 @@
         } else {
             annotation = "unmapped";
         }
-        RestartLog.LOG_CHANNEL.ret(stack, var.getRoot().getParam("swift#restartid")
+        RestartLog.LOG_CHANNEL.ret(stack, var.getRoot().getParam(MappingParam.SWIFT_RESTARTID)
                 + "." + path.stringForm() + "!" + annotation);
 	}
 }

Modified: trunk/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/New.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/New.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -20,22 +20,22 @@
  */
 package org.griphyn.vdl.karajan.lib;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-
 import org.globus.cog.karajan.arguments.Arg;
 import org.globus.cog.karajan.stack.VariableStack;
 import org.globus.cog.karajan.util.TypeUtil;
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.ExternalDataNode;
+import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.RootArrayDataNode;
 import org.griphyn.vdl.mapping.RootDataNode;
-import org.griphyn.vdl.mapping.ExternalDataNode;
 import org.griphyn.vdl.mapping.file.ConcurrentMapper;
 import org.griphyn.vdl.type.Type;
 import org.griphyn.vdl.type.Types;
@@ -64,35 +64,34 @@
 		String dbgname = TypeUtil.toString(OA_DBGNAME.getValue(stack));
 		String waitfor = (String) OA_WAITFOR.getValue(stack);
 		String line = (String) getProperty("_defline");
+		
+		MappingParamSet mps = new MappingParamSet();
+		mps.setAll(mapping);
 
-		if (mapping == null) {
-			mapping = new HashMap<String, Object>();
-		}
-
 		if (dbgname != null) {
-			mapping.put("dbgname", dbgname);
+			mps.set(MappingParam.SWIFT_DBGNAME, dbgname);
 		}
 		
 		if (line != null) {
-		    mapping.put("line", line);
+		    mps.set(MappingParam.SWIFT_LINE, line);
 		}
 
-		mapping.put("swift#restartid", getThreadPrefix(stack) + ":" + dbgname);
+		mps.set(MappingParam.SWIFT_RESTARTID, getThreadPrefix(stack) + ":" + dbgname);
 
 		if (waitfor != null) {
-			mapping.put("waitfor", waitfor);
+			mps.set(MappingParam.SWIFT_WAITFOR, waitfor);
 		}
 
 		if (typename == null && value == null) {
 			throw new ExecutionException("You must specify either a type or a value");
 		}
 	
-		String mapper = (String) mapping.get("descriptor");
+		String mapper = (String) mps.get(MappingParam.SWIFT_DESCRIPTOR);
 		if ("concurrent_mapper".equals(mapper)) {
 		    String threadPrefix = getThreadPrefix(stack);
-		    ConcurrentMapper.PARAM_THREAD_PREFIX.setValue(mapping, threadPrefix);
+		    mps.set(ConcurrentMapper.PARAM_THREAD_PREFIX, threadPrefix);
 		}
-		mapping.put("#basedir", stack.getExecutionContext().getBasedir());
+		mps.set(MappingParam.SWIFT_BASEDIR, stack.getExecutionContext().getBasedir());
 		
 		try {
 			Type type;
@@ -139,14 +138,14 @@
 					handle.closeShallow();
 				}
 
-				handle.init(mapping);
+				handle.init(mps);
 			}
 			else if (value instanceof DSHandle) {
 				handle = (DSHandle) value;
 			}
 			else {
 				handle = new RootDataNode(type);
-				handle.init(mapping);
+				handle.init(mps);
 				if (value != null) {
 					handle.setValue(internalValue(type, value));
 				}

Modified: trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/NiceName.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -25,6 +25,7 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 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 VDLFunction {
@@ -39,7 +40,7 @@
 			DSHandle field = var.getField(path);
 			Path p = field.getPathFromRoot();
 			if (p.equals(Path.EMPTY_PATH)) {
-				Object dbgname = field.getRoot().getParam("dbgname");
+				Object dbgname = field.getRoot().getParam(MappingParam.SWIFT_DBGNAME);
 				if (dbgname == null) {
 					return "tmp"+field.getRoot().hashCode();
 				}
@@ -48,7 +49,7 @@
 				}
 			}
 			else {
-				return field.getRoot().getParam("dbgname") + "." + p;
+				return field.getRoot().getParam(MappingParam.SWIFT_DBGNAME) + "." + p;
 			}
 		}
 		catch (InvalidPathException e) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -22,6 +22,7 @@
 import org.globus.cog.karajan.stack.VariableStack;
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.MappingParam;
 
 import java.util.StringTokenizer;
 import java.util.List;
@@ -73,7 +74,7 @@
 			    logger.debug("Adding token "+closeID+" with hash "+closeID.hashCode());
 			}
 
-			String needToWaitFor = var.getParam("waitfor");
+			String needToWaitFor = var.getParam(MappingParam.SWIFT_WAITFOR);
 			logger.debug("need to wait for " + needToWaitFor);
 			StringTokenizer stok = new StringTokenizer(needToWaitFor, " ");
 			while(stok.hasMoreTokens()) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -37,6 +37,7 @@
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.InvalidPathException;
 import org.griphyn.vdl.mapping.Mapper;
+import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.type.Type;
 
@@ -84,7 +85,7 @@
 	}
 
 	private String getVarName(DSHandle var) {
-	    String name = var.getRoot().getParam("dbgname");
+	    String name = var.getRoot().getParam(MappingParam.SWIFT_DBGNAME);
         if (var == var.getRoot()) {
             return name;
         }

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -87,9 +87,13 @@
         }
     }
 
-    public void init(Map<String, Object> params) {
+    public void init(MappingParamSet params) {
         throw new UnsupportedOperationException();
     }
+    
+    public final void init(Map<String, Object> params) {
+        throw new UnsupportedOperationException();
+    }
 
     public Type getType() {
         return field.getType();
@@ -193,9 +197,9 @@
     }
 
     public String getDisplayableName() {
-        String prefix = getRoot().getParam("dbgname");
+        String prefix = getRoot().getParam(MappingParam.SWIFT_DBGNAME);
         if (prefix == null) {
-            prefix = getRoot().getParam("prefix");
+            prefix = getRoot().getParam(PARAM_PREFIX);
         }
         if (prefix == null) {
             prefix = "?";

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,9 +17,6 @@
 
 package org.griphyn.vdl.mapping;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.log4j.Logger;
 import org.griphyn.vdl.mapping.file.FileGarbageCollector;
 
@@ -33,25 +30,25 @@
 
 	public static final Logger logger = Logger.getLogger(AbstractMapper.class);
 	public static final MappingParam PARAM_INPUT = new MappingParam("input", Boolean.FALSE);
-	protected Map<String, Object> params;
+	protected MappingParamSet params;
 
-	public synchronized void setParam(String name, Object value) {
+	public synchronized void setParam(MappingParam param, Object value) {
 		if (params == null) {
-			params = new HashMap<String, Object>();
+			params = new MappingParamSet();
 		}
-		params.put(name, value);
+		params.set(param, value);
 	}
 
-	public synchronized Object getParam(String name) {
+	public synchronized Object getParam(MappingParam param) {
 		if (params != null) {
-			return params.get(name);
+			return params.get(param);
 		}
 		else {
 			return null;
 		}
 	}
 
-	public void setParams(Map<String, Object> params) {
+	public void setParams(MappingParamSet params) {
 		this.params = params;
 	}
 

Modified: trunk/src/org/griphyn/vdl/mapping/DSHandle.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DSHandle.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/DSHandle.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -47,7 +47,7 @@
      */
     public Type getType();
 
-    public void init(Map<String, Object> params);
+    public void init(MappingParamSet params);
 
     public DSHandle getRoot();
 
@@ -90,7 +90,7 @@
 
     public void set(DSHandle svar);
 
-    public String getParam(String name);
+    public String getParam(MappingParam name);
 
     public boolean isClosed();
 

Modified: trunk/src/org/griphyn/vdl/mapping/DataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/DataNode.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/DataNode.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -48,7 +48,7 @@
 		this.parent = parent;
 	}
 
-	public String getParam(String name) {
+	public String getParam(MappingParam p) {
 		return null;
 	}
 }

Modified: trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/ExternalDataNode.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -39,14 +39,14 @@
 
 	private static final String datasetIDPartialID = Loader.getUUID();
 	
-	private Map<String, Object> params;
+	private MappingParamSet params;
 
 	public ExternalDataNode() {
 	    super(new FieldImpl("", Types.EXTERNAL));
 	}
 
 	@Override
-    public void init(Map<String, Object> params) {
+    public void init(MappingParamSet params) {
         this.params = params;
     }
 
@@ -113,10 +113,10 @@
 	    return null;
 	}
 
-    public String getParam(String name) {
+    public String getParam(MappingParam p) {
         if (params == null) {
             return null;
         }
-        return (String) params.get(name);
+        return (String) params.get(p);
     }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/Mapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/Mapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/Mapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -18,7 +18,6 @@
 package org.griphyn.vdl.mapping;
 
 import java.util.Collection;
-import java.util.Map;
 
 /** This interface must be implemented by a Java class that represents
     a Swift mapper between SwiftScript variables and external data
@@ -55,11 +54,11 @@
      */
     boolean isStatic();
 
-    void setParams(Map<String, Object> params);
+    void setParams(MappingParamSet params);
 
-    void setParam(String name, Object value);
+    void setParam(MappingParam p, Object value);
 
-    Object getParam(String name);
+    Object getParam(MappingParam name);
 
     /**
      * Specifies whether paths mapped by this mapper can be re-mapped

Modified: trunk/src/org/griphyn/vdl/mapping/MapperFactory.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MapperFactory.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/MapperFactory.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -62,8 +62,7 @@
 		registerMapper("test_mapper", TestMapper.class);
 	}
 
-	public synchronized static Mapper getMapper(String type, 
-	                                            Map<String,Object> params) 
+	public synchronized static Mapper getMapper(String type, MappingParamSet params) 
 	throws InvalidMapperException {
 		Class<Mapper> cls = mappers.get(type);
 		if (cls == null) {

Modified: trunk/src/org/griphyn/vdl/mapping/MappingParam.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParam.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParam.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,8 +17,6 @@
 
 package org.griphyn.vdl.mapping;
 
-import java.util.Map;
-
 import org.griphyn.vdl.type.Types;
 
 /** The MappingParam class provides helper methods to deal with
@@ -28,6 +26,16 @@
   * retrieve parameters in the mapper code.
   */
 public class MappingParam {
+    public static final MappingParam SWIFT_LINE = new MappingParam("swift#line");
+    public static final MappingParam SWIFT_DBGNAME = new MappingParam("swift#dbgname");
+    public static final MappingParam SWIFT_RESTARTID = new MappingParam("swift#restartid");
+    public static final MappingParam SWIFT_WAITFOR = new MappingParam("swift#waitfor");
+    public static final MappingParam SWIFT_BASEDIR = new MappingParam("swift#basedir");
+    public static final MappingParam SWIFT_DESCRIPTOR = new MappingParam("swift#descriptor");
+    public static final MappingParam SWIFT_INPUT = new MappingParam("swift#input");
+    public static final MappingParam SWIFT_HANDLE = new MappingParam("swift#handle");
+    
+    
 	private final String name;
 	private Object defValue;
 	private boolean defSet;
@@ -57,7 +65,7 @@
 	  * will be returned.
 	  */
 	public Object getValue(Mapper mapper) {
-		Object value = mapper.getParam(name);
+		Object value = mapper.getParam(this);
 		if (value instanceof AbstractDataNode) {
 			AbstractDataNode handle = (AbstractDataNode) value;
 			handle.waitFor();
@@ -82,8 +90,8 @@
 		}
 	}
 	
-	public Object getValue(Map<String, Object> params) {
-        Object value = params.get(name);
+	public Object getValue(MappingParamSet params) {
+        Object value = params.get(this);
         if (value instanceof AbstractDataNode) {
             AbstractDataNode handle = (AbstractDataNode) value;
             handle.waitFor();
@@ -108,7 +116,7 @@
 	/** return the raw value of this parameter. Defaulting and type
 	  * conversion will not occur. */
 	public Object getRawValue(Mapper mapper) {
-		return mapper.getParam(name);
+		return mapper.getParam(this);
 	}
 
 	/** Returns the mapper parameter as a String. Other data types will be
@@ -121,7 +129,7 @@
 		return String.valueOf(value);
 	}
 	
-	public String getStringValue(Map params) {
+	public String getStringValue(MappingParamSet params) {
         Object value = getValue(params);
         if (value == null) {
             return null;
@@ -130,15 +138,15 @@
     }
 
 	public void setValue(Mapper mapper, Object value) {
-		mapper.setParam(name, value);
+		mapper.setParam(this, value);
 	}
 
 	public boolean isPresent(Mapper mapper) {
-		return mapper.getParam(name) != null;
+		return mapper.getParam(this) != null;
 	}
 
-	public boolean isPresent(Map map) {
-		return map.containsKey(name);
+	public boolean isPresent(MappingParamSet map) {
+		return map.isPresent(this);
 	}
 
 
@@ -178,8 +186,8 @@
 		}
 	}
 
-	public void setValue(Map map, Object value) {
-		map.put(name, value);
+	public void setValue(MappingParamSet map, Object value) {
+	    map.set(this, value);
 	}
 
 	public String toString() {

Added: trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -0,0 +1,50 @@
+/*
+ * Created on Sep 14, 2012
+ */
+package org.griphyn.vdl.mapping;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MappingParamSet {
+    private Map<String, Object> params;
+    
+    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 Object get(MappingParam p) {
+        return params.get(p.getName());
+    }
+
+    public boolean isPresent(MappingParam p) {
+        return params.containsKey(p.getName());
+    }
+
+    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;        
+            }
+        }
+        return null;
+    }
+
+    public Collection<String> names() {
+        return params.keySet();
+    }
+}

Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -33,7 +33,7 @@
     
 	private boolean initialized = false;
 	private Mapper mapper;
-	private Map<String, Object> params;
+	private MappingParamSet params;
 	private AbstractDataNode waitingMapperParam;
 
 	/**
@@ -43,7 +43,7 @@
 		super(Field.Factory.createField(null, type), null, null);
 	}
 
-	public void init(Map<String, Object> params) {
+	public void init(MappingParamSet params) {
 		this.params = params;
 		if (this.params == null) {
 			initialized();
@@ -57,16 +57,14 @@
 		if (logger.isDebugEnabled()) {
 		    logger.debug("innerInit: " + this);
 		}
+	    
+		waitingMapperParam = params.getFirstOpenParamValue();
+        if (waitingMapperParam != null) {
+            waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
+            return;
+        }
 	    
-	    for (Map.Entry<String, Object> entry : params.entrySet()) {
-			Object v = entry.getValue();
-			if (v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
-				waitingMapperParam = (AbstractDataNode) v;
-				waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
-				return;
-			}
-		}
-		String desc = (String) params.get("descriptor");
+		String desc = (String) params.get(MappingParam.SWIFT_DESCRIPTOR);
 		if (desc == null) {
 			initialized();
 			return;
@@ -99,11 +97,11 @@
 	    innerInit();
     }
 
-	public String getParam(String name) {
+	public String getParam(MappingParam p) {
 		if (params == null) {
 			return null;
 		}
-		return (String) params.get(name);
+		return (String) params.get(p);
 	}
 
 	public DSHandle getRoot() {

Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -32,11 +32,11 @@
 
 public class RootDataNode extends AbstractDataNode implements FutureListener {
 
-    static Logger logger = Logger.getLogger(RootDataNode.class); 
+    static Logger logger = Logger.getLogger(RootDataNode.class);
     
 	private boolean initialized=false;
 	private Mapper mapper;
-	private Map<String, Object> params;
+	private MappingParamSet params;
 	private AbstractDataNode waitingMapperParam;
 
 	public RootDataNode(Type type) {
@@ -49,7 +49,7 @@
 	    setValue(value);
 	}
 
-	public void init(Map<String,Object> params) {
+	public void init(MappingParamSet params) {
 		this.params = params;
 		if(this.params == null) { 
 			initialized();
@@ -61,17 +61,13 @@
 	/** must have this.params set to the appropriate parameters before
 	    being called. */
 	private synchronized void innerInit() {
-	    for (Object v : params.values()) {
-			if(v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
-			    if (logger.isDebugEnabled()) {
-			        logger.debug("addListener: " + this + " " + v);
-			    }
-			    waitingMapperParam = (AbstractDataNode) v;
-                waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
-				return;
-			}
-		}
-		String desc = (String) params.get("descriptor");
+	    waitingMapperParam = params.getFirstOpenParamValue();
+	    if (waitingMapperParam != null) {
+            waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
+            return;
+	    }
+	    
+		String desc = (String) params.get(MappingParam.SWIFT_DESCRIPTOR);
 		if (desc == null) {
 			initialized();
 			return;
@@ -111,23 +107,10 @@
 	}
 
 
-	static protected void checkInputs(Map<String, Object> params, Mapper mapper, AbstractDataNode root) {
-		String input = (String) params.get("input");
+	static protected void checkInputs(MappingParamSet params, Mapper mapper, AbstractDataNode root) {
+		String input = (String) params.get(MappingParam.SWIFT_INPUT);
 		if (input != null && Boolean.valueOf(input.trim()).booleanValue()) {
-		    for (Path p : mapper.existing()) {
-				try {
-					DSHandle field = root.getField(p);
-					field.closeShallow();
-					if (logger.isInfoEnabled()) {
-						logger.info("Found data " + root + "." + p);
-					}
-				}
-				catch (InvalidPathException e) {
-				    throw new IllegalStateException("Structure of mapped data is " +
-				    		"incompatible with the mapped variable type: " + e.getMessage());
-				}
-			}
-		    root.closeDeep();
+			addExisting(mapper, root);
 			checkConsistency(root);
 		}
 		else if (mapper.isStatic()) {
@@ -164,7 +147,24 @@
 		}
 	}
 
-	public static void checkConsistency(DSHandle handle) {
+	private static void addExisting(Mapper mapper, AbstractDataNode root) {
+		for (Path p : mapper.existing()) {
+            try {
+                DSHandle field = root.getField(p);
+                field.closeShallow();
+                if (logger.isInfoEnabled()) {
+                    logger.info("Found data " + root + "." + p);
+                }
+            }
+            catch (InvalidPathException e) {
+                throw new IllegalStateException("Structure of mapped data is " +
+                        "incompatible with the mapped variable type: " + e.getMessage());
+            }
+        }
+        root.closeDeep();
+    }
+
+    public static void checkConsistency(DSHandle handle) {
 		if (handle.getType().isArray()) {
 			// any number of indices is ok
 			try {
@@ -197,11 +197,11 @@
 		}
 	}
 
-	public String getParam(String name) {
+	public String getParam(MappingParam p) {
 		if (params == null) {
 			return null;
 		}
-		return (String) params.get(name);
+		return (String) params.get(p);
 	}
 
 	public DSHandle getRoot() {

Modified: trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -25,7 +25,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.util.Base64;
@@ -34,6 +33,7 @@
 import org.griphyn.vdl.mapping.AbstractMapper;
 import org.griphyn.vdl.mapping.InvalidMappingParameterException;
 import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
 
@@ -99,7 +99,7 @@
 		this.elementMapper = elementMapper;
 	}
 
-	public void setParams(Map<String,Object> params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		if (PARAM_SUFFIX.isPresent(this)) {
 			String suffix = PARAM_SUFFIX.getStringValue(this);
@@ -136,7 +136,7 @@
 		Iterator<Path.Entry> pi = path.iterator();
 		int level = 0, tokenCount = path.size();
 		while (pi.hasNext()) {
-			Path.Entry nextPathElement = (Path.Entry) pi.next();
+			Path.Entry nextPathElement = pi.next();
 			if (nextPathElement.isIndex()) {
 			    Comparable<?> key = nextPathElement.getKey();
 			    String f, token;
@@ -262,7 +262,7 @@
 	}
 
 	private String getVarName() {
-        AbstractDataNode var = (AbstractDataNode) getParam("handle");
+        AbstractDataNode var = (AbstractDataNode) getParam(MappingParam.SWIFT_HANDLE);
         return var == null ? "" : var.getDisplayableName();
     }
 

Modified: trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,29 +17,30 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.GeneralizedFileFormat;
+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.type.Types;
 
-import org.griphyn.vdl.mapping.AbsFile;
-import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.GeneralizedFileFormat;
-import org.griphyn.vdl.mapping.InvalidMappingParameterException;
-import org.griphyn.vdl.mapping.Mapper;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-import org.griphyn.vdl.type.Types;
-
 public class CSVMapper extends AbstractMapper {
 	public static final MappingParam PARAM_FILE = new MappingParam("file");
 
@@ -68,7 +69,7 @@
 	/** whether the CSV file has been read already. */
 	private boolean read = false;
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		if (!PARAM_FILE.isPresent(this)) {
 			throw new InvalidMappingParameterException("CSV mapper must have a file parameter.");

Modified: trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -41,7 +41,7 @@
 		super(new ConcurrentElementMapper());
 	}
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		String prefix = PARAM_PREFIX.getStringValue(params);
 		prefix = "_concurrent/" + (prefix == null ? "" : prefix + "-") + 
 		    PARAM_THREAD_PREFIX.getValue(params);

Modified: trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/ExternalMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,26 +17,27 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractMapper;
+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.apache.log4j.Logger;
-import org.griphyn.vdl.mapping.AbsFile;
-import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-
 public class ExternalMapper extends AbstractMapper {
 	public static final Logger logger = Logger.getLogger(ExternalMapper.class);
 
@@ -44,36 +45,22 @@
 	private Map<String, Path> rmap;
 
 	public static final MappingParam PARAM_EXEC = new MappingParam("exec");
-	public static final MappingParam PARAM_BASEDIR = new MappingParam("#basedir", null);
 
-	private static Set<String> ignored;
-
-	static {
-		ignored = new HashSet<String>();
-		ignored.add("exec");
-		ignored.add("input");
-		ignored.add("dbgname");
-		ignored.add("descriptor");
-		ignored.add("#basedir");
-		ignored.add("waitfor");
-		ignored.add("swift#restartid");
-	}
-
 	private static final String[] STRING_ARRAY = new String[0];
 
-	public void setParams(Map<String, Object> params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		map = new HashMap<Path, AbsFile>();
 		rmap = new HashMap<String, Path>();
 		String exec = PARAM_EXEC.getStringValue(this);
-		String bdir = PARAM_BASEDIR.getStringValue(this);
+		String bdir = MappingParam.SWIFT_BASEDIR.getStringValue(this);
 		if (bdir != null && !exec.startsWith("/")) {
 			exec = bdir + File.separator + exec;
 		}
 		List<String> cmd = new ArrayList<String>();
 		cmd.add(exec);
-		for (String name : params.keySet()) {
-			if (!ignored.contains(name)) {
+		for (String name : params.names()) {
+			if (!name.contains("#") && !name.equals("exec")) {
 				MappingParam tp = new MappingParam(name);
 				cmd.add('-' + name);
 				cmd.add(tp.getStringValue(this));
@@ -81,12 +68,12 @@
 		}
 		try {
 		    if (logger.isDebugEnabled()) {
-		        logger.debug("invoking external mapper for " + getParam("dbgname") + ": " + cmd);
+		        logger.debug("invoking external mapper for " + getParam(MappingParam.SWIFT_DBGNAME) + ": " + 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("dbgname") + " output: " + lines);
+			    logger.debug("external mapper for " + getParam(MappingParam.SWIFT_DBGNAME) + " output: " + lines);
 			}
 			int ec = p.waitFor();
 			if (ec != 0) {

Modified: trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/FixedArrayFileMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -20,13 +20,13 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 import java.util.StringTokenizer;
 
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
 import org.griphyn.vdl.mapping.InvalidMappingParameterException;
 import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
 
@@ -40,7 +40,7 @@
 		super();
 	}
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		String cfiles = PARAM_FILES.getStringValue(this);
 		if (cfiles == null) {

Modified: trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,21 +17,22 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.DSHandle;
+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.AbsFile;
-import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.MappingParam;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-
 public class RegularExpressionMapper extends AbstractMapper {
 	public static final MappingParam PARAM_SOURCE = new MappingParam("source");
 	public static final MappingParam PARAM_MATCH = new MappingParam("match");
@@ -40,18 +41,18 @@
 	public RegularExpressionMapper() {
 	}
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		if (!PARAM_MATCH.isPresent(this)) {
 			throw new RuntimeException("Missing parameter match!");
 		}
 	}
 
-	public Collection existing() {
+	public Collection<Path> existing() {
 		if (exists(Path.EMPTY_PATH))
 			return Arrays.asList(new Path[] { Path.EMPTY_PATH });
 		else {
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 	}
 
@@ -97,11 +98,13 @@
 
 	public static void main(String[] args) {
 		RegularExpressionMapper reMapper = new RegularExpressionMapper();
-		Map params = new HashMap();
+		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("source", "2mass-j1223.fits");
 		params.put("match", "(.*)\\.(.*)");
-		params.put("transform", "\\1_area.\\2");
-		reMapper.setParams(params);
+		params.put("transform", "\\1_area.\\2");
+		MappingParamSet mps = new MappingParamSet();
+		mps.setAll(params);
+		reMapper.setParams(mps);
 		System.out.println(reMapper.map(Path.EMPTY_PATH));
 	}
 }

Modified: trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -20,9 +20,8 @@
  */
 package org.griphyn.vdl.mapping.file;
 
-import java.util.Map;
-
 import org.griphyn.vdl.mapping.MappingParam;
+import org.griphyn.vdl.mapping.MappingParamSet;
 
 public class SimpleFileMapper extends AbstractFileMapper {
 	public static final MappingParam PARAM_PADDING = new MappingParam("padding", new Integer(4));
@@ -31,7 +30,7 @@
 		super();
 	}
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		int precision = PARAM_PADDING.getIntValue(this);
 		setElementMapper(new DefaultFileNameElementMapper(precision));

Modified: trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2012-09-15 08:49:25 UTC (rev 5926)
+++ trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2012-09-15 08:59:46 UTC (rev 5927)
@@ -17,24 +17,23 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.log4j.Logger;
+import org.griphyn.vdl.mapping.AbsFile;
+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;
 
-import org.apache.log4j.Logger;
-
-import org.griphyn.vdl.mapping.AbsFile;
-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.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-
 public class StructuredRegularExpressionMapper extends AbstractFileMapper {
 
         public static final Logger logger =
@@ -47,32 +46,32 @@
 	public StructuredRegularExpressionMapper() {
 	}
 
-	public void setParams(Map params) {
+	public void setParams(MappingParamSet params) {
 		super.setParams(params);
 		if (!PARAM_MATCH.isPresent(this)) {
 			throw new RuntimeException("Missing parameter match!");
 		}
 	}
 
-	public Collection existing() {
+	public Collection<Path> existing() {
 
 		DSHandle sourceHandle = (DSHandle) PARAM_SOURCE.getRawValue(this);
 
-		Collection output = new ArrayList();
-		Collection sourceFields;
+		Collection<Path> output = new ArrayList<Path>();
+		Collection<DSHandle> sourceFields;
 		try {
 			sourceFields = sourceHandle.getFields(Path.CHILDREN);
 		}
 		catch (InvalidPathException ipe) {
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 		catch (HandleOpenException hoe) {
 			throw new RuntimeException(
 					"Handle open. Throwing this exception may not be the right thing to do. TODO");
 		}
-		Iterator i = sourceFields.iterator();
+		Iterator<DSHandle> i = sourceFields.iterator();
 		while (i.hasNext()) {
-			DSHandle f = (DSHandle) i.next();
+			DSHandle f = i.next();
 			output.add(f.getPathFromRoot());
 		}
 




More information about the Swift-commit mailing list