List of usage examples for org.aspectj.lang JoinPoint getSignature
Signature getSignature();
getStaticPart().getSignature()
returns the same object From source file:$.BizAspect.java
License:Open Source License
/** * . /*from www .j a v a2 s .co m*/ * * @param jionpoint * @param e */ @AfterThrowing(pointcut = "bizPointcut() && @annotation(aspectLogger)", throwing = "e") public void throwingAdvice(JoinPoint jionpoint, AspectLogger aspectLogger, Exception e) { /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ??. */ String desc = aspectLogger.value(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append(")").append(",?()"); /* * . */ logger.info(aspectMessage.toString()); }
From source file:$.CommonAspect.java
License:Open Source License
/** * ./*from w ww . j av a 2 s. c o m*/ * * @param jionpoint * @param e */ @AfterThrowing(pointcut = "commonPointcut() && @annotation(aspectLogger)", throwing = "e") public void throwingAdvice(JoinPoint jionpoint, AspectLogger aspectLogger, Exception e) { /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ??. */ String desc = aspectLogger.value(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append(")").append(",?()"); /* * . */ logger.info(aspectMessage.toString()); }
From source file:$.CoreAspect.java
License:Open Source License
/** * ./* w w w .ja v a2s. c om*/ * * @param jionpoint * @param e */ @AfterThrowing(pointcut = "corePointcut() && @annotation(aspectLogger)", throwing = "e") public void throwingAdvice(JoinPoint jionpoint, AspectLogger aspectLogger, Exception e) { /* * ???. */ String targetClassName = jionpoint.getTarget().getClass().getName(); /* * ???. */ String targetMethodName = jionpoint.getSignature().getName(); /* * ??. */ String desc = aspectLogger.value(); /* * ?. */ StringBuilder aspectMessage = new StringBuilder(); aspectMessage.append("[]:(").append(desc).append("),(").append(targetClassName) .append(".").append(targetMethodName).append(")").append(",?()"); /* * . */ logger.info(aspectMessage.toString()); }
From source file:ajia.service.impl.InventoryMonitorImpl.java
License:Apache License
public void notify(Product product, JoinPoint thisJoinPoint) { System.out.println(/*from w w w . j a va 2 s .c o m*/ "Inventory modified " + product.getName() + " " + thisJoinPoint.getSignature().toShortString()); }
From source file:ajia.tracing.AbstractTraceAspect.java
License:Apache License
@Before("traced()") public void log(JoinPoint thisJoinPointStaticPart) { Signature sig = thisJoinPointStaticPart.getSignature(); _logger.log(Level.INFO, "Entering [" + sig.toShortString() + "]"); NDC.push(" "); }
From source file:ajia.transaction.AnnotationDrivenTransactionManagementAspect.java
License:Apache License
public TransactionAttributeWithRollbackRules getTransactionAttribute(JoinPoint jp) { MethodSignature jpSignature = (MethodSignature) jp.getSignature(); Transactional typeAnnotation = AnnotationUtils.findAnnotation(jpSignature.getDeclaringType(), Transactional.class); Transactional methodAnnotation = AnnotationUtils.findAnnotation(jpSignature.getMethod(), Transactional.class); return TransactionManagementUtil.createTransactionAttribute(typeAnnotation, methodAnnotation); }
From source file:ar.com.allium.rules.core.service.ExcecuteRuleService.java
License:Open Source License
private List<RuleResponse> executeSetOfRules(JoinPoint joinPoint, ExecuteRule excecuteRule) { String[] ruleSetList = excecuteRule.ruleSetName(); List<RuleResponse> ruleResponseList = new ArrayList<RuleResponse>(); if (ruleSetList != null && ruleSetList.length > 0) { for (String ruleSet : ruleSetList) { log.debug("excecute rule set: " + ruleSet); List<AlliumRule> rulesToExecuteList = this.getAlliumCoreRuleManager().getRuleList(ruleSet); if (rulesToExecuteList != null && rulesToExecuteList.size() > 0) { for (AlliumRule alliumRule : rulesToExecuteList) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); log.debug("execute rule: " + alliumRule.getRuleName() + " from rule set: " + ruleSet); RuleResponse result = alliumRule .execute(new AlliumRuleEvaluateParameters(method, joinPoint.getArgs())); log.debug("execute rule: " + alliumRule.getRuleName() + " from rule set: " + ruleSet + " -- result: " + result.getRuleState()); if (RuleState.RULE_ERROR.equals(result.getRuleState())) { ruleResponseList.add(result); if (excecuteRule.onErrorStopProcess()) { throw new AlliumRuleException("error to process set allium rule: " + ruleSet, ruleResponseList); }/*w ww . j a v a2 s .c om*/ } } } } } return ruleResponseList; }
From source file:ar.com.allium.rules.core.service.ExcecuteRuleService.java
License:Open Source License
private List<RuleResponse> executeRules(JoinPoint joinPoint, ExecuteRule excecuteRule) { List<RuleResponse> ruleResponseList = new ArrayList<RuleResponse>(); Class<? extends AlliumRule>[] ruleList = excecuteRule.ruleClass(); for (Class<? extends AlliumRule> clazz : ruleList) { AlliumRule alliumRule = this.getAlliumCoreRuleManager().getRule(clazz); MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); log.debug("execute rule: " + alliumRule.getRuleName()); RuleResponse result = alliumRule.execute(new AlliumRuleEvaluateParameters(method, joinPoint.getArgs())); log.debug("execute rule: " + alliumRule.getRuleName() + " -- result: " + result.getRuleState()); if (RuleState.RULE_ERROR.equals(result.getRuleState())) { ruleResponseList.add(result); if (excecuteRule.onErrorStopProcess()) { throw new AlliumRuleException( "error to process allium rule: " + alliumRule.getClass().getSimpleName(), ruleResponseList); }/* ww w.j a v a 2 s.c om*/ } } return ruleResponseList; }
From source file:ar.com.jrules.core.service.ExcecuteRuleService.java
License:Open Source License
private List<RuleResponse> executeSetOfRules(JoinPoint joinPoint, ExecuteRule excecuteRule) { String[] ruleSetList = excecuteRule.ruleSetName(); List<RuleResponse> ruleResponseList = new ArrayList<RuleResponse>(); if (ruleSetList != null && ruleSetList.length > 0) { for (String ruleSet : ruleSetList) { log.debug("excecute rule set: " + ruleSet); List<JRule> rulesToExecuteList = this.getJRulesCoreRuleManager().getRuleList(ruleSet); if (rulesToExecuteList != null && rulesToExecuteList.size() > 0) { for (JRule jRule : rulesToExecuteList) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); log.debug("execute rule: " + jRule.getRuleName() + " from rule set: " + ruleSet); RuleResponse result = jRule .execute(new JRuleEvaluateParameters(method, joinPoint.getArgs())); log.debug("execute rule: " + jRule.getRuleName() + " from rule set: " + ruleSet + " -- result: " + result.getRuleState()); if (RuleState.RULE_ERROR.equals(result.getRuleState())) { ruleResponseList.add(result); if (excecuteRule.onErrorStopProcess()) { throw new JRuleException("error to process set jrule: " + ruleSet, ruleResponseList); }// ww w. j a va2 s . c o m } } } } } return ruleResponseList; }
From source file:ar.com.jrules.core.service.ExcecuteRuleService.java
License:Open Source License
private List<RuleResponse> executeRules(JoinPoint joinPoint, ExecuteRule excecuteRule) { List<RuleResponse> ruleResponseList = new ArrayList<RuleResponse>(); Class<? extends JRule>[] ruleList = excecuteRule.ruleClass(); for (Class<? extends JRule> clazz : ruleList) { JRule jRule = this.getJRulesCoreRuleManager().getRule(clazz); MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); log.debug("execute rule: " + jRule.getRuleName()); RuleResponse result = jRule.execute(new JRuleEvaluateParameters(method, joinPoint.getArgs())); log.debug("execute rule: " + jRule.getRuleName() + " -- result: " + result.getRuleState()); if (RuleState.RULE_ERROR.equals(result.getRuleState())) { ruleResponseList.add(result); if (excecuteRule.onErrorStopProcess()) { throw new JRuleException("error to process jrule: " + jRule.getClass().getSimpleName(), ruleResponseList); }/*from w w w. j av a2 s . c o m*/ } } return ruleResponseList; }