Table of Contents

Class ScriptHostInterface

Namespace
ArcanaDevelopment.adTempus.ApplicationIntegration
Assembly
ArcanaDevelopment.adTempus.ApplicationIntegration.dll

The ScriptHostInterface allows scripts to interact with the host adTempus server. It is exposed to scripts through the adTempusobject.

public abstract class ScriptHostInterface
Inheritance
object
ScriptHostInterface
Derived

Properties

Checkpoint

Gets or sets the Checkpoint for the job.

public static string Checkpoint { get; set; }

Property Value

string

JobID

Gets the unique ID for the job definition.

public static string JobID { get; }

Property Value

string

JobInstanceID

Gets the unique ID for this job instance.

public static string JobInstanceID { get; }

Property Value

string

JobVariables

Gets the Job Variables for the job.

public static IJobVariableDictionary JobVariables { get; }

Property Value

IJobVariableDictionary

Remarks

This collection contains all Job Variables currently defined for this job instance. You can add or modify variables, but those changes only affect this job instance--they are not permanent changes.

StepID

Gets the unique ID for the job step definition.

public static string StepID { get; }

Property Value

string

StepNumber

Gets the step number

public static int StepNumber { get; }

Property Value

int

Methods

CaptureFile(byte[], string, DateTime, string)

Stores data as a Captured File in the job history.

public static void CaptureFile(byte[] fileContents, string fileName, DateTime fileDate, string originalPath = "")

Parameters

NameTypeDescription
fileContents byte[]

The contents to write to the file

fileName string

The file name to display for the data.

fileDate DateTime

The timestamp to display for the file.

originalPath string

The path to display for the file. Can be null or empty.

CaptureFile(string, string)

Captures a file on disk and stores it in the job history.

public static void CaptureFile(string fileName, string newFileName = "")

Parameters

NameTypeDescription
fileName string

The path/name of an existing file.

newFileName string

The name that the file should use after it is captured. Specify null or empty string to use the original name.

Remarks

The file is copied to the adTempus CapturedFiles directory when you call CaptureFile.

CaptureFile(string, string, string)

Captures a file on disk and stores it in the job history.

public static void CaptureFile(string fileName, string originalPath, string displayName)

Parameters

NameTypeDescription
fileName string

The path/name of an existing file.

originalPath string

The original path of the file. Specify null or empty string to use the fileName.

displayName string

The name that the file should use after it is captured. Specify null or empty string to use the original name.

Remarks

The file is copied to the adTempus CapturedFiles directory when you call CaptureFile.

ExecuteOnDemandResponses(string)

Executes on-demand Responses defined for the job or step.

public static void ExecuteOnDemandResponses(string eventTag)

Parameters

NameTypeDescription
eventTag string

The tag used to match Response Events.

Remarks

This method will invoke any Responses that have a ResponseEvent with type OnDemand and a CustomEventID that matches the eventTag.

Responses are invoked asynchronously (the script does not wait for completion of Response evaluation).

ExecuteOnDemandResponses(string, ResponseParameters)

Executes on-demand Responses defined for the job or step.

public static void ExecuteOnDemandResponses(string eventTag, ResponseParameters parms)

Parameters

NameTypeDescription
eventTag string

The tag used to match Response Events.

parms ResponseParameters

Additional parameters for Response evaluation. Can be null.

Remarks

This method will invoke any Responses that have a ResponseEvent with type OnDemand and a CustomEventID that matches the eventTag.

Responses are invoked asynchronously (the script does not wait for completion of Response evaluation).

LogMessage(MessageTypeEnum, int, string)

Logs a message to the Job Log for the job.

public static void LogMessage(MessageTypeEnum messageType, int messageCode, string message)

Parameters

NameTypeDescription
messageType MessageTypeEnum

The message type (severity)

messageCode int

The message code. Can be used to filter messages. Note: The value 100000 will be added to the messageCode when the message is recorded in adTempus.

message string

The message text.

Remarks

Each message logged with LogMessage creates a log message in the Job Log for the job and a record in the adTempus database. To avoid cluttering the job log and using large amounts of database space, use MessageTypeEnum.Debug for debug-level messages. These messages will be written to the Job Detail Log instead of the main Job Log. The detail log is a single log file with detailed/diagnostic information for the job, available from the Captured Files list for the job.

ReplaceVariableTokens(string)

Expands variable tokens in a string

public static string ReplaceVariableTokens(string source)

Parameters

NameTypeDescription
source string

The string to expand tokens in.

Returns

string

Remarks

This method expands any Job Variable tokens found in the string, replacing each token with the current value of the variable. For example, if the string contains the token "%ADTJobName%", that gets replaces with the name of the job (which is exposed through the ADTJobName variable.

SendNotificationMessage(NotificationMessage)

Sends a notification message through the adTempus notification system.

public static void SendNotificationMessage(NotificationMessage message)

Parameters

NameTypeDescription
message NotificationMessage

The message to send.

SetAdditionalResult(string, string)

Communicates additional result information to the host.

public static void SetAdditionalResult(string key, string value)

Parameters

NameTypeDescription
key string
value string

SetJobOutcome(ExecutionOutcome, string)

Sets the success or failure state of the job in which the script is executing

public static void SetJobOutcome(ExecutionOutcome outcome, string message = null)

Parameters

NameTypeDescription
outcome ExecutionOutcome

Indicates whether the job should be reported as Succeeded or Failed.

message string

Optional message to log to the Job Log

Remarks

When the outcome is set using SetStepOutcome, this overrides the normal success/failure determination rules for the step. This is equivalent to using a JobControlAction with a ControlType of SucceedJob or FailJob

SetStepOutcome(ExecutionOutcome, string)

Sets the success or failure state of the step in which the script is executing

public static void SetStepOutcome(ExecutionOutcome outcome, string message = null)

Parameters

NameTypeDescription
outcome ExecutionOutcome

Indicates whether the step should be reported as Succeeded or Failed.

message string

Optional message to log to the Job Log

Remarks

When the outcome is set using SetStepOutcome, this overrides the normal success/failure determination rules for the step. This is equivalent to using a JobControlAction with a ControlType of SucceedJob or FailJob

Sleep(int)

Delays execution for the specified number of milliseconds.

public static bool Sleep(int timeoutMS)

Parameters

NameTypeDescription
timeoutMS int

The number of milliseconds to sleep.

Returns

bool

True if the wait period elapsed, or False if the script/step/job was aborted before the wait elapsed.

Remarks

Use this method to sleep safely inside a script and abort processing if the script is terminated.