aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: Call OSGi services programmatically
Date Thu, 17 Nov 2011 07:17:39 GMT
Hi

You might want to consider the Apache Felix DependencyManager [1]

This of course has nothing to do with OSGi Blueprint or Spring/DM. It is just a programmatic
front-end to simplify servie registration and DI.

Regards
Felix

[1]  http://felix.apache.org/site/apache-felix-dependency-manager.html

Am 16.11.2011 um 15:18 schrieb Martin Lichtin:

Hi

With SpringDM/Gemini it is possible to call a service programmatically like this:

 Class<ValueProcessor> cls = ValueProcessor.class;
 OsgiServiceProxyFactoryBean factoryBean = new OsgiServiceProxyFactoryBean();
 factoryBean.setBundleContext(bundleContext);
 factoryBean.setInterfaces(new Class[] { cls });
 factoryBean.setFilter(filter);
 factoryBean.setContextClassLoader(ImportContextClassLoader.CLIENT);
 factoryBean.setBeanClassLoader(cls.getClassLoader());
 factoryBean.afterPropertiesSet();
 ValueProcessor valueProcessor = (ValueProcessor) factoryBean.getObject();

How can one create the proxy instance of the service with Aries?

Martin



Mime
View raw message