/** * Search for services. */ public <T> T searchService(ClassInfo type, IComponentIdentifier cid, String scope) { return searchService(type, cid, scope, false); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(IComponentIdentifier component, final ClassInfo type, final String scope, final IFilter<T> filter) { return SynchronizedServiceRegistry.getRegistry(component.getRoot()).searchService(type, component, scope, filter); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(IComponentIdentifier component, final Class<T> type, final String scope, final IFilter<T> filter) { return SynchronizedServiceRegistry.getRegistry(component.getRoot()).searchService(new ClassInfo(type), component, scope, filter); }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService0(final IInternalAccess component, final ClassInfo type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(type, component.getComponentIdentifier(), scope, filter); return proxy && ret!=null? createRequiredProxy(component, ret, type): ret; }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService0(final IInternalAccess component, final Class<T> type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(new ClassInfo(type), component.getComponentIdentifier(), scope, filter); return proxy && ret!=null? createRequiredProxy(component, ret, type): ret; }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final Class<T> type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(new ClassInfo(type), component.getComponentIdentifier(), scope, filter); if(ret==null) throw new ServiceNotFoundException(type.getName()); return proxy? createRequiredProxy(component, ret, type): ret; }
@Override public IFuture<Void> execute(IInternalAccess ia) { IAwarenessManagementService awa = SynchronizedServiceRegistry.getRegistry(ia) .searchService(new ClassInfo(IAwarenessManagementService.class), ia.getComponentIdentifier(), Binding.SCOPE_PLATFORM, true); if(awa!=null) { try { AwarenessInfo info = (AwarenessInfo)MapSendTask.decodeMessage(data, codecs, getClass().getClassLoader(), IErrorReporter.IGNORE); // System.out.println("Received awareness info: "+info); awa.addAwarenessInfo(info); } catch(Exception e) { ia.getLogger().info("Error receiving awareness info: "+SUtil.getExceptionStacktrace(e)); } } else { // No awa service -> ignore awa infos. } return IFuture.DONE; } });
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final Class<T> type, final IComponentIdentifier target, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(new ClassInfo(type), component.getComponentIdentifier(), RequiredServiceInfo.SCOPE_PLATFORM, new IFilter<T>() { public boolean filter(T obj) { return ((IService)obj).getServiceIdentifier().getProviderId().equals(target); } }); if(ret==null) throw new ServiceNotFoundException(type.getName()); return proxy? createRequiredProxy(component, ret, type): ret; }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final ClassInfo type, final String scope, final IFilter<T> filter, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(type, component.getComponentIdentifier(), scope, filter); if(ret==null) throw new ServiceNotFoundException(type.getTypeName()); return proxy? createRequiredProxy(component, ret, type): ret; }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final ClassInfo type, final IComponentIdentifier target, boolean proxy) { checkThreadAccess(component, proxy); T ret = SynchronizedServiceRegistry.getRegistry(component).searchService(type, component.getComponentIdentifier(), RequiredServiceInfo.SCOPE_PLATFORM, new IFilter<T>() { public boolean filter(T obj) { return ((IService)obj).getServiceIdentifier().getProviderId().equals(target); } }); if(ret==null) throw new ServiceNotFoundException(type.getTypeName()); return proxy? createRequiredProxy(component, ret, type): ret; }
SynchronizedServiceRegistry.getRegistry(component).searchService(new ClassInfo(type), component.getComponentIdentifier(), scope, filter) .addResultListener(new ComponentResultListener<T>(lis, component));
SynchronizedServiceRegistry.getRegistry(component).searchService(type, component.getComponentIdentifier(), scope, filter) .addResultListener(new ComponentResultListener<T>(lis, component));