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. You might also move the source to another location on the project build path. - 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-
(on Windows)streambase-install-dir\lib\studio -
(on UNIX)streambase-install-dir/lib/studio
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/ext directory (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-
(on Windows)streambase-install-dir\lib\studio -
(on UNIX)streambase-install-dir/lib/studio
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 used with your StreamBase installation. For the default installation, that path is:
%STREAMBASE_HOME%\jdk\bin\java.exe (Windows)
$STREAMBASE_HOME/jdk/bin/java (Linux)
- default configuration path
-
The path to the default configuration path used by StreamBase Studio. To find it, open Studio and click → (where
n.mis the StreamBase version number). In the About dialog, click . Look for the osgi.configuration.area field in the Configuration Details window.Example 1.
file:/C:/Documents and Settings/user/Application Data/StreamBase/StreamBase Studio
n.mConfiguration/ (Windows)file:/home/user/.streambase/streambase-studio-
n.m-configuration/ (UNIX)
-
Edit
sbstudio.iniat this location:-
(on Windows)streambase-install-dir\lib\studio -
(on UNIX)streambase-install-dir/lib/studio
-
-
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 bin\java.exe -configuration file:/C:/Documents and Settings/
sbuser/Application Data/StreamBase/StreamBase Studion.mConfiguration/ -
Add this line at the end of
sbstudio.ini:-Dosgi.parentClassloader=ext
