incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1160781 - in /incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine: NewConfiguration.java NewConfigurationNode.java ScriptParser.java VariableConfiguration.java VariableResult.java
Date Tue, 23 Aug 2011 16:34:47 GMT
Author: kwright
Date: Tue Aug 23 16:34:46 2011
New Revision: 1160781

URL: http://svn.apache.org/viewvc?rev=1160781&view=rev
Log:
Add ability to create configuration and configurationnode objects

Added:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfiguration.java
  (with props)
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfigurationNode.java
  (with props)
Modified:
    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/VariableConfiguration.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfiguration.java?rev=1160781&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfiguration.java
(added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfiguration.java
Tue Aug 23 16:34:46 2011
@@ -0,0 +1,46 @@
+/* $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;
+
+/** Class defining the creation of a new VariableConfiguration object.
+*/
+public class NewConfiguration implements NewOperation
+{
+  /** Parse and execute.  Parsing begins right after the "new" keyword and the operation
name token.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  *@return the variable reference that got created.  Should never be null.
+  */
+  public VariableReference parseAndCreate(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    return new VariableConfiguration();
+  }
+  
+  /** Parse and skip.  Parsing begins right after the "new" keyword and the operation name
token.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  */
+  public void parseAndSkip(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+  }
+  
+}

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

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

Added: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfigurationNode.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfigurationNode.java?rev=1160781&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfigurationNode.java
(added)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NewConfigurationNode.java
Tue Aug 23 16:34:46 2011
@@ -0,0 +1,52 @@
+/* $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;
+
+/** Class defining the creation of a new VariableConfigurationNode object.
+*/
+public class NewConfigurationNode implements NewOperation
+{
+  /** Parse and execute.  Parsing begins right after the "new" keyword and the operation
name token.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  *@return the variable reference that got created.  Should never be null.
+  */
+  public VariableReference parseAndCreate(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    // The arguments should be the type of the node, as an expression.
+    VariableReference nodeType = sp.evaluateExpression(currentStream);
+    if (nodeType == null)
+      sp.syntaxError(currentStream,"Need node type expression");
+    String nodeTypeName = sp.resolveMustExist(currentStream,nodeType).getStringValue();
+    return new VariableConfigurationNode(nodeTypeName);
+  }
+  
+  /** Parse and skip.  Parsing begins right after the "new" keyword and the operation name
token.
+  *@param sp is the script parser to use to help in the parsing.
+  *@param currentStream is the current token stream.
+  */
+  public void parseAndSkip(ScriptParser sp, TokenStream currentStream)
+    throws ScriptException
+  {
+    sp.skipExpression(currentStream);
+  }
+  
+}

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

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

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=1160781&r1=1160780&r2=1160781&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 23 16:34:46 2011
@@ -903,6 +903,10 @@ public class ScriptParser
     sp.addCommand("POST", new POSTCommand());
     // MHL
     
+    // Add the new operations we need
+    sp.addNewOperation("configuration",new NewConfiguration());
+    sp.addNewOperation("configurationnode",new NewConfigurationNode());
+    
     try
     {
       Reader reader;

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=1160781&r1=1160780&r2=1160781&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
Tue Aug 23 16:34:46 2011
@@ -27,15 +27,15 @@ public class VariableConfiguration exten
 {
   protected Configuration configuration;
   
-  public VariableConfiguration(String type)
+  public VariableConfiguration()
   {
-    configuration = new Configuration(type);
+    configuration = new Configuration();
   }
   
-  public VariableConfiguration(String type, String json)
+  public VariableConfiguration(String json)
     throws ScriptException
   {
-    configuration = new Configuration(type);
+    configuration = new Configuration();
     try
     {
       configuration.fromJSON(json);

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=1160781&r1=1160780&r2=1160781&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
Tue Aug 23 16:34:46 2011
@@ -31,7 +31,7 @@ public class VariableResult extends Vari
     throws ScriptException
   {
     this.resultCode = resultCode;
-    this.result = new VariableConfiguration("result",json);
+    this.result = new VariableConfiguration(json);
   }
   
   /** Get the variable's value as a string */



Mime
View raw message