Modeling Guide for SAP Data Hub

SDK API Reference

getInstance(basePath)
  • basePath <string> Optional. The path to the operator descriptor (operator.json) directory. Default set to the directory where the operator's script file is located.

  • Returns: <Operator>
Creates an operator instance (singleton).
config
  • Returns: <object>

The operator.config method returns the configuration of this operator. The runtime configuration is returned, if user changes this operator in the Modeler UI. Otherwise returns the design time configuration which is specified in the operator.json.
addShutdownHandler(handler)
  • handler <Function> The handler to be called before terminating this operator

  • Returns: <void>

The operator.addShutdownHandler() method adds a shutdown handler when terminating this process. It accepts a callback function that takes only one optional error parameter, for example, taking an (err) => ... callback.

The operator fails if the shutdown handler is not a function or is undefined.

Using a callback function:
const handler = (cb: (err?: Error) => void): void => {
  // do something …
  cb(…); // callback with void or an error
};

const operator: Operator = Operator.getInstance();
operator.addShutdownHandler(handler);
done()
  • Returns: <void>

Terminates this operator process with exit code 0.
fail(message)
  • message <string> Error message to be written out

  • Returns: <void>
Terminates this operator process with exit code 1. Writes an error message to process.stderr.
getInPort(name)
  • name <string> The name of the input port

  • Returns: <InPort>
Finds a single input port by its name and returns it.

The operator fails if the port was not found.

getOutPort(name)
  • name <string> The name of the output port

  • Returns: <OutPort>
Finds a single output port by its name and returns it.

The operator fails if the port was not found.

getInPorts()
  • Returns: <Map<string, InPort>>

Returns all input ports of this operator. An empty map is returned when no input port found.
getOutPorts()
  • Returns: <Map<string, OutPort>>

Returns all output ports of this operator. An empty map is returned when no output port is found.
logger
  • Returns: <Logger>

Returns a logger instance which can be used for logging. See Logging.