List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed
public Object proceed() throws Throwable;
From source file:com.organization.automation.project.spice.mix.aop.aspectjspring.LogAspect.java
License:Open Source License
@Around("annotatedTestStepExecution()") public Object logTestStep(ProceedingJoinPoint pjp) throws Throwable { // Logging Policy: 1. log before -> 2. method run String methodName = pjp.getSignature().getName(); // #1: log before logBefore(methodName);// w w w . j a v a 2 s . c om // #2: method run Object returnValue = pjp.proceed(); // #3: log after logAfter(); return returnValue; }
From source file:com.p5solutions.trackstate.aop.TrackStateProxyAspect.java
License:Open Source License
/** * Wrap around a method with the annotation of {@link WrapTrackStateProxy}. If {@link TrackStateProxyStategy#PROXY}, * the returning value of this method will be proxied via the {@link #trackStateProxyFactory}. * /* www. ja va2 s.c o m*/ * @param pjp * The proceeding join point, representing the method in question. * @param wrap * The {@link WrapTrackStateProxy} instance on annotated on the method. * @return Instance of the returning object form the <code>pjp.proceed()</code> proxied via the * {@link #autoTrack(ProceedingJoinPoint)} if {@link TrackStateProxyStategy#PROXY} * @throws Throwable * the throwable */ @Around("@annotation(wrap)") public Object trackState(ProceedingJoinPoint pjp, WrapTrackStateProxy wrap) throws Throwable { Object target = pjp.proceed(); Object[] args = pjp.getArgs(); target = wrap(target, args, wrap); return target; }
From source file:com.polydeucesys.kaos.example.aspect.StringSharerAspects.java
License:Apache License
@Around("writeSocketPointcut(msg)") public Object handleBehaviour(ProceedingJoinPoint pjp, String msg) throws IOException { Strategy<String> strategy = ConfigurationFactory.getInstance().getConfiguration() .strategyForName("write-aspect"); if (!isWriteStarted) { strategy.start();/*from w ww . ja v a 2 s .c o m*/ isWriteStarted = true; } for (Behaviour<String> b : strategy.beforeBehaviours()) { try { b.execute(); } catch (IOException ioe) { throw ioe; } catch (Exception e) { // noop. Why are we throwing something that doesn't make sense? } } try { return pjp.proceed(); } catch (Throwable e) { if (e instanceof RuntimeException) throw (RuntimeException) e; return null; } }
From source file:com.prussia.play.spring.service.aop.ServiceMonitor.java
License:Apache License
@Around("pointCut()") public Object around(ProceedingJoinPoint joinPoint) throws Throwable { logger.warn("around start.., {} ", joinPoint); long start = System.currentTimeMillis(); Object o = null;//from ww w . j a v a2s. c om try { o = joinPoint.proceed(); } catch (Throwable ex) { throw ex; } finally { logger.warn("ServiceMonitor:" + joinPoint.getSignature().getName() + " takes " + (System.currentTimeMillis() - start) + "ms"); updateStats(joinPoint.getSignature().getName(), (System.currentTimeMillis() - start)); } return o; }
From source file:com.qbao.cat.plugin.DefaultPluginTemplate.java
License:Apache License
public Object proxyCollector(ProceedingJoinPoint pjp) throws Throwable { Transaction transaction = proxyBeginLog(pjp); Object obj = null;/*w ww.j a v a2 s. co m*/ try { obj = pjp.proceed(); proxySuccess(transaction); return obj; } catch (Throwable e) { exception(transaction, e); throw e; } finally { proxyEndLog(transaction, obj, pjp.getArgs()); } }
From source file:com.qcadoo.customTranslation.internal.aop.TranslationServiceOverrideAspect.java
License:Open Source License
@Around("translateWithErrorExecution(messageCode, locale, args)") public String aroundTranslateWithErrorExecution(final ProceedingJoinPoint pjp, final String messageCode, final Locale locale, final String[] args) throws Throwable { String result = null;/*from ww w. j a v a 2s . com*/ if (translationServiceOverrideUtil.shouldOverrideTranslation(messageCode, locale)) { result = translationServiceOverrideUtil.getCustomTranslation(messageCode, locale, args); if (result == null) { result = (String) pjp.proceed(); } } else { result = (String) pjp.proceed(); } return result; }
From source file:com.qcadoo.mes.states.aop.RunForStateTransitionAspect.java
License:Open Source License
private Object runOnlyIfMatchAtLeastOneSpecifiedTransitions(final ProceedingJoinPoint pjp, final StateChangeContext stateChangeContext, final RunForStateTransition[] transitions) throws Throwable { Object returnValue = null;//from w w w . j ava2 s .com if (stateChangeMatchAnyTransition(stateChangeContext, transitions)) { returnValue = pjp.proceed(); } return returnValue; }
From source file:com.qcadoo.mes.states.aop.RunInPhaseAspect.java
License:Open Source License
private Object runInPhase(final ProceedingJoinPoint pjp, final int currentPhase, final RunInPhase annotation) throws Throwable { Object result = null;/*from ww w. j a v a 2 s . c o m*/ if (ArrayUtils.contains(annotation.value(), currentPhase)) { result = pjp.proceed(); } return result; }
From source file:com.qcadoo.mes.techSubcontracting.aop.MrpAlgorithmStrategyResolverAspect.java
License:Open Source License
@SuppressWarnings("unchecked") @Around("getProductsMethodExecution(productComponentWithQuantities, nonComponents, mrpAlgorithm, operationProductComponentModelName)") public Map<Long, BigDecimal> aroundGetProductsMethodExecution(final ProceedingJoinPoint pjp, final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents, final MrpAlgorithm mrpAlgorithm, final String operationProductComponentModelName) throws Throwable { if (PluginUtils.isEnabled(TechSubcontractingConstants.PLUGIN_IDENTIFIER) && getAlgorithmService().isApplicableFor(mrpAlgorithm)) { return getAlgorithmService().perform(productComponentWithQuantities, nonComponents, mrpAlgorithm, operationProductComponentModelName); } else {// w w w . j ava 2 s. c o m return (Map<Long, BigDecimal>) pjp.proceed(); } }
From source file:com.qcadoo.mes.techSubcontracting.aop.ProductQuantitiesServiceImplTSOverrideAspect.java
License:Open Source License
@Around("getProductComponentWithQuantitiesWithoutNonComponentsExecution(productComponentWithQuantities, nonComponents)") public OperationProductComponentWithQuantityContainer aroundGetProductComponentWithQuantitiesWithoutNonComponentsExecution( final ProceedingJoinPoint pjp, final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents) throws Throwable { if (productQuantitiesServiceImplTSOverrideUtil.shouldOverride()) { return productQuantitiesServiceImplTSOverrideUtil.getProductComponentWithQuantitiesWithoutNonComponents( productComponentWithQuantities, nonComponents); } else {//from w w w. j a va2 s.com return (OperationProductComponentWithQuantityContainer) pjp.proceed(); } }