Java Reference
In-Depth Information
If these same libraries also work on Vista, you can specify this as follows:
Bundle-NativeCode: lib/math.dll; lib/md5.dll; osname=WindowsXP;
osname=WindowsVista; processor=x86
In cases where the parameter is repeated, the framework treats this like a logical OR
when matching, so these native libraries match Windows XP or Windows Vista.
If your bundle also has native libraries for Linux, you can specify that as follows:
Bundle-NativeCode: lib/math.dll; lib/md5.dll; osname=WindowsXP;
osname=WindowsVista; processor=x86, lib/libmath.so; osname=Linux;
osprocessor=x86
You separate different platforms using a comma instead of a semicolon. Notice also
that the native libraries don't need to be parallel. In this example, you have two native
libraries for the Windows platform but only one for Linux. This bundle is now usable
on Windows XP , Windows Vista, and Linux on the x86 architecture, but on any other
platform the framework won't resolve it.
In some cases, you may have either optional native libraries or a non-optimized
Java implementation for unsupported platforms. You can denote this using the
optional clause, like this:
Bundle-NativeCode: lib/math.dll; lib/md5.dll; osname=WindowsXP;
osname=WindowsVista; processor=x86, lib/libmath.so; osname=Linux;
osprocessor=x86, *
The * at the end acts as a separate platform clause that can match any platform, so this
bundle is usable on any platform.
The process of how native libraries are made available when the classes containing
native methods perform System.loadLibrary() is handled automatically by the
framework, so you don't need to worry about it. Even though it isn't often necessary,
it's fairly easy to use this mechanism to create bundles with native code.
That's it! You've now been introduced to many of the specialized features of the
OSG i module layer. Let's review what you've learned in this chapter.
5.6
Summary
You learned that the OSG i module layer provides many additional mechanisms to deal
with collaborative, dynamic, and legacy situations, such as the following:
A bundle may import a package it exports to make its export substitutable for
purposes of broadening collaboration among bundles.
Exported packages have bundle symbolic name and version attributes implicitly
attached to them, which can be useful if you need to import a package from a
specific bundle.
Exported packages may have mandatory attributes associated with them, which
must be specified by an importer for it to be wired to the exported package.
Search WWH ::




Custom Search