public void customResultAvailable(Object result) { Collection res = (Collection)result; if(res==null || res.size()==0) exceptionOccurred(new ServiceNotFoundException("No matching service found for: "+selector)); else super.customResultAvailable(res.iterator().next()); } });
public void customResultAvailable(Object result) { if(result!=null && !((Collection<?>)result).isEmpty()) { Object o = ((Collection<?>)result).iterator().next(); ret.setResult((T)o); } else { super.exceptionOccurred(new ServiceNotFoundException("No proxy for service found: "+cid+", "+service.getName())); } } });
public void customResultAvailable(Collection<IService> result) { // System.out.println("getServiceProxy end: "+cid+" "+service.getName()); if(result!=null && !((Collection<?>)result).isEmpty()) { Object o = ((Collection<?>)result).iterator().next(); ret.setResult((T)o); } else { super.exceptionOccurred(new ServiceNotFoundException("No proxy for service found: "+cid+", "+service.getName())); } }
public void finished() { // if(type.getName().indexOf("IRepositoryAccess")!=-1) // System.out.println("fin"); if(!ret.isDone()) { ret.setExceptionIfUndone(new ServiceNotFoundException(type.getName())); } }
public void customResultAvailable(Collection<IComponentFactory> facs) { facs = excludeMultiFactory(facs); if(facs!=null && facs.size()>0) { ret.setResult(facs.iterator().next()); } else { ret.setException(new ServiceNotFoundException(""+filter)); } } }));
public void customResultAvailable(Collection<T> result) { // System.out.println("getServiceProxy end: "+cid+" "+service.getName()); if(result!=null && !result.isEmpty()) { T o = result.iterator().next(); ret.setResult(o); } else { super.exceptionOccurred(new ServiceNotFoundException("No proxy for service found: "+cid+", "+service.getTypeName())); } }
public void customResultAvailable(Void result) { ret.setExceptionIfUndone(new ServiceNotFoundException(type.getTypeName())); } });
public void finished() { ret.setExceptionIfUndone(new ServiceNotFoundException(type.toString())); }
public void resultAvailable(Collection<IService> result) { // if(type.getName().indexOf("IRepositoryAccess")!=-1) // System.out.println("ra: "+result); Collection<IService> res = (Collection<IService>)result; if(res==null || res.size()==0) { // provider.getServices(getSearchManager(false, scope), getVisitDecider(true, scope), // new TypeResultSelector(type, true, RequiredServiceInfo.SCOPE_GLOBAL.equals(scope))) // .addResultListener(new DefaultResultListener() // { // public void resultAvailable(Object result) // { // System.out.println("rrr: "+result); // } // }); exceptionOccurred(new ServiceNotFoundException("No matching service found for type: "+type.getName()+" scope: "+scope)); } else { ret.setResult(res.iterator().next()); } }
public void resultAvailable(T result) { // If already had exception do nothing. // Cannot cause race conditions as the checker is called only if all tasks have been done. if(future.isDone()) return; // if(!binding.isDynamic()) DefaultServiceFetcher.this.result = future.getIntermediateResults(); if(future.getIntermediateResults().size()==0) { StoreIntermediateDelegationResultListener.this.exceptionOccurred(new ServiceNotFoundException("no results")); } else { StoreIntermediateDelegationResultListener.super.finished(); } } });
/** * 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; }
/** * 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 a required services. * @return The services. */ public <T> ITerminableIntermediateFuture<T> getRequiredServices(String name, boolean rebind, IAsyncFilter<T> filter) { // if(shutdowned) // return new TerminableIntermediateFuture<T>(new ComponentTerminatedException(id)); RequiredServiceInfo info = getRequiredServiceInfo(name); if(info==null) { TerminableIntermediateFuture<T> ret = new TerminableIntermediateFuture<T>(); ret.setException(new ServiceNotFoundException(name)); return ret; } else { RequiredServiceBinding binding = info.getDefaultBinding();//getRequiredServiceBinding(name); return getRequiredServices(info, binding, rebind, 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 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; }
/** * Get a required service. * @return The service. */ public <T> IFuture<T> getRequiredService(String name, boolean rebind, IAsyncFilter<T> filter) { // if(shutdowned) // return new Future<T>(new ComponentTerminatedException(id)); RequiredServiceInfo info = getRequiredServiceInfo(name); if(info==null) { Future<T> ret = new Future<T>(); ret.setException(new ServiceNotFoundException(name+" in: "+getComponent().getComponentIdentifier())); return ret; } else { RequiredServiceBinding binding = info.getDefaultBinding();//getRequiredServiceBinding(name); return getRequiredService(info, binding, rebind, filter); } }
/** * Get a required service. * @return The service. */ public <T> IFuture<T> getRequiredService(String name, boolean rebind, IRemoteFilter<T> filter) { if(shutdowned) return new Future<T>(new ComponentTerminatedException(id)); RequiredServiceInfo info = getRequiredServiceInfo(name); if(info==null) { Future<T> ret = new Future<T>(); ret.setException(new ServiceNotFoundException(name)); return ret; } else { RequiredServiceBinding binding = info.getDefaultBinding();//getRequiredServiceBinding(name); return getRequiredService(info, binding, rebind, filter); } }
/** * Get a required services. * @return The services. */ public <T> ITerminableIntermediateFuture<T> getRequiredServices(String name, boolean rebind, IRemoteFilter<T> filter) { if(shutdowned) return new TerminableIntermediateFuture<T>(new ComponentTerminatedException(id)); RequiredServiceInfo info = getRequiredServiceInfo(name); if(info==null) { TerminableIntermediateFuture<T> ret = new TerminableIntermediateFuture<T>(); ret.setException(new ServiceNotFoundException(name)); return ret; } else { RequiredServiceBinding binding = info.getDefaultBinding();//getRequiredServiceBinding(name); return getRequiredServices(info, binding, rebind, filter); } }
ret.setException(new ServiceNotFoundException(""+type));
ret.setException(new ServiceNotFoundException(""+type));