/** {@inheritDoc} */ @Override public void inject(GridResourceMethod mtd, Object target, Class<?> depCls, GridDeployment dep) throws GridException { GridResourceUtils.inject(mtd.getMethod(), target, resource((GridLoggerResource)mtd.getAnnotation(), target)); }
/** {@inheritDoc} */ @Override public void inject(GridResourceMethod mtd, Object target, Class<?> cls, GridDeployment depCls) throws GridException { GridSpringResource ann = (GridSpringResource)mtd.getAnnotation(); assert ann != null; if (mtd.getMethod().getParameterTypes().length != 1) throw new GridException("Method injection setter must have only one parameter: " + mtd.getMethod()); String name = ann.resourceName(); if (springCtx != null) { Object bean = springCtx.getBean(name); GridResourceUtils.inject(mtd.getMethod(), target, bean); } }
/** {@inheritDoc} */ @Override public void inject(GridResourceMethod mtd, Object target, Class<?> depCls, GridDeployment dep) throws GridException { assert dep != null; GridUserResource ann = (GridUserResource)mtd.getAnnotation(); if (mtd.getMethod().getParameterTypes().length != 1) throw new GridException("Method injection setter must have only one parameter: " + mtd.getMethod()); Class<?> rsrcCls = !ann.resourceClass().equals(Void.class) ? ann.resourceClass() : mtd.getMethod().getParameterTypes()[0]; String rsrcName = ann.resourceName(); GridResourceUtils.inject(mtd.getMethod(), target, getResource(dep, depCls, rsrcCls, rsrcName)); }
/** {@inheritDoc} */ @Override public void inject(GridResourceMethod mtd, Object target, Class<?> depCls, GridDeployment dep) throws GridException { GridServiceResource ann = (GridServiceResource)mtd.getAnnotation(); Class svcItf = ann.proxyInterface(); Object svc; if (svcItf == Void.class) svc = grid.services().service(ann.serviceName()); else svc = grid.services().serviceProxy(ann.serviceName(), svcItf, ann.proxySticky()); Class<?>[] types = mtd.getMethod().getParameterTypes(); if (types.length != 1) throw new GridException("Setter does not have single parameter of required type [type=" + svc.getClass().getName() + ", setter=" + mtd + ']'); if (svc != null) GridResourceUtils.inject(mtd.getMethod(), target, svc); } }