An "aggregator" bundle is used to pull together the parts of a split package
and export the whole package. It uses Require-Bundle to pull in the pieces
and then exports the package without any attributes.

For example, suppose package com.foo is split across bundles A and B. Both A
and B use mandatory attributes on their export of com.foo to prevent
"accidentally" importing the partial package:

A => Export-Package: com.foo;foo.a=split;mandatory:="foo.a"
B => Export-Package: com.foo;foo.b=split;mandatory:="foo.b"

Now define an aggregator bundle G as follows:

Require-Bundle: A, B
Export-PackagE: com.foo

G gets both pieces of com.foo and then exports them without a mandatory
attribute. Now any other bundle that has "Import-Package: com.foo" without
any attributes will be wired to the export from G, i.e. the whole bundle.

Things are a little bit more complicated with the org.eclipse.ui.ide plugin,
since it actually requires org.eclipse.ui which in turn requires *and
re-exports* org.eclipse.ui.workbench. Yikes. Anyway I think you can replace
this simply with a bundle that requires org.eclipse.ui and exports
org.eclipse.ui. But please test this and let me know!

Regards
Neil

On Wed, Sep 8, 2010 at 11:55 AM, Wim Jongman <wim.jong...@gmail.com> wrote:

> Is adding the split attribute to the Import-Package really the best
>> solution? It assures that the importer gets only part of the package, and it
>> also makes a
>>
>
> No, I would suggest to fall back to importing the o.e.ui bundle.
>
>
>
>>  mess of the manifest. Surely it's better to ensure that an aggregating
>> bundle exists... then importers can simply import org.eclipse.ui without
>> even being aware of the split, and they will see the whole package.
>>
>> Can you elaborate on "aggregator"? What is this function exactly and how
> would this be implemented in OSGi terms. Could this be done in the existing
> o.e.ui bundle without breaking stuff?
>
>
>
>> Unfortunately the normal aggregating bundle in this particular case
>> appears to be "org.eclipse.ui.ide" which is unlikely to be appropriate for
>> an RCP application But it would not be difficult to create an alternative
>> aggregator that has no IDE gunk in it.
>>
>> Well put and good analysis. This was exactly my quest. o.e.ui.ide was
> imported but I wanted to get rid of that because of ui pollution.
>
>
> Note there is another split package in core Eclipse, but most RCP
>> developers don't even notice it. The "org.eclipse.core.runtime" package is
>> split across 2 bundles, "org.eclipse.equinox.registry" and
>> "org.eclipse.equinox.common". Those two bundles export it with mandatory
>> attributes, and the bundle "org.eclipse.core.runtime" aggregates and
>> re-exports without attributes. If we simply import the package without
>> attributes, we get the whole (i.e. aggregated) package, which is what we
>> want 99.99% of the time. The mandatory attributes are only used by importers
>> if they really, really want one of the partial exports. As mentioned, most
>> RCP developers don't have any problems with this split because they always
>> have the aggregator installed.
>>
>>
> Regards,
>
> Wim
>
>>
>>
>> On Wed, Sep 8, 2010 at 9:28 AM, Wim Jongman <wim.jong...@gmail.com>wrote:
>>
>>> Hi Simon and Thomas,
>>>
>>> Thanks for your help. After Thomas explained the problem I found a blog
>>> about split packages. To help future lost souls, it is here [1].
>>>
>>> Best regards,
>>>
>>> Wim
>>>
>>> [1]
>>> http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/
>>>
>>>
>>> On Wed, Sep 8, 2010 at 5:34 AM, Thomas Watson <tjwat...@us.ibm.com>wrote:
>>>
>>>>  If you look at the exports of the two packages from the org.eclipse.ui
>>>> bundle you will notice the following for the org.eclipse.ui and
>>>> org.eclipse.ui.part package exports:
>>>>
>>>> ui.workbench=split;mandatory:="ui.workbench"
>>>>
>>>> This indicates that the packages org.eclipse.ui and org.eclipse.ui.part
>>>> are split packages. The org.eclipse.ui bundle aggregates the parts of these
>>>> packages into "complete" packages. If you want to only import the "parts" 
>>>> of
>>>> these packages as exported by the org.eclipse.ui.workbench bundle then you
>>>> must specify the mandatory matching attribute ui.workbench=split attribute
>>>> on your import package statement:
>>>>
>>>> Import-Package: org.eclipse.ui; ui.workbench=split, org.eclipse.ui.part;
>>>> ui.workbench=split
>>>>
>>>> Hope that helps. You should ask eclipse specific questions in the
>>>> eclipse forums.
>>>>
>>>> Tom
>>>>
>>>>
>>>>
>>>> [image: Inactive hide details for Wim Jongman ---09/07/2010 01:28:08
>>>> PM---Hi, My bundle 231 is installed. If I do a diag on it it says]Wim
>>>> Jongman ---09/07/2010 01:28:08 PM---Hi, My bundle 231 is installed. If I do
>>>> a diag on it it says that it cannot resolve org.eclipse.ui and
>>>> org.eclipse.ui.part. How
>>>>
>>>>
>>>> From:
>>>> Wim Jongman <wim.jong...@gmail.com>
>>>> To:
>>>> OSGi Developer Mail List <osgi-dev@mail.osgi.org>
>>>> Date:
>>>> 09/07/2010 01:28 PM
>>>> Subject:
>>>> [osgi-dev] Resolution problem
>>>> ------------------------------
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> My bundle 231 is installed. If I do a diag on it it says that it cannot
>>>> resolve org.eclipse.ui and org.eclipse.ui.part. However, these two packages
>>>> are exported by org.eclipse.ui.workbench which is in my list (80). My other
>>>> bundles who also import the packages but now thru import bundle of
>>>> org.eclipse.ui which re-exports o.e.ui.workbench are fine.
>>>>
>>>> If I change 231 to import bundle instead of import package, all is fine.
>>>>
>>>> What am I missing here? Below is my relevant bundle list, the diag of
>>>> the unresolved bundle and an inquiry on the packages it says it cannot
>>>> resolve.
>>>>
>>>> Thanks for looking at this.
>>>>
>>>> Regards,
>>>>
>>>> Wim
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 80 ACTIVE      org.eclipse.ui.workbench_3.6.0.I20100603-1100
>>>> 231 INSTALLED   com.remainsoftware.gravity.core.ui_1.0.0.qualifier
>>>>
>>>> osgi> diag 231
>>>> reference:file:/C:/Users/jongw/Workspaces/Gravity/com.remainsoftware.gravity.core.ui/
>>>> [231]
>>>>   Direct constraints which are unresolved:
>>>>     Missing imported package org.eclipse.ui_0.0.0.
>>>>     Missing imported package org.eclipse.ui.part_0.0.0.
>>>>
>>>> osgi> packages org.eclipse.ui
>>>> org.eclipse.ui;
>>>> version="0.0.0"<org.eclipse.ui.workbench_3.6.0.I20100603-1100 [80]>
>>>>   com.remainsoftware.gravity.icons_1.0.0 [9] imports
>>>>   org.eclipse.gef_3.6.0.v20100525-1225 [65] imports
>>>>   org.eclipse.ui_3.6.0.I20100603-1100 [78] imports
>>>>   org.eclipse.ui.views.log_1.0.100.v20100423 [79] imports
>>>>   com.remainsoftware.gravity.application_1.0.0.qualifier [84] imports
>>>>   org.eclipse.ui.forms_3.5.0.v20100427 [213] imports
>>>>
>>>> osgi> packages org.eclipse.ui.part
>>>> org.eclipse.ui.part;
>>>> version="0.0.0"<org.eclipse.ui.workbench_3.6.0.I20100603-1100 [80]>
>>>>   com.remainsoftware.gravity.icons_1.0.0 [9] imports
>>>>   org.eclipse.gef_3.6.0.v20100525-1225 [65] imports
>>>>   org.eclipse.ui_3.6.0.I20100603-1100 [78] imports
>>>>   org.eclipse.ui.views.log_1.0.100.v20100423 [79] imports
>>>>   com.remainsoftware.gravity.application_1.0.0.qualifier [84] imports
>>>>   org.eclipse.ui.forms_3.5.0.v20100427 [213] imports
>>>>
>>>> osgi> _______________________________________________
>>>> OSGi Developer Mail List
>>>> osgi-dev@mail.osgi.org
>>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> OSGi Developer Mail List
>>>> osgi-dev@mail.osgi.org
>>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> OSGi Developer Mail List
>>> osgi-dev@mail.osgi.org
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>
>>
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>
>
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>

<<ecblank.gif>>

<<graycol.gif>>

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to