Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Provides source builders who need to add javascript to the enrichment process with a single global set of variables and functions that can be used in the individual "scriptlets" other elements provide. The scripts provided (and same for the inputs) are executed once per source per harvest cycle.

Table of Contents

Format

TOD convert to JSON

Code Block
languagejava
{
	"display": string, 
	"globals": {
} // see GlobalScriptPojo below
}
//////////////////////////////////
	public static class GlobalScriptPojo {
		public List<String> imports; 	"imports":string,// An optional list of URLs that get imported before the scripts below are run
		public List<String> scripts;"scripts":string, // A list of (java)script code blocks that are evaluated in order (normally only need to specify one)
		public String scriptlang;"scriptlang":string, // Currently only "javascript" is supported
	}

...

Info

JavaScript functions imported via either of the two means described above are passed to the Rhino script engine via the ScriptEngine.eval method which allows the functions to be called within the scope of the current document being harvested. Examples of imported functions can be found below.

Note: the "script" context does not have access to any of the objects described below (like "_doc"), it can only be used for declaring functions to be used in the entity/association/docGeo scriptlets.

...

Gliffy
nameRhino Script Engine

Examples

Field Level Transformations

...