velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dish...@apache.org
Subject svn commit: r1373905 - in /velocity/sandbox/jsr223/velocity-engine-scripting/src: main/java/org/apache/velocity/script/ test/java/org/apache/velocity/script/test/
Date Thu, 16 Aug 2012 16:19:58 GMT
Author: dishara
Date: Thu Aug 16 16:19:57 2012
New Revision: 1373905

URL: http://svn.apache.org/viewvc?rev=1373905&view=rev
Log:
Adding javadoc comments to classes

Modified:
    velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityBindings.java
    velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptContext.java
    velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java
    velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
    velocity/sandbox/jsr223/velocity-engine-scripting/src/test/java/org/apache/velocity/script/test/ScriptEngineTest.java

Modified: velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityBindings.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityBindings.java?rev=1373905&r1=1373904&r2=1373905&view=diff
==============================================================================
--- velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityBindings.java
(original)
+++ velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityBindings.java
Thu Aug 16 16:19:57 2012
@@ -28,6 +28,12 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+/**
+ * A mapping of key/value pairs, all of whose keys are Strings.
+ * There are two fundamental ways to instantiate this.
+ * 1. By providing a pre enriched map as initial values which will override the default VelocityBindings
values.
+ * 2. Default constructor which will adheres to the default setting with an starting empty
map.
+ */
 public class VelocityBindings implements Bindings,Context {
 
   /**

Modified: velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptContext.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptContext.java?rev=1373905&r1=1373904&r2=1373905&view=diff
==============================================================================
--- velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptContext.java
(original)
+++ velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptContext.java
Thu Aug 16 16:19:57 2012
@@ -31,6 +31,14 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+/**
+ * The class who used to connect Script Engines with objects, such as scoped Bindings, in
hosting applications. Each scope is a set of named
+ * attributes whose values can be set and retrieved using the VelocityScriptContext methods.
VelocityScriptContext also expose Readers and
+ * Writers that can be used by the VelocityScriptEngines for input and output.
+ *
+ * No additional params required to do instantiate this. Has only the default constructor.
+ */
+
 public class VelocityScriptContext implements ScriptContext {
 
     /**

Modified: velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java?rev=1373905&r1=1373904&r2=1373905&view=diff
==============================================================================
--- velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java
(original)
+++ velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java
Thu Aug 16 16:19:57 2012
@@ -31,6 +31,19 @@ import javax.script.*;
 import java.io.*;
 import java.util.Properties;
 
+/**
+ *  VelocityScriptEngine is the fundamental class whose methods inherited from .javax.script.ScriptEngine
interface
+ * These methods provide basic scripting functionality. This includes methods that execute
scripts, and ones that set and get values.
+ * The values are key/value pairs of two types.
+ * This Provides a standard implementation for several of the variants of the eval method.
+ *  eval(Reader)
+ * eval(String)
+ * eval(String, Bindings)
+ * eval(Reader, Bindings)
+ *
+ * There are two ways to instantiate VelocityScriptEngine. One is directly using the script
engine factory which was used to create this
+ * engine. Other one is by passing the factory and the pre defined bindings required for
the engine.
+ */
 public class VelocityScriptEngine implements ScriptEngine {
 
     /**

Modified: velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java?rev=1373905&r1=1373904&r2=1373905&view=diff
==============================================================================
--- velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
(original)
+++ velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
Thu Aug 16 16:19:57 2012
@@ -24,6 +24,14 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+/**
+ * VelocityScriptEngineFactory is used to describe and instantiate ScriptEngines.
+ * There are two fundamental ways to instantiate this.
+ *
+ *   1. Create a factory by providing only name and version and allows to inherit default
factory settings.
+ *   2. Create a factory by providing all required attributes i.e  List<String> names,
List<String> extensions
+ *       List<String> mimeTypes , String name,String version, String langName, String
langVersion
+ */
 public class VelocityScriptEngineFactory implements ScriptEngineFactory {
 
     /**

Modified: velocity/sandbox/jsr223/velocity-engine-scripting/src/test/java/org/apache/velocity/script/test/ScriptEngineTest.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/test/java/org/apache/velocity/script/test/ScriptEngineTest.java?rev=1373905&r1=1373904&r2=1373905&view=diff
==============================================================================
--- velocity/sandbox/jsr223/velocity-engine-scripting/src/test/java/org/apache/velocity/script/test/ScriptEngineTest.java
(original)
+++ velocity/sandbox/jsr223/velocity-engine-scripting/src/test/java/org/apache/velocity/script/test/ScriptEngineTest.java
Thu Aug 16 16:19:57 2012
@@ -23,6 +23,8 @@ import org.apache.velocity.script.Veloci
 import javax.script.Bindings;
 import javax.script.ScriptContext;
 import javax.script.ScriptException;
+import java.io.StringWriter;
+import java.io.Writer;
 
 public class ScriptEngineTest extends AbstractScriptTest {
 
@@ -68,6 +70,9 @@ public class ScriptEngineTest extends Ab
                 "src/test/java/org/apache/velocity/script/test/resources/velocity.properties";
         System.setProperty(VelocityScriptEngine.VELOCITY_PROPERTIES,  propertyFile) ;
         //Comment test case
+
+        Writer writer = new StringWriter();
+        engine.getContext().setWriter(writer);
         String script = "<html>\n" +
                 "<body>\n" +
                 "#set( $foo = \"Velocity\" )\n" +
@@ -77,7 +82,7 @@ public class ScriptEngineTest extends Ab
 //        String script = "## This is a comment ";
         Object result = engine.eval(script);
         assertTrue(Boolean.valueOf(result.toString()));
-
+        System.out.println(">>>"+writer);
         //TODO add more engine script evaluation test cases
 
     }



Mime
View raw message