You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/08/16 19:36:58 UTC

svn commit: r1158389 - /incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/

Author: kwright
Date: Tue Aug 16 17:36:58 2011
New Revision: 1158389

URL: http://svn.apache.org/viewvc?rev=1158389&view=rev
Log:
Add some variable types

Added:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java   (with props)
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java   (with props)
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java   (with props)
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java   (with props)
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java   (with props)
Modified:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Position.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptException.java
    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/Token.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.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/VariableReference.java

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Position.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Position.java?rev=1158389&r1=1158388&r2=1158389&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Position.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Position.java Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 /** This class tracks the position of a script execution, and allows
 * access to the characters in a nested file setup.
 */

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptException.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptException.java?rev=1158389&r1=1158388&r2=1158389&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptException.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptException.java Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 public class ScriptException extends Exception
 {
   public ScriptException(String msg)

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=1158389&r1=1158388&r2=1158389&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 Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 import java.util.*;
 
 /** Parse script and execute.
@@ -264,11 +266,11 @@ public class ScriptParser
 	currentStream.skip();
 	t = currentStream.peek();
 	if (t == null || t.getString() == null)
-	  syntaxError("Need property name");
+	  syntaxError("Need attribute name");
 	Variable v = vr.resolve();
 	if (v == null)
-	  syntaxError("Null reference");
-	vr = v.getProperty(t.getString());
+	  syntaxError("Null attribute reference");
+	vr = v.getAttribute(t.getString());
 	currentStream.skip();
       }
       else

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java?rev=1158389&r1=1158388&r2=1158389&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Token.java Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 public class Token
 {
   public static final int TOKEN_PUNCTUATION = 0;

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java?rev=1158389&r1=1158388&r2=1158389&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/TokenStream.java Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 /** Convert a script into a stream of tokens.
 */
 public class TokenStream

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=1158389&r1=1158388&r2=1158389&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 Tue Aug 16 17:36:58 2011
@@ -16,6 +16,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
+package org.apache.manifoldcf.scriptengine;
 
 /** This interface represents a variable within the ManifoldCF script engine.
 * A variable may have a value, and may have various named properties, as described below.
@@ -23,6 +24,19 @@
 */
 public interface Variable
 {
+  // Special attributes
+  
+  /** Name attribute */
+  public static String ATTRIBUTE_NAME = "__name__";
+  /** Size attribute */
+  public static String ATTRIBUTE_SIZE = "__size__";
+  /** OK status attribute */
+  public static String ATTRIBUTE_OKSTATUS = "__OK__";
+  /** NOTFOUND status attribute */
+  public static String ATTRIBUTE_NOTFOUNDSTATUS = "__NOTFOUND__";
+  /** CREATED status attribute */
+  public static String ATTRIBUTE_CREATED = "__CREATED__";
+  
   /** Get the variable's value as a string */
   public String getStringValue()
     throws ScriptException;
@@ -39,28 +53,13 @@ public interface Variable
   public double getDoubleValue()
     throws ScriptException;
   
-  /** Check whether this variable constitutes an "OK" status.
-  */
-  public boolean isOKStatus()
-    throws ScriptException;
-
-  /** Check whether this variable constitutes a "NOT FOUND" status.
-  */
-  public boolean isNOTFOUNDStatus()
-    throws ScriptException;
-
-  /** Check whether this variable constitutes a "CREATED" status.
-  */
-  public boolean isCREATEDStatus()
-    throws ScriptException;
+  // The following operations allow manipulation of a Configuration structure
 
-  // The following operation corresponds to the "." operation
-  
-  /** Get a named property of the variable */
-  public VariableReference getProperty(String propertyName)
+  /** Get a named attribute of the variable; e.g. xxx.yyy */
+  public VariableReference getAttribute(String attributeName)
     throws ScriptException;
   
-  // The following two operations correspond to xxx[index]
+  // The following two operations correspond to <xxx> and xxx[index]
   
   /** Get an indexed property of the variable */
   public VariableReference getIndexed(int index)

Added: 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=1158389&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java Tue Aug 16 17:36:58 2011
@@ -0,0 +1,77 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Base class for variables.
+* Basically, everything is illegal until overridden.
+*/
+public class VariableBase implements Variable
+{
+  public VariableBase()
+  {
+  }
+  
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot convert variable to string");
+  }
+  
+  /** Get the variable's value as a boolean */
+  public boolean getBooleanValue()
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot convert variable to boolean");
+  }
+  
+  /** Get the variable's value as an integer */
+  public int getIntValue()
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot convert variable to int");
+  }
+  
+  /** Get the variable's value as a double */
+  public double getDoubleValue()
+    throws ScriptException
+  {
+    throw new ScriptException("Cannot convert variable to float");
+  }
+  
+  // The following operations allow manipulation of a Configuration structure
+
+  /** Get a named attribute of the variable; e.g. xxx.yyy */
+  public VariableReference getAttribute(String attributeName)
+    throws ScriptException
+  {
+    throw new ScriptException("Variable has no attribute called '"+attributeName+"'");
+  }
+  
+  // The following two operations correspond to <xxx> and xxx[index]
+  
+  /** Get an indexed property of the variable */
+  public VariableReference getIndexed(int index)
+    throws ScriptException
+  {
+    throw new ScriptException("Variable has no member number "+Integer.toString(index));
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=1158389&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java Tue Aug 16 17:36:58 2011
@@ -0,0 +1,91 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+import org.apache.manifoldcf.core.interfaces.*;
+
+/** Variable wrapper for Configuration object.
+*/
+public class VariableConfiguration extends VariableBase
+{
+  protected Configuration configuration;
+  
+  public VariableConfiguration(String type)
+  {
+    configuration = new Configuration(type);
+  }
+  
+  public VariableConfiguration(String type, String json)
+    throws ScriptException
+  {
+    configuration = new Configuration(type);
+    try
+    {
+      configuration.fromJSON(json);
+    }
+    catch (ManifoldCFException e)
+    {
+      throw new ScriptException(e.getMessage(),e);
+    }
+  }
+  
+  /** Get a named attribute of the variable; e.g. xxx.yyy */
+  public VariableReference getAttribute(String attributeName)
+    throws ScriptException
+  {
+    // We recognize only the __size__ attribute
+    if (attributeName.equals(ATTRIBUTE_SIZE))
+      return new VariableReference(new VariableInt(configuration.getChildCount()));
+    return super.getAttribute(attributeName);
+  }
+  
+  /** Get an indexed property of the variable */
+  public VariableReference getIndexed(int index)
+    throws ScriptException
+  {
+    if (index < configuration.getChildCount())
+      return new NodeReference(index, new VariableConfigurationNode(configuration.findChild(index)));
+    return super.getIndexed(index);
+  }
+  
+  /** Extend VariableReference class so we capture attempts to set the reference, and actually overwrite the child when that is done */
+  protected class NodeReference extends VariableReference
+  {
+    protected int index;
+    
+    public NodeReference(int index, VariableConfigurationNode node)
+      throws ScriptException
+    {
+      super(node);
+      this.index = index;
+    }
+    
+    public void setReference(Variable v)
+      throws ScriptException
+    {
+      if (!(v instanceof VariableConfigurationNode))
+        throw new ScriptException("Cannot set child value to anything other than a ConfigurationNode object");
+      super.setReference(v);
+      configuration.removeChild(index);
+      configuration.addChild(index,((VariableConfigurationNode)v).getConfigurationNode());
+    }
+    
+  }
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=1158389&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java Tue Aug 16 17:36:58 2011
@@ -0,0 +1,92 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+import org.apache.manifoldcf.core.interfaces.*;
+
+/** Variable wrapper for ConfigurationNode object.
+*/
+public class VariableConfigurationNode extends VariableBase
+{
+  protected ConfigurationNode configurationNode;
+  
+  public VariableConfigurationNode(String name)
+  {
+    configurationNode = new ConfigurationNode(name);
+  }
+  
+  public VariableConfigurationNode(ConfigurationNode node)
+  {
+    configurationNode = node;
+  }
+  
+  /** Get a named attribute of the variable; e.g. xxx.yyy */
+  public VariableReference getAttribute(String attributeName)
+    throws ScriptException
+  {
+    // We recognize only the __size__ attribute
+    if (attributeName.equals(ATTRIBUTE_SIZE))
+      return new VariableReference(new VariableInt(configurationNode.getChildCount()));
+    // Look for named attribute
+    String attributeValue = configurationNode.getAttributeValue(attributeName);
+    // MHL to allow attribute to be modified
+    if (attributeValue != null)
+      return new VariableReference(new VariableString(attributeValue));
+    return super.getAttribute(attributeName);
+  }
+  
+  /** Get an indexed property of the variable */
+  public VariableReference getIndexed(int index)
+    throws ScriptException
+  {
+    if (index < configurationNode.getChildCount())
+      return new NodeReference(index, new VariableConfigurationNode(configurationNode.findChild(index)));
+    return super.getIndexed(index);
+  }
+  
+  public ConfigurationNode getConfigurationNode()
+  {
+    return configurationNode;
+  }
+  
+  /** Extend VariableReference class so we capture attempts to set the reference, and actually overwrite the child when that is done */
+  protected class NodeReference extends VariableReference
+  {
+    protected int index;
+    
+    public NodeReference(int index, VariableConfigurationNode node)
+      throws ScriptException
+    {
+      super(node);
+      this.index = index;
+    }
+    
+    public void setReference(Variable v)
+      throws ScriptException
+    {
+      if (!(v instanceof VariableConfigurationNode))
+        throw new ScriptException("Cannot set child value to anything other than a ConfigurationNode object");
+      super.setReference(v);
+      configurationNode.removeChild(index);
+      configurationNode.addChild(index,((VariableConfigurationNode)v).getConfigurationNode());
+    }
+    
+  }
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=1158389&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java Tue Aug 16 17:36:58 2011
@@ -0,0 +1,54 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Variable class representing an integer.
+*/
+public class VariableInt extends VariableBase
+{
+  protected int value;
+  
+  public VariableInt(int value)
+  {
+    this.value = value;
+  }
+  
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return Integer.toString(value);
+  }
+
+  /** Get the variable's value as an integer */
+  public int getIntValue()
+    throws ScriptException
+  {
+    return value;
+  }
+  
+  /** Get the variable's value as a double */
+  public double getDoubleValue()
+    throws ScriptException
+  {
+    return (double)value;
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java?rev=1158389&r1=1158388&r2=1158389&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java (original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableReference.java Tue Aug 16 17:36:58 2011
@@ -17,6 +17,8 @@
 * limitations under the License.
 */
 
+package org.apache.manifoldcf.scriptengine;
+
 /** This class is a mutable reference to a variable.
 * It exists as a separate class so that the reference to the underlying
 * variable can be easily modified.  The reference can, of course, be null.
@@ -31,11 +33,13 @@ public class VariableReference
   }
   
   public VariableReference(Variable object)
+    throws ScriptException
   {
     reference = object;
   }
   
   public void setReference(Variable object)
+    throws ScriptException
   {
     reference = object;
   }

Added: 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=1158389&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java (added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java Tue Aug 16 17:36:58 2011
@@ -0,0 +1,61 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.manifoldcf.scriptengine;
+
+/** Variable class representing an integer.
+*/
+public class VariableString extends VariableBase
+{
+  protected String value;
+  
+  public VariableString(String value)
+  {
+    this.value = value;
+  }
+  
+  /** Get the variable's value as a string */
+  public String getStringValue()
+    throws ScriptException
+  {
+    return value;
+  }
+
+  /** Get the variable's value as an integer */
+  public int getIntValue()
+    throws ScriptException
+  {
+    try
+    {
+      return Integer.parseInt(value);
+    }
+    catch (NumberFormatException e)
+    {
+      throw new ScriptException(e.getMessage(),e);
+    }
+  }
+  
+  /** Get the variable's value as a double */
+  public double getDoubleValue()
+    throws ScriptException
+  {
+    return new Double(value).doubleValue();
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
------------------------------------------------------------------------------
    svn:keywords = Id