Author: dishara
Date: Mon Jun 11 15:11:41 2012
New Revision: 1348892
URL: http://svn.apache.org/viewvc?rev=1348892&view=rev
Log:
Added Velocity Script class and implement Context interface in VelocityBindings
class
Added:
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityCompiledScript.java
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/VelocityInvocable.java
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.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=1348892&r1=1348891&r2=1348892&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
Mon Jun 11 15:11:41 2012
@@ -19,57 +19,77 @@ package org.apache.velocity.script;
* under the License.
*/
+import org.apache.velocity.context.Context;
+
import javax.script.Bindings;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
-public class VelocityBindings implements Bindings {
+public class VelocityBindings implements Bindings,Context {
+
+
public Object put(String s, Object o) {
+ return null;
+ }
+
+ /**
+ * Inherits from Context
+ * @param key The name of the desired value.
+ * @return
+ */
+ public Object get(String key) {
return null; //To change body of implemented methods use File |
Settings | File Templates.
}
+ /**
+ * inherits from Context
+ */
+ public Object[] getKeys() {
+ return new Object[0]; //To change body of implemented methods use
File | Settings | File Templates.
+ }
+
public void putAll(Map<? extends String, ? extends Object> map) {
- //To change body of implemented methods use File | Settings | File
Templates.
+
}
public void clear() {
- //To change body of implemented methods use File | Settings | File
Templates.
+
}
public Set<String> keySet() {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public Collection<Object> values() {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public Set<Entry<String, Object>> entrySet() {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public int size() {
- return 0; //To change body of implemented methods use File | Settings
| File Templates.
+ return 0;
}
public boolean isEmpty() {
- return false; //To change body of implemented methods use File |
Settings | File Templates.
+ return false;
}
public boolean containsKey(Object o) {
- return false; //To change body of implemented methods use File |
Settings | File Templates.
+ return false;
}
public boolean containsValue(Object o) {
- return false; //To change body of implemented methods use File |
Settings | File Templates.
+ return false;
}
public Object get(Object o) {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public Object remove(Object o) {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
}
Added:
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityCompiledScript.java
URL:
http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityCompiledScript.java?rev=1348892&view=auto
==============================================================================
---
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityCompiledScript.java
(added)
+++
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityCompiledScript.java
Mon Jun 11 15:11:41 2012
@@ -0,0 +1,45 @@
+package org.apache.velocity.script;
+
+import javax.script.CompiledScript;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+/*
+* 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.
+*/
+public class VelocityCompiledScript extends CompiledScript {
+
+ private ScriptEngine scriptEngine;
+
+ public VelocityCompiledScript(ScriptEngine scriptEngine) {
+ this.scriptEngine = scriptEngine;
+ }
+
+ @Override
+ public Object eval(ScriptContext context) throws ScriptException {
+// scriptEngine.eval();
+ return null;
+ }
+
+ @Override
+ public ScriptEngine getEngine() {
+ return scriptEngine;
+ }
+
+}
Modified:
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityInvocable.java
URL:
http://svn.apache.org/viewvc/velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityInvocable.java?rev=1348892&r1=1348891&r2=1348892&view=diff
==============================================================================
---
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityInvocable.java
(original)
+++
velocity/sandbox/jsr223/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityInvocable.java
Mon Jun 11 15:11:41 2012
@@ -23,19 +23,20 @@ import javax.script.Invocable;
import javax.script.ScriptException;
public class VelocityInvocable implements Invocable {
+
public Object invokeMethod(Object o, String s, Object... objects) throws
ScriptException, NoSuchMethodException {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public Object invokeFunction(String s, Object... objects) throws
ScriptException, NoSuchMethodException {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public <T> T getInterface(Class<T> tClass) {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
public <T> T getInterface(Object o, Class<T> tClass) {
- return null; //To change body of implemented methods use File |
Settings | File Templates.
+ return null;
}
}
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=1348892&r1=1348891&r2=1348892&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
Mon Jun 11 15:11:41 2012
@@ -19,6 +19,7 @@ package org.apache.velocity.script;
* under the License.
*/
+import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import javax.script.*;
@@ -122,7 +123,6 @@ public class VelocityScriptEngine implem
}
public Object eval(String s, ScriptContext scriptContext) throws
ScriptException {
-
return null; //To change body of implemented methods use File |
Settings | File Templates.
}