com.ibm.streamsx.topology.spl (Java Application API for IBM Streams)
Date: 2020-08-07

# Package com.ibm.streamsx.topology.spl

Integration between Streams SPL and Java applications.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  SPLInput | Interface that can be connected to an SPL input port.
  SPLSchemas | Interchangeable SPL types.
  SPLStream | A `SPLStream` is a declaration of a continuous sequence of tuples with a defined SPL schema.
  SPLWindow | An SPL window, that has an SPL eviction policy and an SPL trigger policy.

- Class Summary
  Class | Description
  --- | ---
  FileSPLStreams | Creation of SPLStreams that relate to files.
  JavaPrimitive | Integration between Java topologies and SPL Java primitive operators.
  SPL | Integration between Java topologies and SPL operator invocations.
  SPLStreams | Utilities for SPL attribute schema streams.

- Enum Summary
  Enum | Description
  --- | ---
  FileSPLStreams.Compression |

## Package com.ibm.streamsx.topology.spl Description

Integration between Streams SPL and Java applications. Using methods in `SPL` and `Java primitives` a topology can include invocations of any SPL primitive or composite operator.

#### Operator Kind

An SPL operator is invoked by its kind. An operator's kind is its namespace followed by the operator name separated with '`::`'. For example the `FileSource` operator from the SPL Standard toolkit must be specified as:
`spl.adapter::FileSource`.

#### Operator Parameters

Invocation of an `SPL` operator (including `Java primitives`) optionally includes a set of parameters. The parameters are provided as a `Map<String,Object>`. The `String` key is the parameter name and the value is the parameter value.
Types are mapped as:

- SPL type : Java type
- `boolean` : `java.lang.Boolean`
- `int8` : `java.lang.Byte`
- `int16` : `java.lang.Short`
- `int32` : `java.lang.Integer`
- `int64` : `java.lang.Long`
- `float32` : `java.lang.Float`
- `float64` : `java.lang.Double`
- `rstring` : `java.lang.String`
- `uint8` : Object returned by `SPL.createValue(Byte value, MetaType.UINT8)`
- `uint16` : Object returned by `SPL.createValue(Short value, MetaType.UINT16)`
- `uint32` : Object returned by `SPL.createValue(Integer value, MetaType.UINT32)`
- `uint64` : Object returned by `SPL.createValue(Long value, MetaType.UINT64)`
- `ustring` : Object returned by `SPL.createValue(String value, MetaType.USTRING)`
- enum : Java enumeration with constants matching the SPL enum's constants.
- `optional<T>` : Java type for type T, if value is present, else null or Object returned by `SPL.createNullValue()`

When a primitive operator's parameter cardinality allows multiple values the parameter value is a `java.util.Collection` containing values of the correct type, typically a `java.util.List` or `java.util.Set`.

Operator parameters can also be passed as submission parameters, see `SPL` for examples.

SPL input attributes are passed using an instance of `com.ibm.streams.operator.Attribute` from the input schema. For example setting the `key` parameter for the `DeDuplicate` operator to the input attribute `id` would use (where `s` is the input stream):
`params.put("key", s.getSchema().getAttribute("id"));`

#### Full use of SPL capabilities

Only invocation of SPL operators is supported, functionality such as SPL logic clauses, function invocations, annotations etc. are not supported. These limitations can typically be worked around by creating an SPL composite operator that uses the full language capabilities of SPL and then invoking the composite from this API.