Table of Contents

Interface IExecutionContext

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

Provides information about the context in which the operation is executing, and allows communication with the adTempus server.

public interface IExecutionContext

Properties

Checkpoint

Gets or sets the Checkpoint for the job.

string Checkpoint { get; set; }

Property Value

string

JobID

Gets the unique ID for the job definition.

string JobID { get; }

Property Value

string

JobInstanceID

Gets the unique ID for this job instance.

string JobInstanceID { get; }

Property Value

string

JobVariables

Gets the Job Variables for the job.

IJobVariableDictionary JobVariables { get; }

Property Value

IJobVariableDictionary

ServerProperties

Information about the adTempus server.

IServerProperties ServerProperties { get; }

Property Value

IServerProperties

ShouldTerminate

Indicates whether the operation has been terminated.

bool ShouldTerminate { get; }

Property Value

bool

Remarks

ShouldTerminate returns True if a termination request has been received for the operation. Consumers of this interface can poll ShouldTerminate during lengthy operations to detect termination. When termination has been requested, the operation should terminate as soon as possible.

StepID

Gets the unique ID for the job step definition.

string StepID { get; }

Property Value

string

StepNumber

Gets the step number

int StepNumber { get; }

Property Value

int

Methods

CaptureFile(string, string, string)

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

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.

CaptureFileData(byte[], string, string, DateTime, bool)

Stores data as a Captured File in the job history.

void CaptureFileData(byte[] fileContents, string fileName, string originalPath, DateTime fileDate, bool treatAsCapturedConsole = false)

Parameters

NameTypeDescription
fileContents byte[]

The contents to write to the file

fileName string

The file name to display for the data.

originalPath string

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

fileDate DateTime

The timestamp to display for the file.

treatAsCapturedConsole bool

If true, this file is treated as captured console output for various purposes

LogMessage(MessageTypeEnum, int, string)

Logs a message to the Job Log for the job.

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

string ReplaceVariableTokens(string sourceString)

Parameters

NameTypeDescription
sourceString string

The string to expand tokens in.

Returns

string

Remarks

This method replaces any valid variable tokens it finds with the corresponding values.

For example, if Job Variable "SomeVariable" has the value of "423", calling ReplaceVariableTokens("Current value: %SomeVariable%") returns the result "Current value: 423".

This method does not support the expansion of inline functions.

SendNotificationMessage(NotificationMessage)

Sends a notification message through the adTempus notification system.

void SendNotificationMessage(NotificationMessage message)

Parameters

NameTypeDescription
message NotificationMessage

The message to send.

SetAdditionalResult(string, string)

Communicates additional result information to the host.

void SetAdditionalResult(string key, string value)

Parameters

NameTypeDescription
key string
value string

Sleep(int)

Delays execution for the specified number of milliseconds.

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.

Sleep(TimeSpan)

Delays execution for the specified time

bool Sleep(TimeSpan timeout)

Parameters

NameTypeDescription
timeout TimeSpan

The time 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.