Show TOC

Background documentationScripting Contexts and Implicit Objects Locate this document in the navigation structure

 

Scripting contexts are fields in which scripting, with Redwood Expression Language or RedwoodScript may be used. The implicit objects provided differ between the contexts.

This section lists the implicit objects by category, and what they contain.

Implicit object

Description

Class

parameters.name

values of parameters of current job

java.lang.String, java.lang.Number, java.util.Date, com.redwood.scheduler.api.date.DateTimeZone

outParameters.name

values of Out parameters of current job

java.lang.String, java.lang.Number, java.util.Date, com.redwood.scheduler.api.date.DateTimeZone

chainParameters.name

values of parameters of inner-most job chain

java.lang.String, java.lang.Number, java.util.Date, com.redwood.scheduler.api.date.DateTimeZone

chainOutParameters.name

values of out parameters of inner-most job chain

java.lang.String, java.lang.Number, java.util.Date, com.redwood.scheduler.api.date.DateTimeZone

JobChainParameters.getOutValueString(<jobName>, <parameter>)

The value of the out parameter of the job in chain (see placeholders below)

java.util.String

JobChainParameters.getOutValueNumber(jobName>, <parameter>)

The value of the out parameter of the job in chain (see placeholders below)

java.lang.Number

JobChainParameters.getOutValueDate(jobName>, <parameter>)

The value of the out parameter of the job in chain (see placeholders below)

java.util.Date

chainJobId

job id of the inner-most chain (needs to be a runtime parameter)

long

jobId

job id of the current job (needs to be a runtime parameter)

long

topLevelJobId

job id of highest parent job in hierarchy (needs to be a runtime parameter)

long

returnCode

return code of current job

long

stepIterations

iteration number of the current step or job

long

waitEvents.name.finalPath

the path of the file that raised the event (after move, if applicable)

java.lang.String

waitEvents.name.originalPath

the path of the file that raised the event (before move, if applicable)

java.lang.String

waitEvents.name.raiserComment

the comment of the raiser

java.lang.String

The placeholders for the JobChainParameters.getOutValue functions are as follows:

  • <jobName> - the name of the job, for example:

    • Step 1, job 2

    • Extract data, job 4

  • <parameter> - the name of the parameter

Scripting Contexts

Contexts are places in the interface where Redwood Expression Language can be used. The variables added with the Scripting module are only available in RedwoodScript, not in Redwood Expression Language.

Please check your license to make sure you hau have the Scripting Module.

They are additional to those available in the Free of Charge version.

All contexts have the following imports:

  • com.redwood.scheduler.api.model.enumeration - This defines all the enumerations used by the API

  • com.redwood.scheduler.infrastructure.logging.enumeration- This defines the Level enumeration

Job Definition Parameter Default Expressions

Redwood Expression Language

  • parameters

  • waitEvents

Job Definition Parameter Constraints

Redwood Expression Language

  • Constraint

  • Table

Job Chain Step Preconditions

Redwood Expression Language

  • chainParameters

  • chainOutParameters

  • stepIterations

    • The amount of times this job has been called in this instance of the job chain.

  • JobChainParameters.getOutValueString(jobName, parameter)

  • JobChainParameters.getOutValueNumber(jobName, parameter)

  • JobChainParameters.getOutValueDate(jobName, parameter)

Job Chain Job Preconditions

Redwood Expression Language

  • parameters

  • outParameters

  • chainParameters

  • chainOutParameters

  • stepIterations

    • The amount of times this job has been called in this instance of the job chain.

  • JobChainParameters.getOutValueString(jobName, parameter)

  • JobChainParameters.getOutValueNumber(jobName, parameter)

  • JobChainParameters.getOutValueDate(jobName, parameter)

Job Chain Job Parameter Mappings

Redwood Expression Language

  • parameters

  • outParameters

  • chainParameters

  • chainOutParameters

  • chainJobId

  • topLevelJobId

  • JobChainParameters.getOutValueString(jobName, parameter)

  • JobChainParameters.getOutValueNumber(jobName, parameter)

  • JobChainParameters.getOutValueDate(jobName, parameter)

Job Chain Job Scheduling Parameters

Redwood Expression Language

  • parameters

  • outParameters

  • chainParameters

  • chainOutParameters

  • JobChainParameters.getOutValueString(jobName, parameter)

  • JobChainParameters.getOutValueNumber(jobName, parameter)

  • JobChainParameters.getOutValueDate(jobName, parameter)

RedwoodScript Job Definitions

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.warning("This is a warning!");

jcsErr

java.io.PrintWriter

jcsErr.println("This line gets printed to stderr of the job.");

jcsJobContext

com.redwood.scheduler.api.job.UserJobContext

jcsJobContext.waitForAllChildren();

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsErrLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsErrLog.warning("This is a warning!");

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.restart();

jcsOut

java.io.PrintWriter

jcsOut.println("This line gets printed to stdout of the job.");

<parameter_name>

java.lang.String, java.lang.Number, java.util.Date, com.redwood.scheduler.api.date.DateTimeZone

RedwoodScript in the Shell

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to the standard output.");

jcsErr

java.io.PrintWriter

jcsOut.println("This text will be printed to the standard error.");

Job definition On-Change Actions

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.warning("This is a warning!");

jcsOnChangeContext

com.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObject

jcsOnChangeContext.setFailJobOnError(false);

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.hold();

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Job Definition Pre-Running Actions

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.info("This is an informational message!")

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.hold();

jcsPreRunningContext

com.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObject

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Job Definition Post-Running Actions

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.debug("This is a debug message!")

jcsPostRunningContext

com.redwood.scheduler.api.scripting.variables.PostRunningActionScriptObject

jcsPostRunningContext.setFailJobOnError(false);

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.restart();

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Trigger Before Definition Change

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.fatal("This is a fatal error message!");

jcsTriggerContext

com.redwood.scheduler.api.scripting.variables.TriggerScriptObject

jcsTriggerContext.getSchedulerEntity();

Trigger Before Job On Change

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.warning("This is a warning!");

jcsOnChangeContext

com.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObject

jcsOnChangeContext.setFailJobOnError(false);

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.hold();

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Trigger Before Job Pre Running

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.info("This is an informational message!")

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

Queue jcsJobQueue = jcsSession.getQueueByName("UNIX_Generic");

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.hold();

jcsPreRunningContext

com.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObject

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Trigger Before Job Post Running

Redwood Expression Language

  • Feature not available

With Scripting module:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.debug("This is a debug message!")

jcsPostRunningContext

com.redwood.scheduler.api.scripting.variables.PostRunningActionScriptObject

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

String strUser = jcsSession.getUserName();

jcsJob

com.redwood.scheduler.api.model.Job

jcsJob.restart();

jcsOut

java.io.PrintWriter

jcsOut.println("This text will be printed to a specific output file on the job.");

Import Rule Sets

Redwood Expression Language

  • Feature not available

With Scripting and Import Export modules:

RedwoodScript

Object

Class

Example Code

jcsSession

com.redwood.scheduler.api.model.SchedulerSession

Queue jcsJobQueue = jcsSession.getQueueByName("PRD_QUEUE");

jcsImportRuleSet

com.redwood.scheduler.api.scripting.variables.ImportActionScriptObject

jcsImportRuleSet.getObjects();

Alerting Source Actions

Redwood Expression Language

  • Feature not available

With Scripting and Alerting modules:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.info("This is an informational message");

jcsAlertSourcePostAlertContext

com.redwood.scheduler.api.scripting.variables.AlertSourcePostAlertActionScriptObject

AlertSource jcsAlertInitiator = jcsAlertSourcePostAlertContext.getAlertSource();

Alert Escalation Actions

Redwood Expression Language

  • Feature not available

With Scripting and Alerting modules:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.info("This is an informational message");

jcsAlertEscalationPostAlertContext

com.redwood.scheduler.api.scripting.variables.AlertEscalationPostAlertActionScriptObject

jcsAlertEscalationPostAlertContext.isResend()

Alert Email Gateway Actions

Redwood Expression Language

  • Feature not available

With Scripting and Alerting modules:

RedwoodScript

Object

Class

Example Code

jcsOutLog

com.redwood.scheduler.infrastructure.logging.api.Logger

jcsOutLog.info("This is an informational message");

jcsEmailAlertGatewayPreSendActionContext

com.redwood.scheduler.api.scripting.variables.EmailAlertGatewayPreSendActionScriptObject

jcsEmailAlertGatewayPreSendActionContext.getMessage();

Using RedwoodScript in Objects

Example

=JobChainParameters.getOutValueString('Step 1, Job 1', 'Param1')