Package org.aspectj.lang.reflect

Examples of org.aspectj.lang.reflect.MethodSignature


    @Before("@annotation(javax.annotation.security.RolesAllowed) || @annotation(javax.annotation.security.PermitAll)")
    public void checkRoles(JoinPoint jp) throws SecurityException {
        if (log.isDebugEnabled()) log.debug("Aspect: SecurityInterceptor [" + this.hashCode() + "] has been fired");
        int permitted = -1;
        try {
            MethodSignature met = (MethodSignature) jp.getSignature();
            permitted = checkPermission(jp.getSourceLocation().getWithinType().getMethod(met.getMethod().getName(), met.getMethod().getParameterTypes()));
            if(permitted == -1) permitted = checkPermission(jp.getSourceLocation().getWithinType());
        } catch (Exception ex) {
            if (log.isDebugEnabled()) log.debug(ex);
        } finally {
            if (log.isDebugEnabled()) log.debug("Aspect: SecurityInterceptor [" + this.hashCode() + "] execution result is " + executionResults[permitted + 1]);
View Full Code Here


public class LogDebugInterceptor
{
    protected Method getMethod(JoinPoint jp) {
        Method invoked = null;
        try {
            MethodSignature met = (MethodSignature) jp.getSignature();
            invoked = jp.getSourceLocation().getWithinType().getMethod(met.getMethod().getName(), met.getMethod().getParameterTypes());
        } finally {
            return invoked;
        }
    }
View Full Code Here

  public Object handleQuery(Query query, MethodInvocation invocation){   
    return handleQueryNative(query, invocation.getThis(), invocation.getMethod(), invocation.getArguments());
  }

  public Object handleQuery(Query query, ProceedingJoinPoint pjp){
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    return handleQueryNative(query, pjp.getThis(), ms.getMethod(), pjp.getArgs());
  }
View Full Code Here

  public Object handleNativeQuery(NativeQuery nativeQuery, MethodInvocation invocation){
    return handleNativeQueryNative(nativeQuery, invocation.getThis(), invocation.getMethod(), invocation.getArguments());
  }

  public Object handleNativeQuery(NativeQuery nativeQuery, ProceedingJoinPoint pjp){
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    return handleNativeQueryNative(nativeQuery, pjp.getThis(), ms.getMethod(), pjp.getArgs());
  }
View Full Code Here

  public int handleNativeUpdate(NativeUpdate nativeUpdate, MethodInvocation invocation){
    return handleNativeUpdateNative(nativeUpdate, invocation.getThis(), invocation.getMethod(), invocation.getArguments());
  }
 
  public int handleNativeUpdate(NativeUpdate nativeUpdate, ProceedingJoinPoint pjp){
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    return handleNativeUpdateNative(nativeUpdate, pjp.getThis(), ms.getMethod(), pjp.getArgs());
  }
View Full Code Here

      return value;
    }
  }

  private Method getMethod(ProceedingJoinPoint pjp,Class<? extends Annotation> clazz){
    MethodSignature ms = (MethodSignature) pjp.getSignature();
    if (ms.getMethod().isAnnotationPresent(clazz))
      return ms.getMethod();
    Method m = ms.getMethod();
    try{
      Method m1 = pjp.getTarget().getClass().getMethod(m.getName(), m.getParameterTypes());
      if (m1.isAnnotationPresent(clazz))
        return m1;
    }catch (Exception e){
View Full Code Here

  public Object handleNamedQuery(NamedQuery namedQuery, MethodInvocation invocation){
    return handleNamedQueryNative(namedQuery, invocation.getThis(), invocation.getMethod(), invocation.getArguments());
  }

  public Object handleNamedQuery(NamedQuery namedQuery, ProceedingJoinPoint pjp){
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    return handleNamedQueryNative(namedQuery, pjp.getThis(), ms.getMethod(), pjp.getArgs());   
  }
View Full Code Here

  @Autowired
  TransactionAttributeSource transactionAttributeSouce;
 
  @Around("this(loxia.dao.ReadWriteSupport)")
  public Object doQuery(ProceedingJoinPoint pjp) throws Throwable
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    TransactionAttribute ta = transactionAttributeSouce.getTransactionAttribute(ms.getMethod(), pjp.getTarget().getClass());
    if(ta == null || (ReadWriteStatusHolder.getReadWriteStatus() != null && ta.getPropagationBehavior() != TransactionDefinition.PROPAGATION_REQUIRES_NEW)){
      return pjp.proceed(pjp.getArgs());
    }
   
    logger.debug("determine datasource for query:{}.{}",ms.getDeclaringType().getName(),ms.getMethod().getName());   
    logger.debug("Current operation's transaction status: {}", ta == null ? "null": ta.toString());
   
    String currentStatus = ReadWriteStatusHolder.getReadWriteStatus();
    if(ta != null){
      if(ta.getPropagationBehavior() == TransactionDefinition.PROPAGATION_REQUIRES_NEW){
View Full Code Here

    return 20;
  }

  @Around("this(loxia.dao.GenericEntityDao)")
  public Object doQuery(ProceedingJoinPoint pjp) throws Throwable{
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    Query query = ms.getMethod().getAnnotation(Query.class);
    NamedQuery namedQuery = ms.getMethod().getAnnotation(NamedQuery.class);
    DynamicQuery dynamicQuery = ms.getMethod().getAnnotation(DynamicQuery.class);
    NativeQuery nativeQuery = ms.getMethod().getAnnotation(NativeQuery.class);
    NativeUpdate nativeUpdate = ms.getMethod().getAnnotation(NativeUpdate.class);
   
    if(namedQuery !=null){
      return namedQueryHandler.handleNamedQuery(namedQuery, pjp);
    }else if(query != null){
      return queryHandler.handleQuery(query,pjp);
View Full Code Here

    }else{
      logger.info("Currently we only check privilege on controllers.");
      return pjp.proceed(pjp.getArgs());
    }
   
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    Acl acl = ms.getMethod().getAnnotation(Acl.class);
   
    logger.debug("Acl found: {}", Arrays.asList(acl.value()));
    OperatingUnitDao operatingUnitDao = (OperatingUnitDao)context.getBean("loxiaOperatingUnitDao");
    OperatingUnit currentOu = null;
    Annotation[][] paramAnnos = ms.getMethod().getParameterAnnotations();
    for(int i=0; i < paramAnnos.length; i++){
      for(int j=0; j< paramAnnos[i].length; j++){
        if(paramAnnos[i][j] != null && paramAnnos[i][j] instanceof CurrentOu){
          Long ouId = null;
          if(pjp.getArgs()[i] instanceof OperatingUnit){
View Full Code Here

TOP

Related Classes of org.aspectj.lang.reflect.MethodSignature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.