/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); Collection<T> ret = SynchronizedServiceRegistry.getRegistry(component).searchServices(type, component.getComponentIdentifier(), scope, filter); // Fixing the bug by changing createRequiredProxy -> createRequiredProxies leads to not compiling the main class return proxy? createRequiredProxies(component, ret, type): ret; }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); Collection<T> ret = SynchronizedServiceRegistry.getRegistry(component).searchServices(new ClassInfo(type), component.getComponentIdentifier(), scope, filter); // Fixing the bug by changing createRequiredProxy -> createRequiredProxies leads to not compiling the main class return proxy? createRequiredProxies(component, ret, type): ret; }
public void customResultAvailable(Void result) { if(!RequiredServiceInfo.SCOPE_GLOBAL.equals(scope)) { if(filter==null) { Collection<T> sers = SynchronizedServiceRegistry.getRegistry(component).searchServices(new ClassInfo(type), cid, scope); if(proxy) sers = createRequiredProxies(component, sers, type); ret.setResult(sers==null? Collections.EMPTY_SET: sers); } else { IIntermediateResultListener<T> lis = proxy? new IntermediateProxyResultListener<T>(ret, component, type): new IntermediateDelegationResultListener<T>(ret); SynchronizedServiceRegistry.getRegistry(component).searchServices(new ClassInfo(type), cid, scope, filter) .addResultListener(new IntermediateComponentResultListener<T>(lis, component)); } } else { IIntermediateResultListener<T> lis = proxy? new IntermediateProxyResultListener<T>(ret, component, type): new IntermediateDelegationResultListener<T>(ret); ISubscriptionIntermediateFuture<T> fut = SynchronizedServiceRegistry.getRegistry(component).searchGlobalServices(new ClassInfo(type), cid, filter); fut.addResultListener(new IntermediateComponentResultListener<T>(lis, component)); } } });
public void customResultAvailable(Void result) { if(!RequiredServiceInfo.SCOPE_GLOBAL.equals(scope)) { if(filter==null) { Collection<T> sers = SynchronizedServiceRegistry.getRegistry(component).searchServices(type, component.getComponentIdentifier(), scope); if(proxy) sers = createRequiredProxies(component, sers, type); ret.setResult(sers==null? Collections.EMPTY_SET: sers); } else { IIntermediateResultListener<T> lis = proxy? new IntermediateProxyResultListener<T>(ret, component, type.getType(component.getClassLoader())): new IntermediateDelegationResultListener<T>(ret); SynchronizedServiceRegistry.getRegistry(component).searchServices(type, component.getComponentIdentifier(), scope, filter) .addResultListener(new IntermediateComponentResultListener<T>(lis, component)); } } else { IIntermediateResultListener<T> lis = proxy? new IntermediateProxyResultListener<T>(ret, component, type.getType(component.getClassLoader())): new IntermediateDelegationResultListener<T>(ret); ISubscriptionIntermediateFuture<T> fut = SynchronizedServiceRegistry.getRegistry(component).searchGlobalServices(type, component.getComponentIdentifier(), filter); fut.addResultListener(new IntermediateComponentResultListener<T>(lis, component)); } } });