main {componentSkeleton}R Documentation

Component main function

Description

Entry point for the component. Reads the command file and executes given function (execute.func) which performs the actual component work.

Usage

main(execute.func)

Arguments

execute.func

A function that takes a command-file object as argument. The function must return a numeric exit status that is then passed to the Anduril engine. Status of 0 is success and nonzero is failure.

Details

The most common error codes of execute.func are referred to using constants GENERIC_ERROR, INVALID_INPUT (problem with input file) and PARAMETER_ERROR (problem with parameter). More rare error codes are NO_COMMAND_FILE, COMMAND_FILE_IO_ERROR, INPUT_IO_ERROR, INVALID_ERRORSTREAM, UNCAUGHT_EXCEPTION, INVALID_COMMAND_FILE and OUTPUT_IO_ERROR. The master list for error codes is the org.anduril.anduril.component.ErrorCode Java enumeration in Anduril core.

The main function is used like this:

library(componentSkeleton)

execute <- function(cf) {
	# Do the job here. cf is a command file object.
	x <- get.parameter(cf, 'x')
	input <- get.input(cf, 'input')
	# ...
	return(0) # Or one of error constants in case of error
}

main(execute)

Author(s)

Kristian Ovaska (kristian.ovaska@helsinki.fi)


[Package componentSkeleton version 2.0.1 Index]