[Swift-commit] r7320 - in trunk/src/org/griphyn/vdl/mapping: . file
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Mon Nov 25 00:08:56 CST 2013
Author: hategan
Date: 2013-11-25 00:08:56 -0600 (Mon, 25 Nov 2013)
New Revision: 7320
Modified:
trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java
trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params
trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java
Log:
fixed ArrayFileMapper.params (bug 1151)
Modified: trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java 2013-11-25 06:06:06 UTC (rev 7319)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java 2013-11-25 06:08:56 UTC (rev 7320)
@@ -61,6 +61,13 @@
public Object unwrap(Object value) {
if (value instanceof AbstractDataNode) {
AbstractDataNode handle = (AbstractDataNode) value;
+ /*
+ * TODO The semantics here (and in the mapper initialization process)
+ * are broken. If an array is passed, the code in RootHandle.innerInit
+ * only waits for the array, but not for each of the elements in the
+ * array, while at the same time mappers expect all elements of the
+ * array to be closed (e.g. ArrayFileMapper.map(): assert(dn.isClosed()))
+ */
if (!handle.isPrimitive()) {
throw new IllegalArgumentException("Cannot unwrap non-primitive data");
}
Modified: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java 2013-11-25 06:06:06 UTC (rev 7319)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.java 2013-11-25 06:08:56 UTC (rev 7320)
@@ -36,7 +36,7 @@
public Collection<Path> existing() {
ArrayFileMapperParams cp = getParams();
List<Path> l = new ArrayList<Path>();
- DSHandle dn = (DSHandle) cp.getFiles();
+ DSHandle dn = cp.getFiles();
Map<?, DSHandle> m = dn.getArrayValue();
Set<?> s = m.keySet();
Iterator<?> i = s.iterator();
@@ -58,7 +58,7 @@
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) cp.getFiles();
+ DSHandle dn = cp.getFiles();
assert(dn.isClosed());
logger.debug("dn: " + dn);
Modified: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params 2013-11-25 06:06:06 UTC (rev 7319)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapper.params 2013-11-25 06:08:56 UTC (rev 7320)
@@ -1 +1,2 @@
-Object files
\ No newline at end of file
+ at import org.griphyn.vdl.mapping.DSHandle
+DSHandle files
\ No newline at end of file
Modified: trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java 2013-11-25 06:06:06 UTC (rev 7319)
+++ trunk/src/org/griphyn/vdl/mapping/file/ArrayFileMapperParams.java 2013-11-25 06:08:56 UTC (rev 7320)
@@ -5,6 +5,7 @@
import java.util.List;
import org.griphyn.vdl.mapping.AbstractDataNode;
import org.griphyn.vdl.mapping.MappingParamSet;
+import org.griphyn.vdl.mapping.DSHandle;
public class ArrayFileMapperParams extends MappingParamSet {
@@ -18,12 +19,12 @@
return NAMES;
}
- public void setFiles(Object files) {
+ public void setFiles(DSHandle files) {
this.files = files;
}
- public Object getFiles() {
- return files;
+ public DSHandle getFiles() {
+ return (DSHandle) files;
}
@Override
@@ -58,7 +59,6 @@
if (files == null) {
throw new IllegalArgumentException("Missing required argument 'files'");
}
- files = unwrap(files);
super.unwrapPrimitives();
}
More information about the Swift-commit
mailing list