Developing StreamBase Java Operators

Overview

This part of the API Guide describes how to develop custom Java operators for StreamBase applications. A Java operator is a StreamBase component, inserted in the flow of a StreamBase application, that calls a custom Java method.

Java operators extend the following packages in the StreamBase Java Client library:

  • com.streambase.sb.operator

  • com.streambase.sb.operator.parameter

Note

StreamBase Studio ships with new projects configured by default to build with Java 6. If you have a requirement to use Java 5, configure the Studio project that contains your custom code using the steps in Using Java 5 for Custom Extensions.

The Development Process

Designing, developing, and deploying Java operators in StreamBase Studio is similar to working with embedded adapters, and follows this general process:

  1. Create the required Java class for your operator. We strongly recommend using the StreamBase Java Operator wizard to generate the base Java code, as described in the following topic.

    Using the StreamBase Java Operator Wizard

  2. Edit the Java source generated by the wizard to implement your specific functionality. The code includes // TODO markers, which indicate sections that need to be completed. The following topic contains information about writing Java operator code:

    Creating Custom Java Operators

    Pay special attention to the Methods for Studio Presentation section of that page.

  3. If you are using third-party jars or native libraries, you may need to configure StreamBase Studio to correctly load the libraries:

    Using Third-Party JARs and Native Libraries

  4. Add the custom operator to a StreamBase application, as described in this Authoring Guide topic:

    Using Java Operators

    You can use the operator and test it in the StreamBase Studio environment without compiling or packaging it.

  5. Deploy the operator, as described in Deploying Applications. Deployment involves package your operator into a JAR and exporting it to your file system. When you deploy your application, you will need to edit the sbd.sbconf file that will run it, defining the operator-resource-search element to identify the deployed location of your operator JAR.