Namespace com.teracloud.streams.inet.rest

A set of operators using HTTP (REST) APISs to interact with streaming data.

These operators all embed an instance of Eclipse Jetty to provide an web-server embedded within the operator.

Access to streaming data is provided through the HTTPTupleView and HTTPXMLView operators. These two operators support HTTP GET requests to fetch the latest version of the streaming data in the operator's state.

Data can be injected into a stream through HTTPTupleInjection, HTTPXMLInjection, HTTPBLOBInjection and HTTPJSONInjection operators. Each operators extracts data from an HTTP POST and submits a tuple on an output port.

WebContext provides a mechanism to serve files at a fixed web context, a fixed path relative to the root URL of the web server. Note that all the operators also support a fixed context using the context and contextResourceBase operator parameters.

The HTTPRequestProcess operator enables a developer to process HTTP form's and REST calls in a Streams application and deliver the appropriate response to the HTTP client.

Overall, these set of operators allow a complete web-application to be self-contained within an SPL application. In addition to the operators the webserver will serve up HTML and Javascript files. Javascript can be used with the JSON data provided by HTTPTupleView to visual live data using graphical packages such as DOJO and D3.

Meta-data for the streams connected to the operators is also available through HTTP GET requests, to allow JavaScript applications to self-discover the format of the data and the to self-discover the connected streams and exposed contexts:
  • ports/info Meta information of the connected ports
  • contexts/info Meta information of the exposed contexts
  • / default context mapped to application_directory/opt/html
More fixed contexts are provided by the operators:
  • inetserver.resources Utilities provided by the operators.
  • inetserver.dojo The Dojo Javascript library located at $STREAMS_INSTALL/ext/dojo.

HTTPTupleView provides automatic visualization of tuples on its input ports. These are available through the URL inetserver.resources/dojo/viewall.html.

This provides a table containing links for all the ports connected to all HTTPTupleView operators using the same Jetty webserver: The columns in the table are:
  • Info - Link to the JSON meta data about the port, including the names and types of the attributes.
  • Live Table - Link to a live table of the current viewable data. Some automatic formatting is applied based upon the name and type of an attribute.
  • Live Table (Raw) - Link to a live table of the current viewable data, with no formatting.
  • JSON Data - Link that provides the raw JSON data.
This tables use the Dojo Javascript library from the Steams install, and thus do not require external internet connectivity.

HTTPS Support and Sharing the Jetty Server

See pages under com.teracloud.streams.inetserver

Operators

  • HTTPBLOBInjection: NOTE: Deprecated as of version 5.0.0 (Streams version 7.2). Use the EndpointSource operator from the SPL toolkit instead. Embeds a Jetty web server to allow HTTP or HTTPS POST requests to submit a tuple on its output ports. Each output port corresponds to a unique URL comprising the operator name and the port index.
  • HTTPJSONInjection: NOTE: Deprecated as of version 5.0.0 (Streams version 7.2). Use the EndpointSource operator from the SPL toolkit instead. Embeds a Jetty web server to allow HTTP or HTTPS POST requests with mime type application/json to submit a tuple on its output ports. Each output port corresponds to a unique URL comprising the operator name and the port index.
  • HTTPRequestProcess: Operator accepts a web request and generates corresponding response.
  • HTTPTupleInjection: NOTE: Deprecated as of version 5.0.0 (Streams version 7.2). Use the EndpointSource operator from the SPL toolkit instead. Embeds a Jetty web server to allow HTTP or HTTPS POST requests to submit a tuple on its output ports. Each output port corresponds to a unique URL comprising the operator name and the port index.
  • HTTPTupleView: REST HTTP or HTTPS API to view tuples from windowed input ports.
  • HTTPXMLInjection: NOTE: Deprecated as of version 5.0.0 (Streams version 7.2). Use the EndpointSource operator from the SPL toolkit instead. Embeds a Jetty web server to allow HTTP or HTTPS POST requests to submit a tuple on its output ports. Each output port corresponds to a unique URL comprising the operator name and the port index.
  • HTTPXMLView: REST API to view tuples from input ports.
  • WebContext: Embeds a Jetty web server to provide HTTP or HTTPS REST access to files defined by the context and contextResourceBase parameters.

Functions

  • obfuscate(T): Obfuscate a password for an operator in this namespace.If the password is starts with OBF: then it is assumed to be already obfuscated and input is returned unchanged. This allowsexternal tools to pass submission time values that are already obfuscated. The Eclipse Jetty class org.eclipse.jetty.util.security.Password is the underlying utility.

Types

  • HTTPRequest: Output and Input schema, web request output from HTTPRequestProcess operator and corresponding response on the input port are returned to the web.
  • MappedPosition: Convenience type that corresponds to the expected attributes for the default mapping visualization.
  • MappedPositionIcon: Convenience type that corresponds to the expected attributes for default mapping visualization using icon path for markers and a note.
  • MappedPositionIconLayer: Convenience type that corresponds to the expected attributes for default mapping visualization using a layer, icon path for markers and a note.
  • MappedPositionMarker: Convenience type that corresponds to the expected attributes for default mapping visualization using the pre-defined markers and a note.
  • MappedPositionMarkerLayer: Convenience type that corresponds to the expected attributes for default mapping visualization using a layer, pre-defined markers and a note.
  • MarkerType: Type of the marker to display for a point on the default map visualization by HTTPTupleView.