I'm learning OSGi and I'm curious about the following situation:
I want to change (extend mostly) an interface exposed by OSGi, without changing the classname. Is it possible make a bundle that "translates" the old interface to the new.
Below is an example, I hope it is clear enough, just by making use of a few manifest headers. Suppose I have these OSGI bundles:
Bundle-Name: Example Iface1 Implementation
Import-Package: org.osgi.framework
Export-Package: example.interfaces;version="1.0"
Bundle-Name: Example Iface1 User
Import-Package: org.osgi.framework, example.interfaces;version="1.0"
But then I need to update the exposed interface(s). The interface classnames stay the same, but there is functionality added to them. So I create:
Bundle-Name: Example Iface2 Implementation
Import-Package: org.osgi.framework
Export-Package: example.interfaces;version="2.0"
Can I make a bunlde like this to translate the new interface to the old for bundles that need it?
Bundle-Name: Interface Translator
Import-Package: org.osgi.framework, example.interfaces;version="2.0"
Export-Package: example.interfaces;version="1.0"
Because in this case I have no idea how to do the imports in java...
Or is there a much better way to do deal with this situation in OSGi?