incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1161792 - in /incubator/lcf/trunk: ./ framework/ framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/
Date Thu, 25 Aug 2011 23:07:00 GMT
Author: kwright
Date: Thu Aug 25 23:06:59 2011
New Revision: 1161792

URL: http://svn.apache.org/viewvc?rev=1161792&view=rev
Log:
Fix build issues, also distinguish between 'displayable' form and 'value' form.

Modified:
    incubator/lcf/trunk/build.xml
    incubator/lcf/trunk/framework/build.xml
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableArray.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
    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
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConnectionName.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableURL.java

Modified: incubator/lcf/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/build.xml?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/build.xml (original)
+++ incubator/lcf/trunk/build.xml Thu Aug 25 23:06:59 2011
@@ -2247,7 +2247,7 @@ Use Apache Forrest version forrest-0.9-d
     <target name="run-script-interpreter" depends="deliver-framework">
         <java classname="org.apache.manifoldcf.scriptengine.ScriptParser" fork="true"
dir="dist/script-engine" maxmemory="128M">
           <classpath>
-            <fileset dir="dist/script-engine/lib">
+            <fileset dir="dist/script-engine/jar">
               <include name="*.jar"/>
             </fileset>
           </classpath>

Modified: incubator/lcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/build.xml?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/build.xml (original)
+++ incubator/lcf/trunk/framework/build.xml Thu Aug 25 23:06:59 2011
@@ -598,7 +598,7 @@
     <target name="run-script-interpreter" depends="script-engine">
         <java classname="org.apache.manifoldcf.scriptengine.ScriptParser" fork="true"
dir="dist/script-engine" maxmemory="128M">
           <classpath>
-            <fileset dir="dist/script-engine/lib">
+            <fileset dir="dist/script-engine/jar">
               <include name="*.jar"/>
             </fileset>
           </classpath>

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
Thu Aug 25 23:06:59 2011
@@ -709,6 +709,26 @@ public class ScriptParser
       currentStream.skip();
       return rval;
     }
+    else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("["))
+    {
+      currentStream.skip();
+      VariableArray va = new VariableArray();
+      while (true)
+      {
+        VariableReference vr = evaluateExpression(currentStream);
+        if (vr == null)
+          syntaxError(currentStream,"Missing expression in array initializer");
+        va.insert(vr.resolve());
+        t = currentStream.peek();
+        if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("]"))
+          break;
+        if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals(","))
+          syntaxError(currentStream,"Missing ','");
+        currentStream.skip();
+      }
+      currentStream.skip();
+      return va;
+    }
     return parseVariableReference_2(currentStream);
   }
   

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
Thu Aug 25 23:06:59 2011
@@ -36,6 +36,8 @@ public interface Variable
   public static String ATTRIBUTE_FLOAT = "__float__";
   /** Conversion to boolean */
   public static String ATTRIBUTE_BOOLEAN = "__boolean__";
+  /** Script value */
+  public static String ATTRIBUTE_SCRIPT = "__script__";
   /** Name attribute */
   public static String ATTRIBUTE_NAME = "__name__";
   /** Value attribute */

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableArray.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableArray.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableArray.java
Thu Aug 25 23:06:59 2011
@@ -32,9 +32,8 @@ public class VariableArray extends Varia
   {
   }
 
-  /** Get a string from this */
-  public String getStringValue()
-    throws ScriptException
+  /** Get a displayable string from this */
+  public String toString()
   {
     StringBuilder sb = new StringBuilder("[ ");
     int i = 0;
@@ -46,7 +45,7 @@ public class VariableArray extends Varia
       if (v == null)
         sb.append("null");
       else
-        sb.append(v.getStringValue());
+        sb.append(v.toString());
     }
     sb.append(" ]");
     return sb.toString();

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
Thu Aug 25 23:06:59 2011
@@ -184,6 +184,8 @@ public class VariableBase implements Var
       return new VariableFloat(getDoubleValue());
     else if (attributeName.equals(ATTRIBUTE_BOOLEAN))
       return new VariableBoolean(getBooleanValue());
+    else if (attributeName.equals(ATTRIBUTE_SCRIPT))
+      return new VariableString(toString());
     else
       throw new ScriptException("Variable has no attribute called '"+attributeName+"'");
   }

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
Thu Aug 25 23:06:59 2011
@@ -30,6 +30,14 @@ public class VariableBoolean extends Var
     this.value = value;
   }
 
+  /** Get a displayable string for the value */
+  public String toString()
+  {
+    if (value)
+      return "true";
+    return "false";
+  }
+
   /** Get the variable's value as a boolean */
   public boolean getBooleanValue()
     throws ScriptException

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=1161792&r1=1161791&r2=1161792&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:06:59 2011
@@ -47,8 +47,7 @@ public class VariableConfiguration exten
   }
   
   /** Get a string from this */
-  public String getStringValue()
-    throws ScriptException
+  public String toString()
   {
     return configuration.toString();
   }

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=1161792&r1=1161791&r2=1161792&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:06:59 2011
@@ -38,12 +38,20 @@ public class VariableConfigurationNode e
   }
   
   /** Get the variable's value as a string */
-  public String getStringValue()
-    throws ScriptException
+  public String toString()
   {
     return configurationNode.toString();
   }
 
+  /** Convert to a value */
+  public String getStringValue()
+    throws ScriptException
+  {
+    if (configurationNode.getValue() == null)
+      return super.getStringValue();
+    return configurationNode.getValue();
+  }
+  
   /** Get the variable's value as a ConfigurationNode object */
   public ConfigurationNode getConfigurationNodeValue()
     throws ScriptException

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConnectionName.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConnectionName.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConnectionName.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConnectionName.java
Thu Aug 25 23:06:59 2011
@@ -27,12 +27,30 @@ package org.apache.manifoldcf.scriptengi
 public class VariableConnectionName extends VariableBase
 {
   protected String encodedConnectionName;
+  protected String connectionName;
   
   public VariableConnectionName(String connectionName)
   {
+    this.connectionName = connectionName;
     this.encodedConnectionName = encode(connectionName);
   }
   
+  public String toString()
+  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("(new connectionname \"");
+    int i = 0;
+    while (i < connectionName.length())
+    {
+      char x = connectionName.charAt(i++);
+      if (x == '\\' || x == '\"')
+        sb.append('\\');
+      sb.append(x);
+    }
+    sb.append("\")");
+    return sb.toString();
+  }
+  
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
Thu Aug 25 23:06:59 2011
@@ -30,6 +30,12 @@ public class VariableFloat extends Varia
     this.value = value;
   }
   
+  /** Get a displayable string for the value */
+  public String toString()
+  {
+    return new Double(value).toString();
+  }
+  
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
Thu Aug 25 23:06:59 2011
@@ -29,7 +29,13 @@ public class VariableInt extends Variabl
   {
     this.value = value;
   }
-  
+
+  /** Get a displayable string for the value */
+  public String toString()
+  {
+    return Integer.toString(value);
+  }
+
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
Thu Aug 25 23:06:59 2011
@@ -35,10 +35,9 @@ public class VariableResult extends Vari
   }
   
   /** Get the variable's value as a string */
-  public String getStringValue()
-    throws ScriptException
+  public String toString()
   {
-    return "("+Integer.toString(resultCode)+") "+result.getStringValue();
+    return "("+Integer.toString(resultCode)+") "+result.toString();
   }
 
   /** Get the variable's value as an integer */

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
Thu Aug 25 23:06:59 2011
@@ -29,7 +29,24 @@ public class VariableString extends Vari
   {
     this.value = value;
   }
-  
+
+  /** Get a displayable string for the value */
+  public String toString()
+  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("\"");
+    int i = 0;
+    while (i < value.length())
+    {
+      char x = value.charAt(i++);
+      if (x == '\\' || x == '\"')
+        sb.append('\\');
+      sb.append(x);
+    }
+    sb.append("\"");
+    return sb.toString();
+  }
+
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableURL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableURL.java?rev=1161792&r1=1161791&r2=1161792&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableURL.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableURL.java
Thu Aug 25 23:06:59 2011
@@ -36,6 +36,22 @@ public class VariableURL extends Variabl
       this.encodedURL = this.encodedURL.substring(0,this.encodedURL.length()-1);
   }
   
+  public String toString()
+  {
+    StringBuilder sb = new StringBuilder();
+    sb.append("\"");
+    int i = 0;
+    while (i < encodedURL.length())
+    {
+      char x = encodedURL.charAt(i++);
+      if (x == '\\' || x == '\"')
+        sb.append('\\');
+      sb.append(x);
+    }
+    sb.append("\"");
+    return sb.toString();
+  }
+  
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException



Mime
View raw message