[Swift-commit] r3191 - in trunk/src/org/griphyn/vdl/mapping: . file
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Wed Nov 11 18:44:21 CST 2009
Author: hategan
Date: 2009-11-11 18:44:21 -0600 (Wed, 11 Nov 2009)
New Revision: 3191
Modified:
trunk/src/org/griphyn/vdl/mapping/MappingParam.java
trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
Log:
the prefix is not set yet on this mapper, so it cannot be accessed like that
Modified: trunk/src/org/griphyn/vdl/mapping/MappingParam.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParam.java 2009-11-06 17:14:44 UTC (rev 3190)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParam.java 2009-11-12 00:44:21 UTC (rev 3191)
@@ -59,8 +59,30 @@
return value;
}
}
+
+ public Object getValue(Map params) {
+ Object value = params.get(name);
+ if (value instanceof DSHandle) {
+ DSHandle handle = (DSHandle) value;
+ checkHandle(handle);
+ return handle.toString();
+ }
+ else if (value == null) {
+ if (!defSet) {
+ throw new InvalidMappingParameterException("Missing required mapping parameter: "
+ + name);
+ }
+ else {
+ return defValue;
+ }
+ }
+ else {
+ return value;
+ }
+ }
+
+
-
/** return the raw value of this parameter. Defaulting and type
* conversion will not occur. */
public Object getRawValue(Mapper mapper) {
@@ -85,6 +107,13 @@
return null;
return String.valueOf(value);
}
+
+ public String getStringValue(Map params) {
+ Object value = getValue(params);
+ if (value == null)
+ return null;
+ return String.valueOf(value);
+ }
public void setValue(Mapper mapper, Object value) {
mapper.setParam(name, value);
@@ -135,10 +164,6 @@
}
}
- public Object getValue(Map map) {
- return map.get(name);
- }
-
public void setValue(Map map, Object value) {
map.put(name, value);
}
Modified: trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java 2009-11-06 17:14:44 UTC (rev 3190)
+++ trunk/src/org/griphyn/vdl/mapping/file/ConcurrentMapper.java 2009-11-12 00:44:21 UTC (rev 3191)
@@ -23,7 +23,7 @@
}
public void setParams(Map params) {
- String prefix = PARAM_PREFIX.getStringValue(this);
+ String prefix = PARAM_PREFIX.getStringValue(params);
prefix = "_concurrent/" + (prefix == null ? "" : prefix + "-") +
PARAM_THREAD_PREFIX.getValue(params);
PARAM_PREFIX.setValue(params, prefix);
@@ -66,5 +66,4 @@
}
remappedPaths.put(path, file);
}
-}
-
+}
\ No newline at end of file
More information about the Swift-commit
mailing list