[Swift-commit] r7881 - trunk/src/org/griphyn/vdl/mapping/file

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu May 29 01:38:04 CDT 2014


Author: hategan
Date: 2014-05-29 01:38:03 -0500 (Thu, 29 May 2014)
New Revision: 7881

Modified:
   trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java
   trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java
Log:
fixed recursive globbing in the filesys mapper

Modified: trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2014-05-29 04:16:21 UTC (rev 7880)
+++ trunk/src/org/griphyn/vdl/mapping/file/AbstractFileMapper.java	2014-05-29 06:38:03 UTC (rev 7881)
@@ -240,7 +240,7 @@
 				if (logger.isDebugEnabled()) {
 				    logger.debug("Processing existing file " + file.getName());
 				}
-				Path p = rmap(cp, file.getName());
+				Path p = rmap(cp, file);
 				if (p != null) {
 					if (logger.isDebugEnabled()) {
 					    logger.debug("reverse-mapped to path " + p);
@@ -351,7 +351,8 @@
 	  * @param name the filename to map to a path
 	  * @return a Path to the supplied filename, null on failure
 	  */
-	public Path rmap(AbstractFileMapperParams cp, String name) {
+	protected Path rmap(AbstractFileMapperParams cp, AbsFile file) {
+	    String name = file.getName();
 		logger.debug("rmap "+name);
 
 		String prefix = cp.getPrefix();

Modified: trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2014-05-29 04:16:21 UTC (rev 7880)
+++ trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java	2014-05-29 06:38:03 UTC (rev 7881)
@@ -28,6 +28,7 @@
 
 import k.thr.LWThread;
 
+import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.Mapper;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
@@ -84,7 +85,7 @@
     }
 
 	@Override
-    public Path rmap(AbstractFileMapperParams cp, String name) {
+    protected Path rmap(AbstractFileMapperParams cp, AbsFile file) {
         throw new UnsupportedOperationException();
     }
 

Modified: trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java	2014-05-29 04:16:21 UTC (rev 7880)
+++ trunk/src/org/griphyn/vdl/mapping/file/FileSystemArrayMapper.java	2014-05-29 06:38:03 UTC (rev 7881)
@@ -28,7 +28,7 @@
 import org.griphyn.vdl.type.Type;
 
 public class FileSystemArrayMapper extends AbstractFileMapper {    
-    private Map<Object, String> filenames = new HashMap<Object, String>();
+    private Map<Comparable<?>, String> filenames = new HashMap<Comparable<?>, String>();
     private int count = 0;
 
     @Override
@@ -36,15 +36,15 @@
         return "FilesysMapper";
     }
 
-    @Override
-	public Path rmap(AbstractFileMapperParams cp, String name) {
-		if (name == null || name.equals("")) {
+    @Override
+	protected Path rmap(AbstractFileMapperParams cp, AbsFile file) {
+		if (file == null) {
+		    // This test is fishy
 			return null;
-		}
-		filenames.put(count, name);
+		}
 		Path p = Path.EMPTY_PATH;
-		p = p.addFirst(count, true);
-		++count;
+		p = p.addFirst(count++, true);
+		filenames.put(p.getFirst(), file.getPath());
 		return p;
 	}
 	
@@ -63,13 +63,6 @@
 		if (filename == null) {
 			return null;
 		}
-		if (location != null) {
-			if (!location.endsWith("/")) {
-				filename = location + '/' + filename;
-			} else {
-				filename = location + filename;
-			}
-		}
 		return new AbsFile(filename);
 	}
 

Modified: trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java	2014-05-29 04:16:21 UTC (rev 7880)
+++ trunk/src/org/griphyn/vdl/mapping/file/ROIMapper.java	2014-05-29 06:38:03 UTC (rev 7881)
@@ -17,14 +17,18 @@
 
 package org.griphyn.vdl.mapping.file;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.griphyn.vdl.mapping.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
 
+import org.apache.log4j.Logger;
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.Path;
+
 //TODO Is this still being used?
-public class ROIMapper extends AbstractFileMapper {
+public class ROIMapper extends AbstractFileMapper {
+    public static final Logger logger = Logger.getLogger(ROIMapper.class);
+    
 	private int count;
 	private Map<String, Integer> names;
 	
@@ -40,7 +44,8 @@
     }
 
     @Override
-	public Path rmap(AbstractFileMapperParams cp, String name) {
+	protected Path rmap(AbstractFileMapperParams cp, AbsFile file) {
+        String name = file.getName();
 		if (name.indexOf(".ROI") == -1) {
 			return null;
 		}
@@ -91,8 +96,10 @@
 			} else {
 				return null;
 			}
+		}
+		if (logger.isInfoEnabled()) {
+		    logger.info(name + " parsed into " + path);
 		}
-		System.out.println(name + " parsed into " + path);
 		return path;
 	}
 }




More information about the Swift-commit mailing list