Package org.webharvest.runtime

Examples of org.webharvest.runtime.ScraperContext


     * Returns variable from scraper context
     * @param varName Name of the variable
     */
    public Variable getVar(String varName) {
        CallProcessor runningFunction = scraper.getRunningFunction();
        ScraperContext activeContext =
                runningFunction == null ? scraper.getContext() : runningFunction.getFunctionContext();
        return activeContext.getVar(varName);
    }
View Full Code Here


     * @param varName
     * @param varValue
     * @param overwrite
     */
    public void defineVariable(String varName, Object varValue, boolean overwrite) {
        ScraperContext context = scraper.getContext();
        if (overwrite || context.get(varName) == null) {
            Variable var = CommonUtil.createVariable(varValue);
            context.put(varName, var);
        }
    }
View Full Code Here

    private Variable functionResult = new NodeVariable("");

    public CallProcessor(CallDef callDef, ScraperConfiguration configuration, Scraper scraper) {
        super(callDef);
        CallProcessor runningFunction = scraper.getRunningFunction();
        ScraperContext callerContext =
                runningFunction == null ? scraper.getContext() : runningFunction.getFunctionContext();
        this.functionContext = new ScraperContext(scraper, callerContext);
        this.scriptEngine = configuration.createScriptEngine(functionContext);
        this.callDef = callDef;
    }
View Full Code Here

*/
public class SetContextVar {

    public static void invoke(Interpreter interpreter, CallStack callstack, String name, Object value) {
        try {
            ScraperContext context = (ScraperContext) interpreter.get(ScriptEngine.CONTEXT_VARIABLE_NAME);
            if (context != null) {
                context.setVar(name, value);
            }
        } catch (EvalError e) {
            throw new ScriptException("Cannot get web-Harvest context from interpreter: " + e.getMessage(), e);
        }
   }
View Full Code Here

TOP

Related Classes of org.webharvest.runtime.ScraperContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.