Package org.webharvest.runtime
Class ScraperContext
- java.lang.Object
-
- org.webharvest.runtime.ScraperContext
-
- All Implemented Interfaces:
Iterable<KeyValuePair<Variable>>
,DynamicScopeContext
public class ScraperContext extends Object implements DynamicScopeContext
Context of scraper execution. All the variables created during scraper execution are stored in this context.
-
-
Constructor Summary
Constructors Constructor Description ScraperContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFunctionDef(FunctionDef funcDef)
Deprecated.boolean
containsVar(String name)
<R> R
executeWithinNewContext(Callable<R> callable)
String
getCharset()
Returns default configuration's charset.Config
getConfig()
FunctionDef
getFunctionDef(String name)
Deprecated.ScriptingLanguage
getScriptingLanguage()
Deprecated.Variable
getVar(String name)
void
initContext()
Iterator<KeyValuePair<Variable>>
iterator()
Variable
replaceExistingVar(String name, Variable variable)
void
setCharset(String charset)
Sets default configuration's charset.void
setConfig(Config config)
Deprecated.void
setLocalVar(String name, Object value)
void
setLocalVar(String name, Variable variable)
void
setLocalVar(Map<String,Object> map)
void
setScriptingLanguage(ScriptingLanguage language)
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
initContext
@PostConstruct public void initContext()
-
setLocalVar
public void setLocalVar(String name, Object value)
- Specified by:
setLocalVar
in interfaceDynamicScopeContext
-
setLocalVar
public void setLocalVar(String name, Variable variable)
- Specified by:
setLocalVar
in interfaceDynamicScopeContext
-
replaceExistingVar
public Variable replaceExistingVar(String name, Variable variable)
- Specified by:
replaceExistingVar
in interfaceDynamicScopeContext
-
getVar
public Variable getVar(String name)
- Specified by:
getVar
in interfaceDynamicScopeContext
-
containsVar
public boolean containsVar(String name)
- Specified by:
containsVar
in interfaceDynamicScopeContext
-
iterator
public Iterator<KeyValuePair<Variable>> iterator()
- Specified by:
iterator
in interfaceIterable<KeyValuePair<Variable>>
-
executeWithinNewContext
public <R> R executeWithinNewContext(Callable<R> callable) throws InterruptedException
- Specified by:
executeWithinNewContext
in interfaceDynamicScopeContext
- Throws:
InterruptedException
-
setLocalVar
public void setLocalVar(Map<String,Object> map)
- Specified by:
setLocalVar
in interfaceDynamicScopeContext
-
getFunctionDef
@Deprecated public FunctionDef getFunctionDef(String name)
Deprecated.- Specified by:
getFunctionDef
in interfaceDynamicScopeContext
-
addFunctionDef
@Deprecated public void addFunctionDef(FunctionDef funcDef)
Deprecated.- Specified by:
addFunctionDef
in interfaceDynamicScopeContext
-
getScriptingLanguage
@Deprecated public ScriptingLanguage getScriptingLanguage()
Deprecated.- Specified by:
getScriptingLanguage
in interfaceDynamicScopeContext
-
setScriptingLanguage
@Deprecated public void setScriptingLanguage(ScriptingLanguage language)
Deprecated.- Specified by:
setScriptingLanguage
in interfaceDynamicScopeContext
-
getCharset
public String getCharset()
Returns default configuration's charset.- Specified by:
getCharset
in interfaceDynamicScopeContext
- Returns:
- default configuration's charset.
-
setCharset
public void setCharset(String charset)
Sets default configuration's charset.- Specified by:
setCharset
in interfaceDynamicScopeContext
- Parameters:
charset
- new default configuration's charset
-
getConfig
public Config getConfig()
- Specified by:
getConfig
in interfaceDynamicScopeContext
-
setConfig
@Deprecated public void setConfig(Config config)
Deprecated.- Specified by:
setConfig
in interfaceDynamicScopeContext
-
-