Package org.jboss.aop

Examples of org.jboss.aop.ClassAdvisor$RebuildInterceptorsAction


      return invocation.invokeNext();
   }

   private Method[] interceptGetDeclaredMethods(Class clazz)
   {
      ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);

      if (advisor == null)
      {
         return getDeclaredMethods(clazz);
      }
      else
      {
         Object[] advisedMethods = advisor.getAdvisedMethods().getValues();

         ArrayList methods = new ArrayList(advisedMethods.length);

         for (int i = 0; i < advisedMethods.length; i++)
         {
View Full Code Here


   }

   private Method interceptGetDeclaredMethod(Class clazz, Object[] args) throws NoSuchMethodException
   {

      ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);
      Method method = getDeclaredMethod(clazz, (String) args[0], (Class[]) args[1]);

      if (advisor == null)
      {
         return method;
      }
      else
      {
         Object[] advisedMethods = advisor.getAdvisedMethods().getValues();

         for (int i = 0; i < advisedMethods.length; i++)
         {
            Method m = (Method) advisedMethods[i];
            if (m.equals(method) && ReflectUtils.isNotAccessMethod(m) && isNotJavassistWrappedMethod(m))
View Full Code Here

      //implementations of overrriden methods
      GetMethodsAlreadyFound methodsFound = new GetMethodsAlreadyFound();

      while (clazz != null)
      {
         ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);
         Object[] foundMethods;

         if (advisor == null)
         {
            foundMethods = getDeclaredMethods(clazz);
         }
         else
         {
            foundMethods = advisor.getAdvisedMethods().getValues();
         }

         for (int i = 0; i < foundMethods.length; i++)
         {
            Method m = (Method) foundMethods[i];
View Full Code Here

      while (clazz != null)
      {
         //Go up the inheritance hierachy looking for the class that declares this method
         if (clazz.equals(declaringClass))
         {
            ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);

            if (advisor == null)
            {
               return method;
            }
            else
            {
               Object[] methods = advisor.getAdvisedMethods().getValues();

               for (int i = 0; i < methods.length; i++)
               {
                  Method m = (Method) methods[i];
                  if (m.equals(method))
View Full Code Here

   }


   private Field[] interceptGetDeclaredFields(Class clazz)
   {
      ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);

      if (advisor == null)
      {
         return getDeclaredFields(clazz);
      }
      else
      {
         Field[] advisedFields = advisor.getAdvisedFields();

         ArrayList fields = new ArrayList(advisedFields.length);

         for (int i = 0; i < advisedFields.length; i++)
         {
View Full Code Here

   }

   private Field interceptGetDeclaredField(Class clazz, Object[] args) throws NoSuchFieldException
   {

      ClassAdvisor advisor = AspectManager.instance().getAdvisorIfAdvised(clazz);
      Field field = getDeclaredField(clazz, (String) args[0]);

      if (advisor == null)
      {
         return field;
      }
      else
      {
         Field[] advisedFields = advisor.getAdvisedFields();

         for (int i = 0; i < advisedFields.length; i++)
         {
            Field f = advisedFields[i];
            if (f.equals(field))
View Full Code Here

         MethodCalledByConstructorInvocation inv = (MethodCalledByConstructorInvocation) invocation;
         Constructor callingCon = inv.getCalling();
         Class callingClass = callingCon.getDeclaringClass();
         if (isAdvised(callingClass))
         {
            ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingClass);
            if (advisor != null)
            {
               int index = advisor.getConstructorIndex(callingCon);
               if (index >= 0)
               {
                  HashMap calledClassesMap = advisor.getConCalledByConInterceptors()[index];
                  if (calledClassesMap != null)
                  {
                     TLongObjectHashMap calledCons = (TLongObjectHashMap) calledClassesMap.get(constructor.getDeclaringClass().getName());
                     if (calledCons != null)
                     {
                        long calledHash = MethodHashing.constructorHash(constructor);
                        ConByConInfo info = (ConByConInfo) calledCons.get(calledHash);

                        if (info != null && info.hasAdvices())
                        {
                           return advisor.invokeConCalledByCon(info, inv.getCallingObject(), args);
                        }
                     }
                  }
               }
            }
         }
      }
      else if (invocation instanceof MethodCalledByMethodInvocation)
      {
         MethodCalledByMethodInvocation inv = (MethodCalledByMethodInvocation) invocation;
         Method callingMethod = inv.getCallingMethod();
         if (isAdvised(callingMethod.getDeclaringClass()))
         {
            ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingMethod.getDeclaringClass());
            if (advisor != null)
            {
               long callingMethodHash = MethodHashing.calculateHash(callingMethod);
               long calledHash = MethodHashing.constructorHash(constructor);

               HashMap calledClassesMap = (HashMap) advisor.getConCalledByMethodInterceptors().get(callingMethodHash);
               if (calledClassesMap != null)
               {
                  TLongObjectHashMap calledCons = (TLongObjectHashMap) calledClassesMap.get(constructor.getDeclaringClass().getName());
                  if (calledCons != null)
                  {
                     //CallerConstructorInfo info = (CallerConstructorInfo) calledCons.get(calledHash);
                     ConByMethodInfo info = (ConByMethodInfo) calledCons.get(calledHash);

                     if (info != null && info.hasAdvices())
                     {
                        //return advisor.invokeConCalledByMethod(callingMethodHash, args, info, inv.getCallingObject());
                        return advisor.invokeConCalledByMethod(info, inv.getCallingObject(), args);
                     }
                  }
               }
            }
         }
      }
     
      //Try to attach to chain on target object
      Class calledClass = constructor.getDeclaringClass();
      if (isAdvised(calledClass))
      {
         ClassAdvisor advisor = AspectManager.instance().getAdvisor(constructor.getDeclaringClass());

         if (advisor != null && advisor.hasAspects())
         {
            int index = advisor.getConstructorIndex(constructor);
            if (index >= 0)
            {
               ConstructorInfo jp = advisor.getConstructorInfos()[index];
               return jp.getWrapper().invoke(null, args);
            }
         }
      }
      return invocation.invokeNext();
View Full Code Here

   private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject) throws Throwable
   {
      //Don't attach to caller chain, since we don't have caller interception for fields

      //Try to attach to chain on target object
      ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass());

      Class calledClass = field.getDeclaringClass();
      if (isAdvised(calledClass))
      {
         if (advisor != null && advisor.hasAspects())
         {
            int index = advisor.getFieldIndex(field);
            if (index >= 0)
            {
               FieldInfo jp = advisor.getFieldReadInfos()[index];
               return jp.getWrapper().invoke(null, new Object[] {targetObject});
            }
         }
      }
      return invocation.invokeNext();
View Full Code Here

   private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject, Object value) throws Throwable
   {
      //Don't attach to caller chain, since we don't have caller interception for fields

      //Try to attach to chain on target object
      ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass());

      Class calledClass = field.getDeclaringClass();
      if (isAdvised(calledClass))
      {
         if (advisor != null && advisor.hasAspects())
         {
            int index = advisor.getFieldIndex(field);
            if (index >= 0)
            {
               FieldInfo jp = advisor.getFieldWriteInfos()[index];
               return jp.getWrapper().invoke(null, new Object[] {targetObject, value});
            }
         }
      }
      return invocation.invokeNext();
View Full Code Here

         MethodCalledByConstructorInvocation inv = (MethodCalledByConstructorInvocation) invocation;
         Constructor callingCon = inv.getCalling();
         Class callingClass = callingCon.getDeclaringClass();
         if (isAdvised(callingClass))
         {
            ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingClass);
            if (advisor != null)
            {
               int index = advisor.getConstructorIndex(callingCon);
               if (index >= 0)
               {
                  HashMap calledClassesMap = advisor.getMethodCalledByConInterceptors()[index];
                  if (calledClassesMap != null)
                  {
                     TLongObjectHashMap calledMethods = (TLongObjectHashMap) calledClassesMap.get(method.getDeclaringClass().getName());
                     if (calledMethods != null)
                     {
                        long calledHash = MethodHashing.calculateHash(method);
                        //CallerMethodInfo info = (CallerMethodInfo) calledMethods.get(calledHash);
                        MethodByConInfo info = (MethodByConInfo) calledMethods.get(calledHash);

                        if (info != null && info.hasAdvices())
                        {
                           //return advisor.invokeConstructorCaller(index, targetObject, args, info);
                           return advisor.invokeConstructorCaller(info, inv.getCallingObject(), targetObject, args);
                        }
                     }
                  }
               }
            }
         }
      }
      else if (invocation instanceof MethodCalledByMethodInvocation)
      {
         MethodCalledByMethodInvocation inv = (MethodCalledByMethodInvocation) invocation;
         Method callingMethod = inv.getCallingMethod();
         if (isAdvised(callingMethod.getDeclaringClass()))
         {
            ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingMethod.getDeclaringClass());
            if (advisor != null)
            {
               long callingMethodHash = MethodHashing.calculateHash(callingMethod);
               long calledHash = MethodHashing.calculateHash(method);

               HashMap calledClassesMap = (HashMap) advisor.getMethodCalledByMethodInterceptors().get(callingMethodHash);
               if (calledClassesMap != null)
               {
                  TLongObjectHashMap calledMethods = (TLongObjectHashMap) calledClassesMap.get(method.getDeclaringClass().getName());
                  if (calledMethods != null)
                  {
                     //CallerMethodInfo info = (CallerMethodInfo) calledMethods.get(calledHash);
                     MethodByMethodInfo info = (MethodByMethodInfo) calledMethods.get(calledHash);

                     if (info != null  && info.hasAdvices())
                     {
                        //return advisor.invokeCaller(callingMethodHash, targetObject, args, info, inv.getCallingObject());
                        return advisor.invokeCaller(info, inv.getCallingObject(), targetObject, args);
                     }
                  }
               }
            }
         }
View Full Code Here

TOP

Related Classes of org.jboss.aop.ClassAdvisor$RebuildInterceptorsAction

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.