SpringSource dmServer is very nice piece of equipment. One of the major additions to the OSGi arsenal is concept of plans. Plans are deployment descriptors that allow for composition of application assemblies and provided added capabilities like scoping. You can think of scoped plan as a pseudo bundle that shades all included artifacts and creates a concept of a nested classloader. Very similar to jee concept of nesting wars and ejb-jars in ear. This is very useful addition that allows normal use of ORM libraries like hibernate that use TCCL (thread context class loader) and expect all classes to be found by classpath scanning. Scoping also hides services published within a scoped plan. No service gets out from a scope into a global service registry.
This is all nice and dandy, but what if you do want to "jail break" a service from a plan? Well there is a very simple way to do it. As
Glyn describes in
this thread on SpringSource dmServer forums, it's as simple as adding a service property.
Example:
<service id="publishIntoGlobal" interface="java.lang.CharSequence">
<service-properties>
<beans:entry key="com.springsource.service.scope" value="global" />
</service-properties>
<beans:bean class="java.lang.String">
<beans:constructor-arg value="foo"/>
</beans:bean>
</service>