public class ScriptedDecideRule extends DecideRule implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
appCtx |
protected String |
engineName
engine name; default "beanshell"
|
protected boolean |
isolateThreads
Whether each ToeThread should get its own independent script
engine, or they should share synchronized access to one
engine.
|
protected org.archive.io.ReadSource |
scriptSource |
protected ScriptEngine |
sharedEngine |
protected ThreadLocal<ScriptEngine> |
threadEngine |
comment, kp
Constructor and Description |
---|
ScriptedDecideRule() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected ScriptEngine |
getEngine()
Get the proper ScriptEngine instance -- either shared or local
to this thread.
|
String |
getEngineName() |
boolean |
getIsolateThreads() |
org.archive.io.ReadSource |
getScriptSource() |
DecideResult |
innerDecide(CrawlURI uri) |
protected ScriptEngine |
newEngine()
Create a new ScriptEngine instance, preloaded with any supplied
source file and the variables 'self' (this ScriptedDecideRule)
and 'context' (the ApplicationContext).
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setEngineName(String name) |
void |
setIsolateThreads(boolean isolateThreads) |
void |
setScriptSource(org.archive.io.ReadSource scriptSource) |
accepts, decisionFor, getComment, getEnabled, getKeyedProperties, onlyDecision, setComment, setEnabled
protected String engineName
protected org.archive.io.ReadSource scriptSource
protected boolean isolateThreads
protected org.springframework.context.ApplicationContext appCtx
protected transient ThreadLocal<ScriptEngine> threadEngine
protected transient ScriptEngine sharedEngine
public String getEngineName()
public void setEngineName(String name)
public org.archive.io.ReadSource getScriptSource()
public void setScriptSource(org.archive.io.ReadSource scriptSource)
public boolean getIsolateThreads()
public void setIsolateThreads(boolean isolateThreads)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public DecideResult innerDecide(CrawlURI uri)
innerDecide
in class DecideRule
protected ScriptEngine getEngine()
protected ScriptEngine newEngine()
Copyright © 2003-2014 Internet Archive. All Rights Reserved.