if I develop modules with the OSGi framework (bundles), can I integrate 开发者_如何学运维them in any OSGI based application such as Spring, right?
On what do I have to take care? What about the context or different data model?
You could ask the same thing for programming languages: if you develop something in Java, will you be able to integrate it in every Java based framework? The answer is: it depends.
- If you mean by integrate "develop functionality once and deploy it without changes in all applications", you're out of luck. Although OSGi is standardized, you should see the modules and services you develop as low-level constructs: any application framework, such as Spring, builds upon the low-level constructs in its own way.
- If, on the other hand you mean "deploy them and start using them from your own code", yes, you can generally mix & match bundles and services in any way you like, provided that you are willing to write some 'glue code'.
In general, yes, you can take your bundle, and integrate, but it's not free. It will, probably, make it easier to integrate your functionality if you package it up nicely in a bundle.
In theory, yes. You'll have to take care if the target OSGi application is a different version of the OSGi spec (3, 4, 4.2, etc). You'll have to watch out if you're using an platform specific API as well.
精彩评论