Scripting Jobs: Difference between revisions

From Obsidian Scheduler
Jump to navigationJump to search
No edit summary
No edit summary
Line 8: Line 8:
* com.carfey.ops.job.script.BeanShellJob executing a [http://www.beanshell.org/ BeanShell] script.
* com.carfey.ops.job.script.BeanShellJob executing a [http://www.beanshell.org/ BeanShell] script.
* com.carfey.ops.job.script.ReflectiveJob is a convenience GroovyJob that does not require a script, using defined parameters to construct an object and invoke method(s), both supporting argument(s)
* com.carfey.ops.job.script.ReflectiveJob is a convenience GroovyJob that does not require a script, using defined parameters to construct an object and invoke method(s), both supporting argument(s)
* <strike>com.carfey.ops.job.script.[[#SpringBeanJob|SpringBeanJob]] is a convenience GroovyJob that does not require a script, using defined parameters to obtain the bean and invoke the method(s).</strike> Deprecated as of Obsidian 2.2.0. Use [[Implementing_Jobs#Dependency_Injection_via_Spring|Dependency Injection]] instead.
* <strike>com.carfey.ops.job.script.[[#SpringBeanJob|SpringBeanJob]]</strike> is a convenience GroovyJob that does not require a script, using defined parameters to obtain the bean and invoke the method(s). Deprecated as of Obsidian 2.2.0. Use [[Implementing_Jobs#Dependency_Injection_via_Spring|Dependency Injection]] instead.


= Parameters =
= Parameters =

Revision as of 03:29, 7 November 2013

Obsidian provides support for execution of scripted jobs in various languages. None of these require any Java code to be written. The script to execute is set via a script job parameter.

The following job classes can be configured with executable scripts in their target languages:

  • com.carfey.ops.job.script.JavaScriptJob running Rhino
  • com.carfey.ops.job.script.PythonJob running Jython
  • com.carfey.ops.job.script.GroovyJob Groovy
  • com.carfey.ops.job.script.BeanShellJob executing a BeanShell script.
  • com.carfey.ops.job.script.ReflectiveJob is a convenience GroovyJob that does not require a script, using defined parameters to construct an object and invoke method(s), both supporting argument(s)
  • com.carfey.ops.job.script.SpringBeanJob is a convenience GroovyJob that does not require a script, using defined parameters to obtain the bean and invoke the method(s). Deprecated as of Obsidian 2.2.0. Use Dependency Injection instead.

Parameters

Any parameters configured for the job will be set as global-variables within the script. If a single value is configured for a parameter, it will be set as its direct type. If multiple values are set for a parameter, it will be passed into the script as a list of values.

Job Context

The job context variable is accessed through the global variable named "jobContext". This can be used to save output parameters, etc. See Job Results and Parameterization.

Sample Jobs

Groovy:


Python:


Javascript:

SpringBeanJob

Deprecated as of Obsidian 2.2.0. Use Dependency Injection instead. A SpringBeanJob is simply a convenience GroovyJob with a predefined script that uses some specified parameters to find a Spring Bean and invoke specified method(s). Specify any optional class imports (class names only), the single line of code to retrieve the Spring Bean reference and the method name(s) to invoke.