List of usage examples for org.aspectj.lang ProceedingJoinPoint getSignature
Signature getSignature();
getStaticPart().getSignature()
returns the same object From source file:com.qpark.eip.core.spring.statistics.FlowExecutionLog.java
License:Open Source License
/** * Get the method name of the {@link ProceedingJoinPoint}. * * @param joinPoint/*from w w w . jav a2s . c o m*/ * the method name. * @return the method name. */ private String getMethodName(final ProceedingJoinPoint joinPoint) { String className = joinPoint.getSignature().getName(); return className; }
From source file:com.rockagen.gnext.service.spring.aspect.OpLogAspect.java
License:Apache License
/** * [Main] {@link Around}//from www . j a v a2s .c o m * @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]/* w w w. ja v a2 s.c om*/ * * @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.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 {/* www . j a va2 s. com*/ 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 ww. j a v a 2 s.c o m 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 w w w . j ava 2s .c om*/ 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 {/*from w w w . j a v a 2 s . 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 av a2 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; }
From source file:com.samples.platform.util.ServiceExecutionLogAspect.java
License:Open Source License
/** * Get the name of the signature of the {@link ProceedingJoinPoint}. * * @param joinPoint// w w w .ja v a2s .c o m * the {@link ProceedingJoinPoint}. * @return the name of the signature. */ private String getSignatureName(final ProceedingJoinPoint joinPoint) { Signature sig = joinPoint.getSignature(); return new StringBuffer(64).append(sig.getDeclaringTypeName()).append("#").append(sig.getName()).toString(); }
From source file:com.sastix.cms.common.services.aop.MethodMonitor.java
License:Apache License
@Around("execution(* com.sastix..services..*.*(..))") public Object logServiceAccess(ProceedingJoinPoint joinPoint) throws Throwable { if (!LOG.isDebugEnabled()) { return joinPoint.proceed(); // if not on DEBUG, no point in writing anything }/* ww w . j av a 2 s . c o m*/ String name = joinPoint.getSignature().getName(); LOG.debug("==> {}({})", name, argsAsStrings(joinPoint.getArgs())); try { Object obj = joinPoint.proceed(); //continue on the intercepted method LOG.debug("<== {}(...) = {}", name, argsAsStrings(obj)); return obj; } catch (Throwable t) { LOG.error("<==! {}(...) => EXCEPTION {}", new Object[] { name, t.getMessage() }); if (t.getCause() != null) { LOG.error("<==! caused by: {} - message: {}", t.getCause(), t.getCause().getMessage()); } LOG.error("<==! exception log: ", t); throw t; } }