Announcement Announcement Module
Collapse
No announcement yet.
Where is the documentation about "import-scope:=application"? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where is the documentation about "import-scope:=application"?

    I got my Web application deployed in SpringSource dm Server successfully.

    There are 4 bundles:
    • domain - domain entity, value object and repository interface.
    • repository - repository implementation by JPA and Hibernate.
    • service - application service layer with transaction management.
    • web - web front end using spring mvc.

    My repository bundle will export repository service, and service bundle will consume it, but only import domain package (with repository interface in it), and no dependency on Hibernate bundle. So only repository bundle will import Hibernate bundle.

    In order to get it work, I have to put all bundles into a par and add "import-scope:=application" to Import-Bundle of Hibernate in repository bundle manifest.

    So far I can only find Rob Harrop mentioned it in his blog Using EclipseLink on the SpringSource Application Platform:

    "S2AP supports the notion of Import Scopes. When using Import-Bundle inside an application, you can define that the scope of the import is the application. This will cause the import to be added to all the other modules in the application dynamically. This allows you to get the dependencies you need to make your application run, but without having to make changes to your application that might limit its flexibility."

    My understanding is that SpringSource dm Server will use this directive to import Hibernate bundle to all bundles that inside the same par.

    From this blog discussion SpringSource Application Platform + Bundle Repository, I got the impression that "Import-Bundle" or "Import-Library" are just syntactic sugar, and "uses these headers can be easily converted into one that uses only Import-Package with no change in semantics."

    Seems we have more flavor now. I'd like to see any formal documentation about this directive, and if there are more coming.

    My next step is to use Apache Felix Maven Bundle Plugin to auto generate manifest file for bundles, and I'm stuck with this "import-scope". Not sure how to handle application scope issue with Import-Package.

    Appreciate if someone can give me a hint.

  • #2
    import-scope:=application went into dm Server v1 fairly late in the day and never made it into the Programmer's Guide. I raised a JIRA to track the omission, although given there is a blog describing the function, it's not the highest priority.

    Thanks for pointing this out however. :-)

    As for futures, we are planning on becoming more 'open' in the next few weeks, so please watch this space. ;-)

    Comment


    • #3
      Originally posted by yuanji View Post
      My next step is to use Apache Felix Maven Bundle Plugin to auto generate manifest file for bundles, and I'm stuck with this "import-scope". Not sure how to handle application scope issue with Import-Package.

      Appreciate if someone can give me a hint.
      In order to achieve the same effect of using "import-scope:=application" with Import-Bundle for Hibernate, you will need to manually add all packages exported by the Hibernate bundle to the Import-Package header of all of the bundles within your PAR.

      HTH,

      Sam

      Comment


      • #4
        Originally posted by Sam Brannen View Post
        In order to achieve the same effect of using "import-scope:=application" with Import-Bundle for Hibernate, you will need to manually add all packages exported by the Hibernate bundle to the Import-Package header of all of the bundles within your PAR.

        HTH,

        Sam
        That's exactly what I'm going to do. Thanks for confirming that

        Comment


        • #5
          Originally posted by Glyn Normington View Post
          As for futures, we are planning on becoming more 'open' in the next few weeks, so please watch this space. ;-)
          Very glad to hear that and hope you can blog more about it.

          Want to say thanks to Spring Team for your contribution to Java community!

          Yuan

          Comment


          • #6
            Thanks!

            Please note that importing all the packages exported by a particular version of Hibernate is not particularly future-proof as Hibernate tends to change its packages over time. You'll have to repeat some steps when moving up to the next version of Hibernate.

            Alternatively, at the cost of some dual maintenance, you could code MANIFEST.MF and your pom.xml so you can keep using import-bundle. The choice is yours. ;-)

            Please note that we are planning to improve the area of build in a future release, although the ideal solution for your scenario, of deriving Maven dependencies from MANIFEST.MF, looks like it will need to build on Maven 3.

            Comment

            Working...
            X