IBM InfoSphere Streams Version 4.1.0

Java Operator API overview

You use the InfoSphere® Streams Java™ Operator API to implement user-defined operators in Java.

The Javadoc documentation for this API is provided with the InfoSphere Streams installation in the $STREAMS_INSTALL/doc/spl/operator/api/java/api directory. The primary package within this API iscom.ibm.streams.operator. Here is a brief description of its main classes.
  • Operator: This interface defines an operator. The InfoSphere Streams run time calls methods on this interface for initialization and then on for each incoming tuple and punctuation until a shutdown request is made.
  • AbstractOperator: Is an abstract class that developers can extend to implement Operator. It provides a number of useful utility methods.
  • OperatorContext: This interface provides access to the operator's runtime context, including descriptions of the streams and parameters. In addition, it provides access to a Java ScheduledExectorService and ThreadFactory for asynchronous actions.
  • StreamSchema: This interface describes the schema of a port, including the names and types (Java and SPL) of its attributes.
  • StreamingInput: This interface describes an input port, including its schema.
  • StreamingOutput: This interface describes an output port and provides methods to obtain new output tuples and to submit them.
  • Tuple: This interface implements an immutable object that generically represents an incoming tuple.
  • OutputTuple: This interface implements a mutable object that generically represents an outgoing tuple.
The Java Operator API is in the InfoSphere Streams library com.ibm.streams.operator.jar, which is located in $STREAMS_INSTALL/lib. The Java Operator API depends on Apache Commons Math 2.2 library (commons-math-2.2.jar) which is located in $STREAMS_INSTALL/ext/lib. When you develop Java operators using the Java Operator API, the com.ibm.streams.operator.jar and commons-math-2.2.jar libraries are required in the class path or build environment for the InfoSphere Streams Studio. Sample operators and patterns, including source, are supplied in the InfoSphere Streams library com.ibm.streams.operator.samples.jar, which is in $STREAMS_INSTALL/lib.
Note: All of these libraries are automatically added by the InfoSphere Streams run time for operator invocation, thus they must not be declared as dependencies of a Java primitive operator or included in the classLibrary parameter for a JavaOp invocation.

The InfoSphere Streams run time provides a Java SE Version 8 execution environment for operators that are implemented using the InfoSphere Streams Java Operator API. The virtual machine that is used by a streams processing application is defined by the setting of the environment variable JAVA_HOME when the SPL compiler (sc) is run.