Example usage for org.aspectj.lang ProceedingJoinPoint proceed

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

Introduction

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

Prototype

public Object proceed() throws Throwable;

Source Link

Document

Proceed with the next advice or target method invocation

Usage

From source file:com.qs.aop.AspectJAop.java

@Around("execution(* com.qs.controller.PostController.testJson1(..))")
public void aroundHotel(ProceedingJoinPoint pjp) throws Throwable {
    System.out.println("?");
    pjp.proceed();
}

From source file:com.qut.middleware.esoemanager.authz.SecurityManager.java

License:Apache License

@Around("com.qut.middleware.esoemanager.authz.SystemArchitecture.determineSuperUser()")
public Boolean doSuperUserAccessCheck(ProceedingJoinPoint pjp) {
    // Let the function execute but we don't care about what it thinks :)
    try {//  w w  w.  jav a  2  s.  c o  m
        pjp.proceed();
    } catch (Throwable e) {
        return false;
    }

    SPEPProxy spep = this.establishSPEPProxy();

    if (!isSuperUser(spep)) {
        return false;
    }

    return true;
}

From source file:com.rockagen.gnext.service.spring.aspect.OpLogAspect.java

License:Apache License

/**
 * [Main] {@link Around}/* w  ww. j av  a  2  s.com*/
 * @param pjp {@link ProceedingJoinPoint}
 * @return Object
 * @throws Throwable
 */
public Object around(ProceedingJoinPoint pjp) throws Throwable {

    Object obj = null;

    MethodSignature signature = (MethodSignature) pjp.getSignature();
    Method method = signature.getMethod();

    int result = 1;
    String message = "";
    String action = getPlogValue(method);
    Date startAt = new Date();
    try {
        // call target object method
        obj = pjp.proceed();
    } catch (Exception e) {
        result = 0;
        message = e.getMessage();
        throw e;
    } finally {
        register(action, startAt, result, message);
    }
    return obj;
}

From source file:com.rockagen.gnext.service.spring.security.aspect.OpAspect.java

License:Apache License

/**
 * [Main]//from   w w w  .j  a  v  a2s.  com
 * 
 * @param pjp
 * @return
 * @throws Throwable
 */
@Around("pointcutService()")
public Object loggerOpt(ProceedingJoinPoint pjp) throws Throwable {

    Object obj = null;
    // Obtain the will executing method and target object type
    String methodName = pjp.getSignature().getName();
    if (isPoint(methodName)) {
        // Get class info
        Class<? extends Object> targetClass = pjp.getTarget().getClass();
        Method method = targetClass.getMethod(methodName);
        beforeJoinPoint(getMethodDesc(method));
        // call target object method
        obj = pjp.proceed();
        afterJoinPoint(getMethodDesc(method));
    } else {
        obj = pjp.proceed();
    }

    return obj;
}

From source file:com.ryantenney.metrics.spring.AopFieldInjectionInteractionTest.java

License:Apache License

@Around("execution(* com.ryantenney.metrics.spring.TestAspectTarget.targetMethod())")
public Object aroundMethod(ProceedingJoinPoint joinPoint) throws Throwable {
    joinPoint.proceed();
    return 5;/* www . j av a2 s  .co  m*/
}

From source file:com.salesforce.ide.core.internal.aspects.CrudOperationsRetryAspect.java

License:Open Source License

public Object crudOperationRetry(ProceedingJoinPoint proceedingJoinPoint)
        throws ForceConnectionException, Throwable {
    int numAttempts = 0;
    ForceConnectionException forceConnectionException = null;
    do {/*w ww. java  2 s .  c o m*/
        numAttempts++;

        if (logger.isDebugEnabled()) {
            logger.debug("Attempt [" + numAttempts + "] at executing:\n '"
                    + proceedingJoinPoint.getSignature().toLongString() + "'");
        }

        try {
            return proceedingJoinPoint.proceed();
        } catch (ForceConnectionException ex) {
            evaluateOperationsException(ex, proceedingJoinPoint);
            forceConnectionException = ex;
        }
    } while (numAttempts <= this.maxRetries);

    logger.warn("Max retries reached.");

    throw forceConnectionException;
}

From source file:com.salesforce.ide.core.internal.aspects.LoginRetryAspect.java

License:Open Source License

public void loginRetry(ProceedingJoinPoint proceedingJoinPoint) throws ForceConnectionException, Throwable {
    int numAttempts = 0;
    ForceConnectionException forceConnectionException = null;
    do {/*from  w w  w . j  a  v a 2s.c  om*/
        numAttempts++;

        if (logger.isDebugEnabled()) {
            logger.debug("Attempt [" + numAttempts + "] at executing:\n '"
                    + proceedingJoinPoint.getSignature().toLongString() + "'");
        }

        try {
            proceedingJoinPoint.proceed();
            return;
        } catch (ForceConnectionException ex) {
            evaluateLoginException(ex, proceedingJoinPoint);
            forceConnectionException = ex;
        }
    } while (numAttempts <= this.maxRetries);

    logger.warn("Max retries reached");

    throw forceConnectionException;
}

From source file:com.salesforce.ide.core.internal.aspects.MetadataOperationsRetryAspect.java

License:Open Source License

public Object metadataOperationsRetry(ProceedingJoinPoint proceedingJoinPoint) throws Exception, Throwable {
    int numAttempts = 0;
    Exception exception = null;/*from   www  . j  a  va 2s .  c o m*/
    do {
        numAttempts++;

        if (logger.isDebugEnabled()) {
            logger.debug("Attempt [" + numAttempts + "] at executing:\n '"
                    + proceedingJoinPoint.getSignature().toLongString() + "'");
        }

        try {
            return proceedingJoinPoint.proceed();
        } catch (Exception ex) {
            logger.error(ex.getClass().getSimpleName()
                    + " occurred while attempting to perform a metadata operation");
            evaluateException(ex, proceedingJoinPoint);
            exception = ex;
        }
    } while (numAttempts <= this.maxRetries);

    logger.warn("Max retries reached");

    throw exception;
}

From source file:com.salesforce.ide.core.internal.aspects.ProfilingAspect.java

License:Open Source License

public Object profile(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
    try {/*  w  w  w  . j av  a2s  . c o  m*/
        ForceIdeCorePlugin.stopWatch.start(proceedingJoinPoint.getSignature().getName());
        return proceedingJoinPoint.proceed();
    } finally {
        ForceIdeCorePlugin.stopWatch.stop(proceedingJoinPoint.getSignature().getName());
        if (logger.isDebugEnabled()) {
            logger.debug(
                    ForceIdeCorePlugin.stopWatch.prettyPrint(proceedingJoinPoint.getSignature().getName()));
        }
    }
}

From source file:com.salesforce.ide.core.internal.aspects.ToolingOperationsRetryAspect.java

License:Open Source License

public Object toolingOperationsRetry(ProceedingJoinPoint proceedingJoinPoint) throws Exception, Throwable {
    int numAttempts = 0;
    Exception exception = null;/*from   w  w w.j  ava  2 s  .c o  m*/
    do {
        numAttempts++;

        if (logger.isDebugEnabled()) {
            logger.debug("Attempt [" + numAttempts + "] at executing:\n '"
                    + proceedingJoinPoint.getSignature().toLongString() + "'");
        }

        try {
            return proceedingJoinPoint.proceed();
        } catch (Exception ex) {
            logger.error(ex.getClass().getSimpleName()
                    + " occurred while attempting to perform a tooling operation");
            evaluateException(ex, proceedingJoinPoint);
            exception = ex;
        }
    } while (numAttempts <= this.maxRetries);

    logger.warn("Max retries reached");

    throw exception;
}