Home Manual Reference Source Test
import CreateNodeStream from 'atscm/src/lib/server/CreateNodeStream.js'
public class | source

CreateNodeStream

Extends:

StreamQueueStreamCallMethodStreamCallScriptStream → CreateNodeStream

A stream that creates OPC-UA nodes for the passed AtviseFiless.

Test:

Member Summary

Public Members
public get

Id of the CreateNode script added with atscm import.

Method Summary

Public Methods
public

handleOutputArguments(file: AtviseFile, outArgs: node-opcua~Variant[], callback: function(err: Error))

Handles the results of a script call.

public

Prints an error message telling that creating a node failed.

public

The options required to create a node for the given file.

Inherited Summary

From class Stream
private

true if the stream's atvise server session should be kept alive once the stream ends.

private

_flush(callback: function(err: ?Error, data: Object))

Called just before the stream is closed: Closes the open session.

From class QueueStream
public get

true if there are queued operations or an operation is running right now.

public get

The number of processed chunks per second.

public get

The number of chunks already processed.

public get

true if there are no queued operations.

private

The maximum of parallel tasks to execute

private

The number of chunks processed so far.

private

The number of running operations.

private

_queued: *[]

The queued chunks.

private

The timestamp of the date when the stream was created.

public abstract

processChunk(chunk: *, handleErrors: function(err: Error, statusCode: node-opcua~StatusCodes, onSuccess: function))

The function to call when a chunk is ready to be processed.

public abstract

The error message to use when processing a chunk fails.

private

_enqueueChunk(chunk: *)

Enqueues the given chunk for processing.

private

_flush(callback: Function)

Waits for pending operations to complete.

private

_processChunk(chunk: *)

Calls QueueStream#processChunk and handles errors and invalid status codes.

private

_transform(chunk: *, enc: string, callback: Function)

Calls QueueStream#_enqueueChunk as soon as the stream's session is opened.

From class CallMethodStream
public get

The NodeId of the object from which the method should get called.

public get

Must be implemented in all subclasses: The NodeId of the method to call.

public

Creates a call method request object for a file.

public

handleOutputArguments(file: vinyl~File, outputArgs: node-opcua~Variant[], callback: function(err: Error))

Must be implemented by all subclasses: If the method call returns a status code of node-opcua~StatusCodes.Good, this method decides if the output matches the expected results.

public

The input arguments the method should be called with for a file.

public

processChunk(file: vinyl~File, handleErrors: function(err: Error, status: node-opcua~StatusCodes, success: function))

Performs an opcua method call for the given file.

public

Returns an error message specifically for the given file.

From class CallScriptStream
public get

The id of the callScript method.

public get

Id of the script's base object.

public get abstract

Must be implemented by all subclasses: The id of the script to call.

public

Creates the raw method input arguments for the given file.

public

processChunk(file: vinyl~File, handleErrors: function(err: Error, status: node-opcua~StatusCodes, success: function))

Calls the script specified in CallScriptStream#scriptId.

public

Returns the error message logged if running the script fails.

public

Returns the parameters to call the script with for the given file.

Public Members

public get scriptId: NodeId source

Id of the CreateNode script added with atscm import.

Override:

CallScriptStream#scriptId

Test:

Public Methods

public handleOutputArguments(file: AtviseFile, outArgs: node-opcua~Variant[], callback: function(err: Error)) source

Handles the results of a script call.

Override:

CallMethodStream#handleOutputArguments

Params:

NameTypeAttributeDescription
file AtviseFile

The file the script was called with.

outArgs node-opcua~Variant[]

The raw method results.

callback function(err: Error)

Called once finished.

Test:

public processErrorMessage(file: AtviseFile): string source

Prints an error message telling that creating a node failed.

Override:

CallScriptStream#processErrorMessage

Params:

NameTypeAttributeDescription
file AtviseFile

The file who's node could not be created.

Return:

string

The resulting error message.

Test:

public scriptParameters(file: AtviseFile): Object source

The options required to create a node for the given file.

Override:

CallScriptStream#scriptParameters

Params:

NameTypeAttributeDescription
file AtviseFile

The processed file.

Return:

Object

The options passed to the CreateNode script.

Test: