List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed
public Object proceed() throws Throwable;
From source file:com.jaxio.celerio.aspects.GraphPredicateAspect.java
License:Apache License
@Around("com.jaxio.celerio.aspects.PredicatesAspect.methods()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { depth++;/*from w ww . j a v a 2s . c om*/ StringBuilder sb = new StringBuilder(); for (int i = 0; i < depth; i++) { sb.append(' '); } sb.append(pjp.getSignature()); log.info(sb.toString()); Object retVal = pjp.proceed(); depth--; return retVal; }
From source file:com.jeanchampemont.wtfdyum.security.SecurityAspect.java
License:Apache License
/** * Around method annotated with @Secured. * */// w w w. j a v a 2s . c o m @Around("execution(public * *(..)) && @annotation(secured)") public Object aroundSecuredMethod(final ProceedingJoinPoint pjp, final Secured secured) throws Throwable { log.trace("Secured method called: {}", pjp.getSignature()); if (!authenticationService.isAuthenticated()) { log.trace("Secured call not authorized, throwing SecurityException"); throw new SecurityException(); } log.trace("Secured call authorized"); return pjp.proceed(); }
From source file:com.jim.im.config.GenericAopConfig.java
License:Open Source License
@Around("updatePointCut()") protected Object doAroundUpdate(ProceedingJoinPoint pjp) throws Throwable { Object arg = pjp.getArgs()[0]; if (arg instanceof GenericEntity) { entityInterceptor.beforeUpdate((GenericEntity) arg); }/*from w ww. jav a 2s .c o m*/ Object o = pjp.proceed(); return o; }
From source file:com.jim.im.config.GenericAopConfig.java
License:Open Source License
@Around("addPointCut()") protected Object doAroundAdd(ProceedingJoinPoint pjp) throws Throwable { Object arg = pjp.getArgs()[0]; if (arg instanceof GenericEntity) { entityInterceptor.beforeAdd((GenericEntity) arg); }// w w w .jav a2 s . com Object o = pjp.proceed(); return o; }
From source file:com.jim.im.config.GenericAopConfig.java
License:Open Source License
@Around("addBatchPointCut()") protected Object doAroundAddBatch(ProceedingJoinPoint pjp) throws Throwable { Object arr = pjp.getArgs()[0]; if (arr.getClass().isArray()) { for (Object obj : (Object[]) arr) { if (obj instanceof GenericEntity) { entityInterceptor.beforeAdd((GenericEntity) obj); }//from w ww. jav a2 s.c o m } } Object o = pjp.proceed(); return o; }
From source file:com.jiwhiz.aop.logging.LoggingAspect.java
License:Apache License
@Around("loggingPoincut()") public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { if (log.isDebugEnabled()) { log.debug("==> Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); }/*from www . ja v a2 s . c om*/ try { Object result = joinPoint.proceed(); if (log.isDebugEnabled()) { log.debug("<== Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), result); } return result; } catch (IllegalArgumentException e) { log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()), joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName()); throw e; } }
From source file:com.jmhz.device.sys.aop.UserCacheAspect.java
License:Apache License
@Around(value = "userServicePointcut() && cacheablePointcut()") public Object cacheableAdvice(ProceedingJoinPoint pjp) throws Throwable { String methodName = pjp.getSignature().getName(); Object arg = pjp.getArgs().length >= 1 ? pjp.getArgs()[0] : null; String key = ""; boolean isIdKey = false; if ("findOne".equals(methodName)) { key = idKey(String.valueOf(arg)); isIdKey = true;//from w w w. j a v a2s . co m } else if ("findByUsername".equals(methodName)) { key = usernameKey((String) arg); } else if ("findByEmail".equals(methodName)) { key = telKey((String) arg); } User user = null; if (isIdKey == true) { user = get(key); } else { Long id = get(key); if (id != null) { key = idKey(String.valueOf(id)); user = get(key); } } //cache hit if (user != null) { log.debug("cacheName:{}, hit key:{}", cacheName, key); return user; } log.debug("cacheName:{}, miss key:{}", cacheName, key); //cache miss user = (User) pjp.proceed(); //put cache put(user); return user; }
From source file:com.jmmd.biz.shared.aspect.BizAspect.java
License:Open Source License
/** * ./* w w w . j av a 2s . com*/ * * @param jionpoint * @return * @throws Throwable */ @Around("bizPointcut() && @annotation(aspectLogger)") public Object aroundAdvice(ProceedingJoinPoint jionpoint, AspectLogger aspectLogger) throws Throwable { /* * . */ long l1 = System.currentTimeMillis(); /* * ??. */ String desc = aspectLogger.value(); /* * ??. */ //boolean discover = aspectLogger.discover(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ?. */ Object o = jionpoint.proceed(); /* * ?. */ long l2 = System.currentTimeMillis(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append("),(").append((l2 - l1)).append("ms)") .append(",?()"); /* * . */ logger.info(aspectMessage.toString()); return o; }
From source file:com.jmmd.common.shared.aspect.CommonLogger.java
License:Open Source License
/** * .// w w w . j a va 2s . c o m * * @param jionpoint * @return * @throws Throwable */ @Around("commonPointcut() && @annotation(aspectLogger)") public Object aroundAdvice(ProceedingJoinPoint jionpoint, AspectLogger aspectLogger) throws Throwable { /* * . */ long l1 = System.currentTimeMillis(); /* * ??. */ String desc = aspectLogger.value(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ?. */ Object o = jionpoint.proceed(); /* * ?. */ long l2 = System.currentTimeMillis(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append("),(").append((l2 - l1)).append("ms)") .append(",?()"); /* * . */ logger.info(aspectMessage.toString()); return o; }
From source file:com.jmmd.core.shared.aspect.CoreAspect.java
License:Open Source License
/** * ./*from w w w . j ava 2 s. co m*/ * * @param jionpoint * @return * @throws Throwable */ @Around("corePointcut() && @annotation(aspectLogger)") public Object aroundAdvice(ProceedingJoinPoint jionpoint, AspectLogger aspectLogger) throws Throwable { /* * . */ long l1 = System.currentTimeMillis(); /* * ??. */ String desc = aspectLogger.value(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ?. */ Object o = jionpoint.proceed(); /* * ?. */ long l2 = System.currentTimeMillis(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append("),(").append(l2 - l1).append("ms)") .append(",?()"); /* * . */ logger.info(aspectMessage.toString()); return o; }