[Swift-commit] r4672 - trunk/src/org/griphyn/vdl/karajan/lib
wozniak at ci.uchicago.edu
wozniak at ci.uchicago.edu
Thu Jun 23 16:18:03 CDT 2011
Author: wozniak
Date: 2011-06-23 16:18:03 -0500 (Thu, 23 Jun 2011)
New Revision: 4672
Modified:
trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
Log:
Better logging for structured data
Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2011-06-23 18:49:19 UTC (rev 4671)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2011-06-23 21:18:03 UTC (rev 4672)
@@ -3,6 +3,9 @@
*/
package org.griphyn.vdl.karajan.lib;
+import java.util.Iterator;
+import java.util.Map;
+
import org.apache.log4j.Logger;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
@@ -66,7 +69,8 @@
}
}
- private void log(DSHandle leaf, DSHandle value) {
+ @SuppressWarnings("unchecked")
+ private void log(DSHandle leaf, DSHandle value) {
if (logger.isDebugEnabled()) {
logger.debug("Setting " + leaf + " to " + value);
}
@@ -78,11 +82,33 @@
if (p.equals("$"))
p = "";
String name = data.getDisplayableName() + p;
- logger.info("Set: " + name + "=" + value.getValue());
+ Object v = value.getValue();
+ if (! (v instanceof Map))
+ logger.info("Set: " + name + "=" + v);
+ else
+ logger.info("Set: " + name + "=" +
+ unpackHandles((Map<String, DSHandle>) v));
}
}
}
+ String unpackHandles(Map<String,DSHandle> handles) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ Iterator<Map.Entry<String,DSHandle>> it =
+ handles.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<String,DSHandle> entry = it.next();
+ sb.append(entry.getKey());
+ sb.append('=');
+ sb.append(entry.getValue().getValue());
+ if (it.hasNext())
+ sb.append(", ");
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+
/** make dest look like source - if its a simple value, copy that
and if its an array then recursively copy */
void deepCopy(DSHandle dest, DSHandle source, VariableStack stack) throws ExecutionException {
More information about the Swift-commit
mailing list