Results 1 to 5 of 5

Thread: How to import context file in a bundle?

  1. #1
    Join Date
    Jul 2006
    Posts
    126

    Default How to import context file in a bundle?

    Hi,

    I am working on Spring DM bundles. I have a core services bundle which has bean definitions for the core services. I have some dependent modules which are also bundles.

    How can I import the bean definition file in the context file for dependent bundles?

    I tried using the following.

    Code:
    <import resource="classpath:com.arisglobal.aglite.config.aglite-beans-config.xml" />
    However it didn't work. Is there anything wrong I am doing here?

    Please let me know of any pointers.

    Regards,
    Shashi

  2. #2
    Join Date
    Jul 2006
    Posts
    126

    Default

    Hi,

    Can somebody please reply if you have any pointers to this?

    Regards,
    Shashi

  3. #3
    Join Date
    Aug 2004
    Location
    France - Saint Nazaire
    Posts
    79

    Default

    Hi Shashi,

    I think that it isn't a good approach to try to import Spring XML configuration files from other bundles. As a matter of fact, with Spring DM, each bundle has its own embedded Spring container and, with OSGi, you need to handle dynamics.

    Keep also in mind that you won't be able to hide necessary classes to build beans if you try to import resources. The idea of OSGi is to provide only things you want and hide implementations...

    On the other side, you can make interact different beans between bundles thanks to the OSGi service registry. In fact, it's the only way to do that which takes the dynamic nature of OSGi into account.

    For instance, in bundle1, you can use:
    <osgi:service .../>
    and in bundle2, you can use:
    <osgi:reference .../>

    Hope it helps you,
    Thierry

  4. #4
    Join Date
    Jul 2006
    Posts
    126

    Default

    Hi Thierry,

    Thanks. I will keep that in mind.

    Regards,
    Shashi

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Adding to what Thierry said, if you do want to split your application across multiple bundles then either consider modularizing your app as well so that each bundle contains a runtime component. If that's not the case, the consider using fragments instead.
    The idea is to use the intended lifecycle granularity offered by OSGi - since each bundle has its own lifecycle, then it's entirely possible to uninstall a 'slave' bundle while the master one still runs which yields a lot of management problems.
    Of course, you can also try dm Server which nicely solves this for your (among numerous other things).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •