[Swift-commit] r2437 - trunk/src/org/griphyn/vdl/karajan/functions

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Sun Jan 11 06:32:59 CST 2009


Author: benc
Date: 2009-01-11 06:32:58 -0600 (Sun, 11 Jan 2009)
New Revision: 2437

Modified:
   trunk/src/org/griphyn/vdl/karajan/functions/ConfigProperty.java
Log:
ConfigProperty function can now be given a BoundContact, and will take properties from that host in preference to other config mechanisms. In future commits, this will allow more settings to be made per-site.

Modified: trunk/src/org/griphyn/vdl/karajan/functions/ConfigProperty.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/functions/ConfigProperty.java	2009-01-11 11:39:04 UTC (rev 2436)
+++ trunk/src/org/griphyn/vdl/karajan/functions/ConfigProperty.java	2009-01-11 12:32:58 UTC (rev 2437)
@@ -11,21 +11,41 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction;
 import org.griphyn.vdl.util.VDL2Config;
+import org.globus.cog.karajan.util.BoundContact;
+import org.apache.log4j.Logger;
 
 public class ConfigProperty extends AbstractFunction {
     public static final Arg NAME = new Arg.Positional("name");
     public static final Arg INSTANCE = new Arg.Optional("instance", Boolean.TRUE);
+    public static final Arg HOST = new Arg.Optional("host",null);
 
     static {
-        setArguments(ConfigProperty.class, new Arg[] { NAME, INSTANCE });
+        setArguments(ConfigProperty.class, new Arg[] { NAME, INSTANCE, HOST });
     }
 
     public static final String INSTANCE_CONFIG_FILE = "vdl:instanceconfigfile";
     public static final String INSTANCE_CONFIG = "vdl:instanceconfig";
 
+    public static final Logger logger = Logger.getLogger(ConfigProperty.class);
+
     public Object function(VariableStack stack) throws ExecutionException {
         String name = TypeUtil.toString(NAME.getValue(stack));
         boolean instance = TypeUtil.toBoolean(INSTANCE.getValue(stack));
+        Object host = HOST.getValue(stack);
+        if(logger.isDebugEnabled()) {
+		logger.debug("Getting property "+name+" with host "+host);
+	}
+	if(host!= null) {
+		// see if the host has this property defined, and if so
+		// get its value
+		BoundContact h = (BoundContact)host;
+		String prop = (String) h.getProperty(name);
+		if(prop != null) {
+			logger.debug("Found property "+name+" in BoundContact");
+			return prop;
+		}
+			logger.debug("Could not find property "+name+" in BoundContact");
+	}
         return getProperty(name, instance, stack);
     }
 




More information about the Swift-commit mailing list