SPL File TestShellSourceBasic1.spl

Toolkits > SampleShellSource 1.1.0 > sample > TestShellSourceBasic1.spl

Content

Operators
  • TestShellSourceBasic1: This sample application executes a shell command with a variety of ShellSource operators illustrating how to specify the operator's required and optional parameters, and writes STDOUT from the command into files.

Composites

public composite TestShellSourceBasic1

This sample application executes a shell command with a variety of ShellSource operators illustrating how to specify the operator's required and optional parameters, and writes STDOUT from the command into files.

The command copies lines from a text file to the ShellSource operator's output tuples.

Parameters

SPL Source Code


 composite TestShellSourceBasic1 {
 
     param
     expression<rstring> $command: "cat " + dataDirectory() + "/ozymandias.txt";
 
     graph
 
 
     // execute a shell command that writes text lines to STDOUT and produce tuples containing them
     stream<rstring line> A_STDOUTStream = ShellSource() {
     param
         command: $command; }
     () as DebugA_STDOUTStream = FileSink(A_STDOUTStream) { param file: "debug.TestShellSourceBasic1.A_STDOUTStream.out"; format: txt; hasDelayField: true; flush: 1u; writePunctuations: true; }
 
 
     // execute a shell command that writes text lines to STDOUT and produce tuples containing them
     stream<rstring line> B_STDOUTStream = ShellSource() {
     param
         command: $command;
         stdoutAttribute: "line"; }
     () as DebugB_STDOUTStream = FileSink(B_STDOUTStream) { param file: "debug.TestShellSourceBasic1.B_STDOUTStream.out"; format: txt; hasDelayField: true; flush: 1u; writePunctuations: true; }
 
 
     // execute a shell command that writes text lines to STDOUT and produce tuples containing the text plus their line numbers and character counts
     stream<uint64 lineNumber, int32 lineLength, rstring line> C_STDOUTStream as Out = ShellSource() {
     param
         command: $command;
     output Out:
         lineNumber = lineCounters()[1],
         lineLength = length(stdoutLine()),
         line = stdoutLine(); }
     () as DebugC_STDOUTStream = FileSink(C_STDOUTStream) { param file: "debug.TestShellSourceBasic1.C_STDOUTStream.out"; format: txt; hasDelayField: true; flush: 1u; writePunctuations: true; }
 
 
     // after a short delay, execute a shell command that writes text lines to STDOUT and produce tuples containing them
     stream<rstring line> D_STDOUTStream = ShellSource() {
     param
         command: $command;
         initDelay: 1.5; }
     () as DebugD_STDOUTStream = FileSink(D_STDOUTStream) { param file: "debug.TestShellSourceBasic1.D_STDOUTStream.out"; format: txt; hasDelayField: true; flush: 1u; writePunctuations: true; }
 
 
     // repeatedly execute a shell command that writes text lines to STDOUT and produce tuples containing them
     stream<rstring line> E_STDOUTStream = ShellSource() {
     param
         command: $command;
         iterationCount: 3u;
         iterationInterval: 3.0; }
     () as DebugE_STDOUTStream = FileSink(E_STDOUTStream) { param file: "debug.TestShellSourceBasic1.E_STDOUTStream.out"; format: txt; hasDelayField: true; flush: 1u; writePunctuations: true; }
 
 
 }