Announcement Announcement Module
Collapse
No announcement yet.
Using OsgiServiceProxyFactoryBean to create proxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using OsgiServiceProxyFactoryBean to create proxy

    I have a usecase where i cannot use osgi:ref or osgi:list to reference a service , because when the proxy is created it creates on the generic interface given, which that particular bundle can see.

    To get away with this usecase , we plan to create proxies using API's.

    http://static.springsource.org/osgi/...orter/support/OsgiServiceProxyFactoryBean.html

    Code:
    OsgiServiceProxyFactoryBean proxy = new OsgiServiceProxyFactoryBean();
    proxy.setBundleContext(bundle.getBundleContext());
    proxy.setBeanClassLoader(cls.getClassLoader());
    proxy.setInterfaces(new Class[] {cls});
    proxy.afterPropertiesSet();

    proxy.setInterfaces - allows that proxies can be created around interface I give here. which is not possible with osgi:list because the interface was not visible to this bundle.

    Now my api can see the interface because i use context-class-loader="service-provider" in the service provider , and i set this during creation of proxy.

    Is there any other way out by which declarativly i can ask osgi:ref or osgi:list to use TCCL to use this knowledge while creating a proxy .


    Just setting context-class-loader on osgi-ref or osgi:list doesnt solve my problem because the proxy is automatically created by spring and i have no control on this. :-(

  • #2
    To help I would need to understand the usecase as the workaround looks like it might cause more problems than it will solve (e.g. since dm Server needs to set the TCCLs for scoped plans and PARs).

    Comment

    Working...
    X