incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1161802 - in /incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine: VariableConfiguration.java VariableConfigurationNode.java
Date Thu, 25 Aug 2011 23:52:36 GMT
Author: kwright
Date: Thu Aug 25 23:52:36 2011
New Revision: 1161802

URL: http://svn.apache.org/viewvc?rev=1161802&view=rev
Log:
Change the script form of configuration and configurationnode objects to be parseable.  This
will permit people to just type them in rather than assemble them via operations.

Modified:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java?rev=1161802&r1=1161801&r2=1161802&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
Thu Aug 25 23:52:36 2011
@@ -49,7 +49,18 @@ public class VariableConfiguration exten
   /** Get a string from this */
   public String toString()
   {
-    return configuration.toString();
+    StringBuilder sb = new StringBuilder();
+    sb.append("{ ");
+    int i = 0;
+    while (i < configuration.getChildCount())
+    {
+      if (i > 0)
+        sb.append(", ");
+      ConfigurationNode child = configuration.findChild(i++);
+      sb.append(new VariableConfigurationNode(child).toString());
+    }
+    sb.append(" }");
+    return sb.toString();
   }
   
   /** Get the variable's value as a Configuration object */

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java?rev=1161802&r1=1161801&r2=1161802&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
Thu Aug 25 23:52:36 2011
@@ -20,6 +20,7 @@
 package org.apache.manifoldcf.scriptengine;
 
 import org.apache.manifoldcf.core.interfaces.*;
+import java.util.*;
 
 /** Variable wrapper for ConfigurationNode object.
 */
@@ -40,7 +41,41 @@ public class VariableConfigurationNode e
   /** Get the variable's value as a string */
   public String toString()
   {
-    return configurationNode.toString();
+    StringBuilder sb = new StringBuilder();
+    sb.append("< ");
+    sb.append(new VariableString(configurationNode.getType()).toString());
+    sb.append(" : ");
+    String valueField = configurationNode.getValue();
+    if (valueField == null)
+      sb.append("null");
+    else
+      sb.append(new VariableString(valueField).toString());
+    sb.append(" : ");
+    boolean needComma = false;
+    Iterator<String> iter = configurationNode.getAttributes();
+    while (iter.hasNext())
+    {
+      String attrName = iter.next();
+      String value = configurationNode.getAttributeValue(attrName);
+      if (needComma)
+        sb.append(", ");
+      else
+        needComma = true;
+      sb.append(new VariableString(attrName).toString());
+      sb.append("=");
+      sb.append(new VariableString(value).toString());
+    }
+    sb.append(" : ");
+    int i = 0;
+    while (i < configurationNode.getChildCount())
+    {
+      ConfigurationNode child = configurationNode.findChild(i++);
+      if (i > 0)
+        sb.append(", ");
+      sb.append(new VariableConfigurationNode(child).toString());
+    }
+    sb.append(" >");
+    return sb.toString();
   }
 
   /** Convert to a value */



Mime
View raw message