protected void error_InjectMethodIsNotVoid(Method method) { throw new MultiException(new IllegalStateException("Injection failed on " + method.getName() + " : setter method is not declared with a void return type")); }
@Override public Class<?> loadClass(final String className) throws MultiException { try { return loader.loadClass(className); } catch (Exception ex) { throw new MultiException(ex); } } }
/** * Initializes the component by performing injection. * * @param component component instance to inject * @param onBehalfOf the inhabitant to do injection on behalf of * @param es the ExecutorService to use in order to handle the work load * @param targets the injection resolvers to resolve all injection points * @throws ComponentException * if injection failed for some reason. */ public void inject(Object component, ExecutorService es, InjectionResolver... targets) { try { syncDoInject(component, component.getClass(), targets); /*if (null == es) { syncDoInject(component, component.getClass(), targets); } else { syncDoInject(component, component.getClass(), targets); // syncDoInject(new InjectContext(component, onBehalfOf, component.getClass(), es, targets)); }*/ } catch (Exception e) { // we do this to bolster debugging if (e instanceof MultiException) { throw (MultiException) e; } throw new MultiException(e); } }
protected void error_injectionException(InjectionResolver target, Annotation inject, AnnotatedElement injectionPoint, Throwable e) { Logger.getAnonymousLogger().log(Level.FINE, "** Injection failure **", e); if (UnsatisfiedDependencyException.class.isInstance(e)) { if (injectionPoint == ((UnsatisfiedDependencyException)e).getUnsatisfiedElement()) { // no need to wrap again throw (UnsatisfiedDependencyException)e; } if (target.isOptional(injectionPoint, inject)) { return; } else { throw new UnsatisfiedDependencyException(injectionPoint, inject, e); } } if (null != e.getCause() && InvocationTargetException.class.isInstance(e)) { e = e.getCause(); } throw new MultiException(e); }
@Override public Class<?> loadClass(String className) throws MultiException { try { return binderClassLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MultiException(e); } } };
@Override public Class<?> loadClass(String className) throws MultiException { try { return binderClassLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MultiException(e); } } });
@Override public Class<?> loadClass(String className) throws MultiException { try { return loader.loadClass(className); } catch (Exception e) { throw new MultiException(e); } }
@Override public Class<?> loadClass(String className) throws MultiException { try { return binderClassLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MultiException(e); } } };
@Override public Class<?> loadClass(String className) throws MultiException { try { return binderClassLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new MultiException(e); } } });
/** * This method will throw if the list of throwables associated with this * collector is not empty * * @throws MultiException An exception with all the throwables found in this collector */ public void throwIfErrors() throws MultiException { if (throwables == null || throwables.isEmpty()) return; throw new MultiException(new LinkedList<Throwable>(throwables)); }
@Override public void dispose(T instance) { try { preDestroyMe(instance); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@SuppressWarnings("unchecked") private ServiceHandle<Factory<T>> getFactoryHandle() { try { return (ServiceHandle<Factory<T>>) locator.getServiceHandle(factoryDescriptor); } catch (Throwable th) { throw new MultiException(th); } }
@Override public void populateConfig(ServiceLocator serviceLocator) { try { HK2Populator.populateConfig(serviceLocator); } catch (BootException be) { throw new MultiException(be); } }
@SuppressWarnings("unchecked") private ServiceHandle<Factory<T>> getFactoryHandle() { try { return (ServiceHandle<Factory<T>>) locator.getServiceHandle(factoryDescriptor); } catch (Throwable th) { throw new MultiException(th); } }
@Override public void dispose(T instance) { try { preDestroyMe(instance); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@SuppressWarnings("unchecked") private ServiceHandle<Factory<T>> getFactoryHandle() { try { return (ServiceHandle<Factory<T>>) locator.getServiceHandle(factoryDescriptor); } catch (Throwable th) { throw new MultiException(th); } }
@Override public void dispose(T instance) { try { preDestroyMe(instance); } catch (Throwable th) { if (th instanceof MultiException) { throw (MultiException) th; } throw new MultiException(th); } }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { ActiveDescriptor<?> ad = locator.getInjecteeDescriptor(injectee); if (ad == null) { if (injectee.isOptional()) return null; throw new MultiException(new UnsatisfiedDependencyException(injectee)); } return locator.getService(ad, root, injectee); }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { ActiveDescriptor<?> ad = locator.getInjecteeDescriptor(injectee); if (ad == null) { if (injectee.isOptional()) return null; throw new MultiException(new UnsatisfiedDependencyException(injectee)); } return locator.getService(ad, root, injectee); }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { ActiveDescriptor<?> ad = locator.getInjecteeDescriptor(injectee); if (ad == null) { if (injectee.isOptional()) return null; throw new MultiException(new UnsatisfiedDependencyException(injectee)); } return locator.getService(ad, root, injectee); }