com.clickntap.tool.script.VelocityScriptEngine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Stripecube Show documentation
Show all versions of Stripecube Show documentation
Stripecube is an open source Java framework for Web Applications
package com.clickntap.tool.script;
import com.clickntap.tool.types.AbstractComponent;
import com.clickntap.tool.types.NotYetImplemented;
import java.io.OutputStream;
import java.util.Map;
public class VelocityScriptEngine extends AbstractComponent implements ScriptEngine {
public String eval(Map ctx, String templateName) throws Exception {
throw new NotYetImplemented();
}
public void eval(Map ctx, String templateName, OutputStream out) throws Exception {
throw new NotYetImplemented();
}
public boolean evalRule(Map context, String templateName) throws Exception {
throw new NotYetImplemented();
}
public boolean evalRuleScript(Map context, String rule) throws Exception {
throw new NotYetImplemented();
}
public String evalScript(Map ctx, String script) throws Exception {
throw new NotYetImplemented();
}
public void evalScript(Map ctx, String script, OutputStream out) throws Exception {
throw new NotYetImplemented();
}
public void start() throws Exception {
throw new NotYetImplemented();
}
/*
* private static final String SCRIPT_LOG_TAG = "script"; private VelocityEngine engine; private String scriptPath;
*
* public String eval(Map ctx, String templateName) throws Exception { StringWriter writer = new StringWriter(); engine.mergeTemplate(scriptPath + templateName, new ScriptContext(ctx), writer); return writer.toString(); }
*
* public void eval(Map ctx, String templateName, OutputStream out) throws Exception { OutputStreamWriter writer = new OutputStreamWriter(out); engine.mergeTemplate(scriptPath + templateName, new ScriptContext(ctx), writer); }
*
* public boolean evalRule(Map context, String templateName) throws Exception { throw new NotYetImplemented(); }
*
* public boolean evalRuleScript(Map context, String rule) throws Exception { throw new NotYetImplemented(); }
*
* public String evalScript(Map ctx, String script) throws Exception { StringWriter writer = new StringWriter(); Velocity.evaluate(new ScriptContext(ctx), writer, SCRIPT_LOG_TAG, script); return writer.toString(); }
*
* public void evalScript(Map ctx, String script, OutputStream out) throws Exception { OutputStreamWriter writer = new OutputStreamWriter(out); Velocity.evaluate(new ScriptContext(ctx), writer, SCRIPT_LOG_TAG, script); }
*
* public void start() throws Exception { if (getConfResource() != null) { Properties properties = new Properties(); properties.load(getConfResource().getInputStream()); engine = new VelocityEngine(properties); } else { engine = new VelocityEngine(); } if (scriptPath == null) scriptPath = ConstUtils.EMPTY; }
*
* public class ScriptContext extends VelocityContext { public ScriptContext(Map ctx) { super(ctx); } }
*
* public void setScriptPath(String scriptPath) throws IOException { this.scriptPath = scriptPath; }
*/
}