Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.crawler.deciderules
Class BeanShellDecideRule

    java.lang.Object
      javax.management.Attribute
          org.archive.crawler.settings.Type
              org.archive.crawler.settings.ComplexType
                  org.archive.crawler.settings.ModuleType
                      org.archive.crawler.deciderules.DecideRule
                          org.archive.crawler.deciderules.BeanShellDecideRule

All Implemented Interfaces:
  java.io.Serializable, javax.management.DynamicMBean

    public class BeanShellDecideRule

extends DecideRule

Rule which runs a groovy script to make its decision. Script source may be provided via a file local to the crawler. Variables available to the script include 'object' (the object to be evaluated, typically a CandidateURI or CrawlURI), 'self' (this GroovyDecideRule instance), and 'controller' (the crawl's CrawlController instance). TODO: reduce copy & paste with GroovyProcessor

Author:
  gojomo
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.archive.crawler.settings.ComplexType
`ComplexType.MBeanAttributeInfoIterator`

Field Summary
`static java.lang.String` | `ATTR_ISOLATE_THREADS` whether each thread should have its own script runner (true), or they should share a single script runner with synchronized access
`static java.lang.String` | `ATTR_SCRIPT_FILE` setting for script file
`protected boolean` | `initialized`
`protected bsh.Interpreter` | `sharedInterpreter`
`java.util.Map<java.lang.Object,java.lang.Object>` | `sharedMap`
`protected java.lang.ThreadLocal<bsh.Interpreter>` | `threadInterpreter`

Fields inherited from class org.archive.crawler.deciderules.DecideRule
`ACCEPT, PASS, REJECT`

Fields inherited from class org.archive.crawler.settings.ComplexType
`definition, definitionMap`

Constructor Summary
`BeanShellDecideRule(java.lang.String name)`

Method Summary
`java.lang.Object` | `decisionFor(java.lang.Object object)` Make decision on passed `object`.
`protected bsh.Interpreter` | `getInterpreter()` Get the proper Interpreter instance -- either shared or local to this thread.
`void` | `kickUpdate()` Setup (or reset) Intepreter variables, as appropraite based on thread-isolation setting.
`protected bsh.Interpreter` | `newInterpreter()` Create a new Interpreter instance, preloaded with any supplied source file and the variables 'self' (this BeanShellProcessor) and 'controller' (the CrawlController).

Methods inherited from class org.archive.crawler.deciderules.DecideRule
`getController, singlePossibleNonPassDecision`

Methods inherited from class org.archive.crawler.settings.ModuleType
`addElement, listUsedFiles`

Methods inherited from class org.archive.crawler.settings.ComplexType
`addElementToDefinition, checkValue, earlyInitialize, getAbsoluteName, getAttribute, getAttribute, getAttribute, getAttributeInfo, getAttributeInfo, getAttributeInfoIterator, getAttributes, getDataContainerRecursive, getDataContainerRecursive, getDefaultValue, getDescription, getElementFromDefinition, getLegalValues, getLocalAttribute, getMBeanInfo, getMBeanInfo, getParent, getPreservedFields, getSettingsHandler, getUncheckedAttribute, getValue, globalSettings, invoke, isInitialized, isOverridden, iterator, removeElementFromDefinition, setAsOrder, setAttribute, setAttribute, setAttributes, setDescription, setPreservedFields, toString, unsetAttribute`

Methods inherited from class org.archive.crawler.settings.Type
`addConstraint, equals, getConstraints, getLegalValueType, isExpertSetting, isOverrideable, isTransient, setExpertSetting, setLegalValueType, setOverrideable, setTransient`

Methods inherited from class javax.management.Attribute
`getName`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ATTR_SCRIPT_FILE

    public static final java.lang.String ATTR_SCRIPT_FILE

  setting for script file

  See Also:
    Constant Field Values

### ATTR_ISOLATE_THREADS

    public static final java.lang.String ATTR_ISOLATE_THREADS

  whether each thread should have its own script runner (true), or they should share a single script runner with synchronized access

  See Also:
    Constant Field Values

### threadInterpreter

    protected java.lang.ThreadLocal<bsh.Interpreter> threadInterpreter

### sharedInterpreter

    protected bsh.Interpreter sharedInterpreter

### sharedMap

    public java.util.Map<java.lang.Object,java.lang.Object> sharedMap

### initialized

    protected boolean initialized

Constructor Detail

### BeanShellDecideRule

    public BeanShellDecideRule(java.lang.String name)

Method Detail

### decisionFor

    public java.lang.Object decisionFor(java.lang.Object object)

  Description copied from class: `DecideRule`
  Make decision on passed `object`.

  Overrides:
    `decisionFor` in class `DecideRule`
  Parameters:
    `object` - Object to rule on.
  Returns:
    `DecideRule.ACCEPT`, `DecideRule.REJECT`, or `DecideRule.PASS`.

### getInterpreter

    protected bsh.Interpreter getInterpreter()

  Get the proper Interpreter instance -- either shared or local to this thread.

  Returns:
    Interpreter to use

### newInterpreter

    protected bsh.Interpreter newInterpreter()

  Create a new Interpreter instance, preloaded with any supplied source file and the variables 'self' (this BeanShellProcessor) and 'controller' (the CrawlController).

  Returns:
    the new Interpreter instance

### kickUpdate

    public void kickUpdate()

  Setup (or reset) Intepreter variables, as appropraite based on thread-isolation setting.

  Overrides:
    `kickUpdate` in class `DecideRule`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.