use of io.joynr.jeeintegration.api.ProviderQosFactory in project joynr by bmwcarit.
the class JoynrIntegrationBean method registerProviders.
private void registerProviders(Set<Bean<?>> serviceProviderBeans, JoynrRuntime runtime) {
Set<ProviderQosFactory> providerQosFactories = getProviderQosFactories();
for (Bean<?> bean : serviceProviderBeans) {
Class<?> beanClass = bean.getBeanClass();
ServiceProvider providerService = beanClass.getAnnotation(ServiceProvider.class);
Class<?> serviceInterface = serviceProviderDiscovery.getProviderInterfaceFor(providerService.serviceInterface());
if (LOG.isDebugEnabled()) {
LOG.debug(format("Registering %s as provider with joynr runtime for service interface %s.", bean, serviceInterface));
}
Object provider = Proxy.newProxyInstance(beanClass.getClassLoader(), new Class<?>[] { serviceInterface }, new ProviderWrapper(bean, beanManager, joynrRuntimeFactory.getInjector()));
ProviderQos providerQos = null;
for (ProviderQosFactory factory : providerQosFactories) {
if (factory.providesFor(serviceInterface)) {
providerQos = factory.create();
break;
}
}
if (providerQos == null) {
providerQos = new ProviderQos();
}
runtime.registerProvider(getDomainForProvider(beanClass), provider, providerQos);
registeredProviders.add(provider);
}
}
use of io.joynr.jeeintegration.api.ProviderQosFactory in project joynr by bmwcarit.
the class JoynrIntegrationBean method getProviderQosFactories.
@SuppressWarnings({ "rawtypes", "unchecked", "serial" })
private Set<ProviderQosFactory> getProviderQosFactories() {
Set<Bean<?>> providerQosFactoryBeans = beanManager.getBeans(ProviderQosFactory.class, new AnnotationLiteral<Any>() {
});
Set<ProviderQosFactory> providerQosFactories = new HashSet<>();
for (Bean providerQosFactoryBean : providerQosFactoryBeans) {
ProviderQosFactory factory = (ProviderQosFactory) providerQosFactoryBean.create(beanManager.createCreationalContext(providerQosFactoryBean));
providerQosFactories.add(factory);
}
return providerQosFactories;
}
Aggregations