Java Reference
In-Depth Information
5.5.1
Requiring execution environments
If you develop a bundle with a dependency on specific Java execution environments,
what happens if this bundle executes in an unintended environment? Most likely,
you'll get various exceptions for missing classes or methods and/or faulty results. If
you have a bundle with specific execution environment requirements, you must
explicitly declare these requirements to avoid people unknowingly trying to use your
bundle in invalid environments. The OSG i specification defines an execution environ-
ment concept for just this purpose. Like all bundle metadata, you use a manifest
header to define it. In this case, it's a manifest header with a long name: Bundle-
RequiredExecutionEnvironment .
BUNDLE-REQUIREDEXECUTIONENVIRONMENT This header specifies a comma-
delimited list of supported execution environments.
The OSG i specification defines standard values for the common execution environ-
ments; table 5.1 lists them.
Table 5.1
OSGi defined standard execution environment names
Name
Description
Equivalent to J2ME Foundation Profile
CDC-1.1/Foundation-1.1
CDC-1.1/PersonalBasis-1.1
J2ME Personal Basis Profile
J2ME Personal Java Profile
CDC-1.1/PersonalJava-1.1
J2SE-1.2
Java 2 SE 1.2.x
Java 2 SE 1.3.x
J2SE-1.3
Java 2 SE 1.4.x
J2SE-1.4
J2SE-1.5
Java 2 SE 1.5.x
Java SE 1.6.x
JavaSE-1.6
OSGi/Minimum-1.2
Minimal required set of Java API that allows
an OSGi framework implementation
Bundles should list all known execution environments on which they can run, which
may look something like this:
Bundle-RequiredExecutionEnvironment: J2SE-1.4,J2SE-1.5,JavaSE-1.6
This specific example indicates that the bundle runs only on modern Java platforms.
If a bundle lists a limited execution environment, such as CDC-1.1/Foundation-1.1 , it
shouldn't use classes or methods that don't exist in the declared execution environ-
ment. The framework doesn't verify this claim; it only ensures that the bundle isn't
resolvable on incompatible execution environments.
 
Search WWH ::




Custom Search