StringCase.sbapp sample application uses a Java operator to change the case of strings. This is then used to implement case-insensitive query
This topic describes the Java operator sample, which includes a StreamBase application and a Java class that extends
For details about how StreamBase used the API to extend
com.streambase.sb.operator.*, see Using the StreamBase Java Operator Wizard in the API Guide. For information about importing a JAR that contains a Java Operator in StreamBase Studio, and then selecting an
Operator class from that JAR, see Using Java Operators in the Authoring Guide.
For details about using custom icons with your Java operators, see the Java Client library documentation for
The Java code in this sample is delivered only in source code form. To build the code, you must load the sample into StreamBase Studio, which automatically builds the Java code.
In StreamBase Studio, import this sample with the following steps:
From the top menu, select→ .
javaoto narrow the list of options.
Select javaoperator from the Extending StreamBase category.
StreamBase Studio creates a project for the sample.
In the Project Explorer, notice the
src/main/javafolder in the
sample_javaoperatorproject. This directory contains
com.tibco.sb.sample.javaoperatorpackage folder, which extends
In the Project Explorer, open the sample you just loaded.
Open the package folder (most samples contain a single package folder. Open the top-level package folder if your sample contains more than one folder).
operator in the canvas to open its Properties view. In the Parameters tab, notice that the string conversion type (by default) is set to
Lowercase. Change this setting to
Uppercase. Do the same for the
StringCase.sbapptab in the EventFlow Editor, then click the button. The application starts and Studio switches to the SB Test/Debug perspective.
If you see red marks, wait a moment for the project in Studio to load its features.
If red marks do not resolve themselves in a moment, select the project and right-click→ from the context menu.
Select the Manual Input view. Selectfrom the Input Stream list.
ibm, and in the
120, and click .
In the Output Streams view, notice that in OutputStream1, after the write to the Query Table, the symbol string is
40, and click .
In the Manual Input view, select
PriceQueryfrom the Input Stream list.
ibm, and click . The price,
120, is displayed in the Output Streams view.
oRcLin mixed case, and click . The price,
40, is displayed in the Output Streams view. Notice that the table lookup was successful, because the string is stored as uppercase, despite the mixed-case initial input.
When done, press F9 or click the Stop Running Application button.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
See Default Installation Directories for the default location of
studio-workspace on your system.