Bug 368829 - [R5] Represent required execution environment as required capability in osgi.ee namespace
Summary: [R5] Represent required execution environment as required capability in osgi....
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: Juno M5   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-17 09:35 EST by Thomas Watson CLA
Modified: 2012-01-18 16:01 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2012-01-17 09:35:39 EST
For R5 the framework will convert the Bundle-RequiredExecutionEnvironment (BREE) header into a
Require-Capability in the osgi.ee namespace using the following rules:

Assuming the following general format for a BREE element value:

BREE ::= N1 ['-' V] [ '/' N2 [ '-' V ] ]

Where N1 and N2 contain no '-' or '/' and V can be parsed into a valid Version
and if multiple versions are specified they are identical.  For example:

CDC-1.0/Foundation-1.0
OSGi/Minimum-1.2

Each BREE element gets converted into an equivalent osgi.ee Require-Capability
filter with the following conversion:

  filter ::= '(&(osgi.ee=' E1 '/' E2 ') [ '(version=' V ')' ] ')'

Where E1 and E2 are simply N1 and N2 respectively except for the special case
where N1 or N2 are 'J2SE'.  In that case the J2SE value becomes JavaSE.  If the
BREE element cannot be parsed into E1, E2 and V then the filter simply looks
like this:

  filter ::= '(osgi.ee=' X ')'

Where X is the BREE element as is.  Here are some examples:

CDC-1.0/Foundation-1.0 == (&(osgi.ee=CDC/Foundation)(version=1.0))
OSGi/Minimum-1.2 == (&(osgi.ee=OSGi/Minimum)(version=1.2))
J2SE-1.4 == (&(osgi.ee=JavaSE)(version=1.4))
JavaSE-1.6 == (&(osgi.ee=JavaSE)(version=1.6))
AA/BB-1.7 == (&(osgi.ee=AA/BB)(version=1.7))
V1-1.5/V2-1.6 == (osgi.ee=V1-1.5/V2-1.6)
MyEE-junkVersion == (osgi.ee=MyEE-junkVersion)

Each element of the BREE is or'ed together in the final osgi.ee filter, for
example:

Bundle-RequiredExecutionEnvironment: 
 CDC-1.0/Foundation-1.0,
 OSGi/Minimum-1.2,
 J2SE-1.4,
 JavaSE-1.6,
 AA/BB-1.7,
 V1-1.5/V2-1.6,
 MyEE-junkVersion

This is converted into the following Require-Capability:

Require-Capability:
 osgi.ee;
   filter:="(|
              (&(osgi.ee=CDC/Foundation)(version=1.0))
              (&(osgi.ee=OSGi/Minimum)(version=1.2))
              (&(osgi.ee=JavaSE)(version=1.4))
              (&(osgi.ee=JavaSE)(version=1.6))
              (&(osgi.ee=AA/BB)(version=1.7))
              (osgi.ee=V1-1.5/V2-1.6)
              (osgi.ee=MyEE-junkVersion)
           )"


Every org.osgi.framework.resource.Resource representing a bundle which has a
BREE header will have the converted osgi.ee requirement in the list returned by
Resource.getRequirements(String) for the osgi.ee namespace.  In cases where the
bundle already has a requirement for the osgi.ee namespace no merging is done,
the bundle will simply have an additional osgi.ee requirement added.
Comment 1 Thomas Watson CLA 2012-01-17 09:36:09 EST
Going to look at doing this for M5.
Comment 2 Thomas Watson CLA 2012-01-18 16:01:08 EST
I released a fix in the following commit:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=1adfd1b247f8446241bd426923dacb428c59d539