Properly configuring the SPI-Fly integration should result in a set of
requirement and capabilities on the target bundles causing them to have a
resolution time requirement which should force the weaving to affect them
in the correct order.

For instance, if you have API bundle X that requires bundle Z providing an
impl via service loader:

- Bundle Z(provider) should have
    a) a *requirement* on a service mediator registrar
    b) a *capability* for the service mediator provider for the API in
question
    c) after weaving (which must occur due to a), have published Z's impl
into the service registry

- Bundle X(api) should have
    a) a *requirement* for the service mediator processor
    b) a *requirement* on service mediator provider for the API in question
    c) after weaving (which must occur due to a), have OSGi service
registry code for obtaining the impl

when properly done neither of X or Y could reach "ACTIVE" or even "RESOLVE"
state unless the service mediator (Spi-Fly) has done it's job of weaving.

See the notes at http://aries.apache.org/modules/spi-fly.html

Sincerely,
- Ray


On Mon, Dec 5, 2016 at 1:56 PM, BJ Hargrave <hargr...@us.ibm.com> wrote:

> I am not aware of any support in -runbundles to set start levels for
> bundle. But the bnd launcher should start the bundle in the order they are
> specified on the -runbundles instruction. Did you try putting those bundles
> first that need to be started first?
>
> --
>
> BJ Hargrave
> Senior Technical Staff Member, IBM // office: +1 386 848 1781
> <(386)%20848-1781>
> OSGi Fellow and CTO of the OSGi Alliance // mobile: +1 386 848 3788
> <(386)%20848-3788>
> hargr...@us.ibm.com
>
>
>
> ----- Original message -----
> From: Elliot Huntington <elliot.hunting...@gmail.com>
> Sent by: osgi-dev-boun...@mail.osgi.org
> To: OSGi Developer Mail List <osgi-dev@mail.osgi.org>
> Cc:
> Subject: [osgi-dev] Strange issue with enRoute and Aries SPI Fly.
> Date: Mon, Dec 5, 2016 1:35 PM
>
> The motivation for this thread is that I am experimenting with an OSGi
> enRoute project that uses the Apache Aries SPI-Fly dynamic weaving
> libraries to play an MP3 file. The example project is on github at:
> https://github.com/axiopisty/com.github.axiopisty.plarpebu. This project
> has 5 enRoute modules:
>
>    - JavaFX API
>    - JavaFX API Provider
>    - Media Player API
>    - Media Player API Provider
>    - Application
>
> What I have noticed is that when I use 'osgi.enroute.debug.api' I can use
> the debug commands in the gogo shell to successfully load, play, pause, and
> stop the media player. The application will successfully play an MP3 file.
> However, when using the GUI to 'load' the MP3 file an exception occurs that
> indicates something is not working right with the SPI Fly dynamic weaving
> integration. I have not been able to figure out why the 'load' operation
> works successfully when using the gogo shell, but does not work when called
> from the GUI. I'm wondering if it might have something to do with the
> bundle start levels because according to the SPI Fly documentation, "any
> OSGi Bundle that uses the OSGi 4.3 WeavingHooks, the weaver bundle
> (org.apache.aries.spifly.dynamic.bundle) needs to be active before any
> bundles that need to be dynamically woven. OSGi start levels can provide a
> mechanism to control this."
>
> My suspicion is that because the JavaFX provider is a DS component with
> scope SINGLETON and immediate = true, that this bundle is activated before
> the dynamic weaving bundle in the runtime, which is probably causing the
> problem described.
> So my question is, when using bnd, is there some directive or syntax that
> can be used with the -runbundles directive that indicates the bundle start
> level?
>
> I would greatly appreciate your help figuring out why the media player
> service I created in this example works successfully from the gogo shell,
> but not from the gui, all within the same runtime application.
>
> Sincerely,
> Elliot
>
>
> _______________________________________________
> 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
>



-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to