Example usage for org.aspectj.lang ProceedingJoinPoint getSignature

List of usage examples for org.aspectj.lang ProceedingJoinPoint getSignature

Introduction

In this page you can find the example usage for org.aspectj.lang ProceedingJoinPoint getSignature.

Prototype

Signature getSignature();

Source Link

Document

getStaticPart().getSignature() returns the same object

Usage

From source file:com.example.guestbook.JdbcTraceAspect.java

License:Open Source License

@Around("execution (* org.springframework.jdbc.core.JdbcTemplate.*(..))")
public Object traceJdbcCall(final ProceedingJoinPoint pjp) throws Throwable {
    String spanName = SpanNameUtil.toLowerHyphen(pjp.getSignature().getName());
    Span span = this.tracer.createSpan("jdbc:/" + spanName);
    try {//from  ww  w  .  j  a v a  2 s . c  o m
        return pjp.proceed();
    } finally {
        this.tracer.close(span);
    }
}

From source file:com.facio.aop.EmulateFilterServletAspect.java

@Around("execution(* com.facio.service.*.*(..))") // the pointcut expression
public Object anyServiceLayerMethod(ProceedingJoinPoint joinPoint) throws Throwable {
    Object result = null;/*from  w ww . j a  v  a 2  s .c  om*/
    LOG.info("calling Aspect...");

    LOG.debug(
            "method called=" + joinPoint.getSignature().getName() + "; args=" + joinPoint.getArgs().toString());

    LOG.info(" ===== Initialize RequestContext =====");

    //This should be called to cache work
    HystrixRequestContext initializeContext = HystrixRequestContext.initializeContext();
    try {
        result = joinPoint.proceed();
        LOG.debug("result in Aspect=" + result);
    } finally {
        LOG.info(" ===== Close RequestContext =====");
        if (initializeContext != null) {
            initializeContext.shutdown();
        }
        LOG.info("Aspect called.");
    }

    return result;
}

From source file:com.facio.test.aspect.LogginAspect.java

@Around("loggingAnnotationPointcut()")
public Object methodsAnnotatedWithLogging(final ProceedingJoinPoint joinPoint) throws Throwable {
    LOG.info("begin methodsAnnotatedWithLogging()");
    Object result = null;/*from ww w.  ja  v a2 s.c  om*/

    try {
        LOG.debug("begin interpected method=" + joinPoint.getSignature());
        result = joinPoint.proceed();
    } finally {
        LOG.debug("end interpected method=" + joinPoint.getSignature());
    }

    return result;
}

From source file:com.facio.test.aspect.LogginAspect.java

@Around("execution(public * com.facio.test.service.IMyDummyComponent.getValue(..))")
public Object methodsGenericsLogging(final ProceedingJoinPoint joinPoint) throws Throwable {
    LOG.info("begin methodsGenericsLogging()");
    Object result = null;// w  w w  .  j a  va 2  s  . c  o m

    try {
        LOG.debug("begin INTERCEPTED method=" + joinPoint.getSignature());
        result = joinPoint.proceed();
    } finally {
        LOG.debug("end INTERCEPTED method=" + joinPoint.getSignature());
    }

    return result;
}

From source file:com.feilong.spring.aop.ProceedingJoinPointUtil.java

License:Apache License

/**
 *  map for log./*ww w .  j  ava  2 s  .co  m*/
 *
 * @param proceedingJoinPoint
 *            the proceeding join point
 * @return the map for log
 */
public final static Map<String, Object> getMapForLog(ProceedingJoinPoint proceedingJoinPoint) {
    Map<String, Object> map = new LinkedHashMap<String, Object>();

    Signature signature = proceedingJoinPoint.getSignature();
    MethodSignature methodSignature = (MethodSignature) signature;

    Method method = methodSignature.getMethod();
    Object[] args = proceedingJoinPoint.getArgs();

    Object target = proceedingJoinPoint.getTarget();

    Class<?> declaringType = methodSignature.getDeclaringType();

    Class<? extends Object> targetClass = target.getClass();
    map.put("target", targetClass.getCanonicalName());
    map.put("method", method.getName());
    map.put("args", args);

    return map;
}

From source file:com.feilong.spring.jdbc.datasource.MultipleGroupReadWriteDataSourceAspect.java

License:Apache License

/**
 * Point./*w  w w. j a v  a  2s  .com*/
 *
 * @param proceedingJoinPoint
 *            the proceeding join point
 * @return the object
 * @throws Throwable
 *             the throwable
 */
@Around("this(loxia.dao.ReadWriteSupport)")
public Object point(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

    Signature signature = proceedingJoinPoint.getSignature();
    MethodSignature methodSignature = (MethodSignature) signature;
    //
    TransactionAttribute transactionAttribute = null;
    if (null != transactionAttributeSouce) {
        transactionAttribute = transactionAttributeSouce.getTransactionAttribute(methodSignature.getMethod(),
                proceedingJoinPoint.getTarget().getClass());
    }

    MultipleGroupDataSource multipleGroupDataSourceAnnotation = getAnnotation(proceedingJoinPoint,
            MultipleGroupDataSource.class);
    //??
    String groupName;
    //?multipleGroupDataSourceAnnotation
    //? ? 
    if (null == multipleGroupDataSourceAnnotation
            || Validator.isNullOrEmpty(multipleGroupDataSourceAnnotation.value())) {
        //nothing to do
        groupName = null;
    } else {
        groupName = multipleGroupDataSourceAnnotation.value();
    }
    return this.proceed(proceedingJoinPoint, transactionAttribute, groupName);
}

From source file:com.fernandocejas.frodo2.logger.completable.CompletableWeaver.java

License:Apache License

public static boolean methodAnnotatedWithRxLogCompletable(ProceedingJoinPoint joinPoint) {
    return ((MethodSignature) joinPoint.getSignature()).getReturnType() == Completable.class;
}

From source file:com.fernandocejas.frodo2.logger.flowable.FlowableWeaver.java

License:Apache License

public static boolean methodAnnotatedWithRxLogFlowable(ProceedingJoinPoint joinPoint) {
    return ((MethodSignature) joinPoint.getSignature()).getReturnType() == Flowable.class;
}

From source file:com.fernandocejas.frodo2.logger.maybe.MaybeWeaver.java

License:Apache License

public static boolean methodAnnotatedWithRxLogMaybe(ProceedingJoinPoint joinPoint) {
    return ((MethodSignature) joinPoint.getSignature()).getReturnType() == Maybe.class;
}

From source file:com.fernandocejas.frodo2.logger.observable.ObservableWeaver.java

License:Apache License

public static boolean methodAnnotatedWithRxLogObservable(ProceedingJoinPoint joinPoint) {
    return ((MethodSignature) joinPoint.getSignature()).getReturnType() == Observable.class;
}