- static val log = LoggerFactory.getLogger(OsgiConsumerContext)
- protected val BundleContext bundleContext;
- protected val BindingAwareBrokerImpl broker;
-
- new(BundleContext ctx,BindingAwareBrokerImpl broker) {
- this.bundleContext = ctx;
- this.broker = broker;
- }
-
-
- override def <T extends BindingAwareService> getSALService(Class<T> service) {
- // SAL Services are global
- var ref = bundleContext.getServiceReference(service);
- return bundleContext.getService(ref) as T;
- }
-
-
-
- override def <T extends RpcService> T getRpcService(Class<T> module) {
- try {
-
- val services = bundleContext.getServiceReferences(module, getProxyFilter());
-
- // Proxy service found / using first implementation
- // FIXME: Add advanced logic to retrieve service with right set of models
- if(false == services.empty) {
- val ref = services.iterator().next() as ServiceReference<T>;
- return bundleContext.getService(ref) as T;
- }
- } catch (InvalidSyntaxException e) {
- log.error("Created filter was invalid:", e.message,e)
- }
- return null;
-
-
- }
-
- private def getProxyFilter() {
- return '''(«Constants.SAL_SERVICE_TYPE»=«Constants.SAL_SERVICE_TYPE_CONSUMER_PROXY»)'''
- }
+ static val log = LoggerFactory.getLogger(OsgiConsumerContext)
+ protected val BundleContext bundleContext;
+ protected val BindingAwareBrokerImpl broker;
+
+ new(BundleContext ctx, BindingAwareBrokerImpl broker) {
+ this.bundleContext = ctx;
+ this.broker = broker;
+ }
+
+ override def <T extends BindingAwareService> getSALService(Class<T> service) {
+
+ // SAL Services are global
+ var ref = bundleContext.getServiceReference(service);
+ return bundleContext.getService(ref) as T;
+ }
+
+ override def <T extends RpcService> T getRpcService(Class<T> module) {
+ try {
+
+ val services = bundleContext.getServiceReferences(module, getProxyFilter());
+
+ // Proxy service found / using first implementation
+ // FIXME: Add advanced logic to retrieve service with right set of models
+ if (false == services.empty) {
+ val ref = services.iterator().next() as ServiceReference<T>;
+ return bundleContext.getService(ref) as T;
+ }
+ } catch (InvalidSyntaxException e) {
+ log.error("Created filter was invalid:", e.message, e)
+ }
+ return null;
+
+ }
+
+ private def getProxyFilter() {
+ return '''(«SAL_SERVICE_TYPE»=«SAL_SERVICE_TYPE_CONSUMER_PROXY»)'''
+ }