/** * @param ann Annotation. * @param target Target. * @return Logger. */ @SuppressWarnings("IfMayBeConditional") private GridLogger resource(GridLoggerResource ann, Object target) { Class<?> cls = ann.categoryClass(); String cat = ann.categoryName(); GridLogger rsrc = getResource(); if (cls != null && cls != Void.class) rsrc = rsrc.getLogger(cls); else if (cat != null && !cat.isEmpty()) rsrc = rsrc.getLogger(cat); else rsrc = rsrc.getLogger(target.getClass()); return rsrc; } }
/** {@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)); }
/** * Creates resources processor. * * @param ctx Kernal context. */ public GridResourceProcessor(GridKernalContext ctx) { super(ctx); gridInjector = new GridResourceBasicInjector<>(ctx.grid()); ggHomeInjector = new GridResourceBasicInjector<>(ctx.config().getGridGainHome()); ggNameInjector = new GridResourceBasicInjector<>(ctx.config().getGridName()); locHostInjector = new GridResourceBasicInjector<>(ctx.config().getLocalHost()); mbeanSrvInjector = new GridResourceBasicInjector<>(ctx.config().getMBeanServer()); marshInjector = new GridResourceBasicInjector<>(ctx.config().getMarshaller()); execInjector = new GridResourceBasicInjector<Executor>(ctx.config().getExecutorService()); nodeIdInjector = new GridResourceBasicInjector<>(ctx.config().getNodeId()); logInjector = new GridResourceLoggerInjector(ctx.config().getGridLogger()); srvcInjector = new GridResourceServiceInjector(ctx.grid()); addrsRslvrInjector = new GridResourceBasicInjector<>(ctx.config().getAddressResolver()); }
/** {@inheritDoc} */ @Override public void inject(GridResourceField field, Object target, Class<?> depCls, GridDeployment dep) throws GridException { GridResourceUtils.inject(field.getField(), target, resource((GridLoggerResource)field.getAnnotation(), target)); }