Hi, I have an application to migrate from ServiceMix3 to ServiceMix4.
I had never used OSGi before. During development, I have used or invented my own patterns with OSGi blueprint service/reference. Can you tell me if I have done something wrong or have used an anti-pattern ? My five patterns : *A) Classic service* It's the pattern in OSGi specification. - One bundle with an interface (api) - One bundle with the implementation of the interface and the declaration of the service (impl) - One bundle with reference to the interface (client) *B) Configuration* - One bundle with a dummy interface but with specific properties - One bundle who dynamically retrieve the properties from interface for configuration purpose. Example : I know that configuration should to be in a properties file, but service properties is greater, we can have beans, list, map, etc... as values. *C) Cached Factory* - One bundle with objects I want to expose to another(s) bundle(s). But these objects don't have a suitable interface and I can't modify them. - One bundle with the retrieve of the cached object : *D) Dynamic Factory* The same purpose of Cached Factory, but I wanted to have a new instance of my object for each call of init method. For doing this, I have used scope=prototype, <idref>, and BlueprintContainer.getComponentInstance : - In my provider bundle : - In my consumer bundle : *E) Explicit dependency* Ok, this is not great... but for development I have used OBR for deploying by bundles in SMX 4.4.2. OBR knows only the dependencies in repository.xml, so all my dynamically linked bundles are not deployed when I start the client bundle. I have added a dummy service for create a explicit link between two bundle... in production, this will be removed and we will make a clean features.xml file. - One bundle with declaration of dynamically retrieved services, and a dummy service for the explicit dependency - One bundle with the explicit dependency to my first bundle : -- View this message in context: http://karaf.922171.n3.nabble.com/Patterns-of-OSGi-Blueprint-service-reference-tp4028478.html Sent from the Karaf - User mailing list archive at Nabble.com.
