Contents
Custom adapters and Java operators are built using the StreamBase Client API libraries,
as documented elsewhere in this guide. As this topic describes, you can also use
third-party JARs or native so or DLL libraries.
However, StreamBase Studio is not normally configured to load third-party JARs and native libraries directly. Unlike StreamBase Client library libraries, they are not automatically discovered by Studio when they are on the project build path. As a result, your adapter or operator cannot be instantiated, and typechecking fails for the application that includes it.
Third-party JARs and native libraries are normally processed separately from
StreamBase. For example, if your adapter includes a third-party JAR and that JAR in
turn calls a DLL or so
library, the location of that library is resolved by the Java process. If there is
still another level of dependency (for example, Java > JAR > DLL > DLL ), the
second-level of DLL is resolved by the operating system.
This topic describes how to work around these limitations by locating these resources correctly and performing a simple reconfiguration of StreamBase Studio.
This section describes scenarios using different combinations of third-party JARs and native libraries, and indicates where to locate them. To keep things simple, we assume that you create the base code using one of the StreamBase wizards for creating adapters or Java operators.
- Scenario 1: No third-party dependencies
-
In the simplest case, your adapter or operator uses no third-party JARs and no native libraries:
The adapter or operator source is generated into the
java-srcfolder of your Studio project by default. - Scenario 2: Adapters or operators and third-party JARs
-
If your adapter or operator uses third-party JARs but no native libraries:
-
Adapter and operator resources can be in the same locations as in Scenario 1. In addition:
-
Put your third-party JARs on the project build path.
-
- Scenario 3: Adapters or operators and native libraries
-
If your adapter or operator uses native libraries but no third-party JARs:
-
Put your native libraries in
system32.For native libraries,
java.library.pathalways includes thesystem32directory. On Windows, the library path is specified in %PATH% or LD_LIB_PATH. -
Edit
sbstudio.inias described in Configuring StreamBase Studio to Use Native Libraries. -
Open StreamBase Studio by running the
sbstudio.exefile in-
%STREAMBASE_HOME%\lib\studio(on Windows) -
$STREAMBASE_HOME/lib/studio(on UNIX)
instead of the
sbstudio.exefile in thebindirectory. -
-
- Scenario 4: Adapters or operators and third-party JARs and native libraries
-
If your adapter or operator uses both native libraries and third-party JARs, use this procedure:
-
Put your native libraries in
system32.For native libraries,
java.library.pathalways includes thesystem32directory. On Windows, the library path is specified in %PATH% or LD_LIB_PATH. -
Put your third-party JARs in your JRE's
lib/extdirectory (not in).$STREAMBASE_HOME/lib/ext -
Edit
sbstudio.inias described in Configuring StreamBase Studio to Use Native Libraries. -
Open StreamBase Studio by running the
sbstudio[.exe]file in-
%STREAMBASE_HOME%\lib\studio(on Windows) -
$STREAMBASE_HOME/lib/studio(on UNIX)
instead of the
sbstudio[.exe] file in thebindirectory. -
-
This section describes how to modify StreamBase Studio's initialization file so that you can use native libraries with your custom adapter or Java operator.
-
Look up and note these paths on your system:
- Java path
-
The relative path to the Java executable file from the JRE that is included with your StreamBase installation. For the default installation, that path is one of the following:
Installation Path to Java Executable 32-bit Windows %STREAMBASE_HOME%\jdk\bin\java.exe 64-bit Windows %STREAMBASE_HOME%\jdk64\bin\java.exe UNIX $STREAMBASE_HOME/jdk/bin/java - default configuration path
-
The path to the default configuration path used by StreamBase Studio, as described in Default Installation Directories.
-
Edit
sbstudio.iniat this location:-
%STREAMBASE_HOME%\lib\studio(on Windows) -
$STREAMBASE_HOME/lib/studio(on UNIX)
-
-
Add these lines at the beginning of
sbstudio.ini, using the paths described in the previous step:-vm
java path-configurationdefault configuration pathFor example:
-vm ../../jdk/bin/java.exe -configuration file:/C:/Users/
sbuser/AppData/Roaming/StreamBase/StreamBase Studion.m.r/ -
Add this line at the end of
sbstudio.ini:-Dosgi.parentClassloader=ext
