Table of Contents |
---|
Groovy scripting is available for quickly creating new pipeline modules without having to write Java Code and create a Jar for the component. Groovy scripts can do many things that a regular Java pipeline stage can do.
Anything Big or Complex - Because size and complexity can result in more opportunity for errors, it is recommended to code in Java where it is possible to do more careful unit testing with a Java based JUnit test bench.
Groovy is a Java-based scripting language which compiles directly into Java byte code. It's advantages are that it runs very fast in the Java JVM and it has full access to all Java objects, classes, and methods.
Some useful Groovy Scripting links:
Your Groovy script will automatically have a number of variables predefined before the script is called. These variables can be used directly from your script (no special setup or imports or anything required).
Variable | When Available | Description |
---|---|---|
job | always | Java Type = Job References the job which is being procesed. You can use this variable to create new sub-jobs, check on job status, wait for sub-jobs, etc. |
doc | always | Java Type = AspireObject The AspireObject which holds all of the metadata for the current document being processed. This is the same as job.get() - the job's data object. |
component | always | Java Type = StageImpl which is derived from ComponentImpl This variable provides access to the component itself. This can be used for a variety of useful tasks, such as logging, accessing other components, getting Aspire Home, and turning relative paths to Aspire Home into absolute paths. Note that StageImpl extends ComponentImpl, where all of the most useful methods are located. This variable refers to the Workflow section which is running the rule, this sections can be: AfterScanWorkflow, AddUpdateWorkflow, PublishWorkflow, DeleteWorkflow or ErrorWorkflow |
globals | always | Java Type = HashMap This variable contains global variables you can pass between rules if required. |
rule | always | Java Type = Rule This variable reference the rule that is being executed. |