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.