Package org.jboss.aop

Examples of org.jboss.aop.ClassAdvisor


/* 1168 */       MethodCalledByConstructorInvocation inv = (MethodCalledByConstructorInvocation)invocation;
/* 1169 */       Constructor callingCon = inv.getCalling();
/* 1170 */       Class callingClass = callingCon.getDeclaringClass();
/* 1171 */       if (isAdvised(callingClass))
/*      */       {
/* 1173 */         ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingClass);
/* 1174 */         if (advisor != null)
/*      */         {
/* 1176 */           int index = advisor.getConstructorIndex(callingCon);
/* 1177 */           if (index >= 0)
/*      */           {
/* 1179 */             HashMap calledClassesMap = advisor.getConCalledByConInterceptors()[index];
/* 1180 */             if (calledClassesMap != null)
/*      */             {
/* 1182 */               TLongObjectHashMap calledCons = (TLongObjectHashMap)calledClassesMap.get(constructor.getDeclaringClass().getName());
/* 1183 */               if (calledCons != null)
/*      */               {
/* 1185 */                 long calledHash = MethodHashing.constructorHash(constructor);
/* 1186 */                 ConByConInfo info = (ConByConInfo)calledCons.get(calledHash);
/*      */
/* 1188 */                 if ((info != null) && (info.hasAdvices()))
/*      */                 {
/* 1190 */                   return advisor.invokeConCalledByCon(info, inv.getCallingObject(), args);
/*      */                 }
/*      */               }
/*      */             }
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/* 1198 */     else if ((invocation instanceof MethodCalledByMethodInvocation))
/*      */     {
/* 1200 */       MethodCalledByMethodInvocation inv = (MethodCalledByMethodInvocation)invocation;
/* 1201 */       Method callingMethod = inv.getCallingMethod();
/* 1202 */       if (isAdvised(callingMethod.getDeclaringClass()))
/*      */       {
/* 1204 */         ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingMethod.getDeclaringClass());
/* 1205 */         if (advisor != null)
/*      */         {
/* 1207 */           long callingMethodHash = MethodHashing.calculateHash(callingMethod);
/* 1208 */           long calledHash = MethodHashing.constructorHash(constructor);
/*      */
/* 1210 */           HashMap calledClassesMap = (HashMap)advisor.getConCalledByMethodInterceptors().get(callingMethodHash);
/* 1211 */           if (calledClassesMap != null)
/*      */           {
/* 1213 */             TLongObjectHashMap calledCons = (TLongObjectHashMap)calledClassesMap.get(constructor.getDeclaringClass().getName());
/* 1214 */             if (calledCons != null)
/*      */             {
/* 1217 */               ConByMethodInfo info = (ConByMethodInfo)calledCons.get(calledHash);
/*      */
/* 1219 */               if ((info != null) && (info.hasAdvices()))
/*      */               {
/* 1222 */                 return advisor.invokeConCalledByMethod(info, inv.getCallingObject(), args);
/*      */               }
/*      */             }
/*      */           }
/*      */         }
/*      */       }
/*      */
/*      */     }
/*      */
/* 1231 */     Class calledClass = constructor.getDeclaringClass();
/* 1232 */     if (isAdvised(calledClass))
/*      */     {
/* 1234 */       ClassAdvisor advisor = AspectManager.instance().getAdvisor(constructor.getDeclaringClass());
/*      */
/* 1236 */       if ((advisor != null) && (advisor.hasAspects()))
/*      */       {
/* 1238 */         int index = advisor.getConstructorIndex(constructor);
/* 1239 */         if (index >= 0)
/*      */         {
/* 1241 */           ConstructorInfo jp = advisor.getConstructorInfos()[index];
/* 1242 */           return jp.getWrapper().invoke(null, args);
/*      */         }
/*      */       }
/*      */     }
/* 1246 */     return invocation.invokeNext();
View Full Code Here


/*      */   }
/*      */
/*      */   private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject)
/*      */     throws Throwable
/*      */   {
/* 1261 */     ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass());
/*      */
/* 1263 */     Class calledClass = field.getDeclaringClass();
/* 1264 */     if (isAdvised(calledClass))
/*      */     {
/* 1266 */       if ((advisor != null) && (advisor.hasAspects()))
/*      */       {
/* 1268 */         int index = advisor.getFieldIndex(field);
/* 1269 */         if (index >= 0)
/*      */         {
/* 1271 */           FieldInfo jp = advisor.getFieldReadInfos()[index];
/* 1272 */           return jp.getWrapper().invoke(null, new Object[] { targetObject });
/*      */         }
/*      */       }
/*      */     }
/* 1276 */     return invocation.invokeNext();
View Full Code Here

/*      */   }
/*      */
/*      */   private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject, Object value)
/*      */     throws Throwable
/*      */   {
/* 1290 */     ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass());
/*      */
/* 1292 */     Class calledClass = field.getDeclaringClass();
/* 1293 */     if (isAdvised(calledClass))
/*      */     {
/* 1295 */       if ((advisor != null) && (advisor.hasAspects()))
/*      */       {
/* 1297 */         int index = advisor.getFieldIndex(field);
/* 1298 */         if (index >= 0)
/*      */         {
/* 1300 */           FieldInfo jp = advisor.getFieldWriteInfos()[index];
/* 1301 */           return jp.getWrapper().invoke(null, new Object[] { targetObject, value });
/*      */         }
/*      */       }
/*      */     }
/* 1305 */     return invocation.invokeNext();
View Full Code Here

/* 1319 */       MethodCalledByConstructorInvocation inv = (MethodCalledByConstructorInvocation)invocation;
/* 1320 */       Constructor callingCon = inv.getCalling();
/* 1321 */       Class callingClass = callingCon.getDeclaringClass();
/* 1322 */       if (isAdvised(callingClass))
/*      */       {
/* 1324 */         ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingClass);
/* 1325 */         if (advisor != null)
/*      */         {
/* 1327 */           int index = advisor.getConstructorIndex(callingCon);
/* 1328 */           if (index >= 0)
/*      */           {
/* 1330 */             HashMap calledClassesMap = advisor.getMethodCalledByConInterceptors()[index];
/* 1331 */             if (calledClassesMap != null)
/*      */             {
/* 1333 */               TLongObjectHashMap calledMethods = (TLongObjectHashMap)calledClassesMap.get(method.getDeclaringClass().getName());
/* 1334 */               if (calledMethods != null)
/*      */               {
/* 1336 */                 long calledHash = MethodHashing.calculateHash(method);
/*      */
/* 1338 */                 MethodByConInfo info = (MethodByConInfo)calledMethods.get(calledHash);
/*      */
/* 1340 */                 if ((info != null) && (info.hasAdvices()))
/*      */                 {
/* 1343 */                   return advisor.invokeConstructorCaller(info, inv.getCallingObject(), targetObject, args);
/*      */                 }
/*      */               }
/*      */             }
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/* 1351 */     else if ((invocation instanceof MethodCalledByMethodInvocation))
/*      */     {
/* 1353 */       MethodCalledByMethodInvocation inv = (MethodCalledByMethodInvocation)invocation;
/* 1354 */       Method callingMethod = inv.getCallingMethod();
/* 1355 */       if (isAdvised(callingMethod.getDeclaringClass()))
/*      */       {
/* 1357 */         ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingMethod.getDeclaringClass());
/* 1358 */         if (advisor != null)
/*      */         {
/* 1360 */           long callingMethodHash = MethodHashing.calculateHash(callingMethod);
/* 1361 */           long calledHash = MethodHashing.calculateHash(method);
/*      */
/* 1363 */           HashMap calledClassesMap = (HashMap)advisor.getMethodCalledByMethodInterceptors().get(callingMethodHash);
/* 1364 */           if (calledClassesMap != null)
/*      */           {
/* 1366 */             TLongObjectHashMap calledMethods = (TLongObjectHashMap)calledClassesMap.get(method.getDeclaringClass().getName());
/* 1367 */             if (calledMethods != null)
/*      */             {
/* 1370 */               MethodByMethodInfo info = (MethodByMethodInfo)calledMethods.get(calledHash);
/*      */
/* 1372 */               if ((info != null) && (info.hasAdvices()))
/*      */               {
/* 1375 */                 return advisor.invokeCaller(info, inv.getCallingObject(), targetObject, args);
/*      */               }
/*      */             }
/*      */           }
/*      */         }
/*      */
View Full Code Here

/* 107 */         return (Interceptor)icptr;
/*     */       }
/* 109 */       if ((joinpoint instanceof FieldJoinpoint))
/*     */       {
/* 111 */         FieldJoinpoint field = (FieldJoinpoint)joinpoint;
/* 112 */         ClassAdvisor classAdvisor = (ClassAdvisor)advisor;
/* 113 */         return (Interceptor)classAdvisor.getFieldAspect(field, this.aspect);
/*     */       }
/*     */
/* 116 */       return (Interceptor)this.aspect.getFactory().createPerJoinpoint(advisor, joinpoint);
/*     */     }
/*     */
View Full Code Here

/*  77 */       else if ((joinpoint instanceof FieldJoinpoint))
/*     */       {
/*  79 */         FieldJoinpoint field = (FieldJoinpoint)joinpoint;
/*  80 */         if (Modifier.isStatic(field.getField().getModifiers()))
/*     */         {
/*  82 */           ClassAdvisor classAdvisor = (ClassAdvisor)advisor;
/*  83 */           return (Interceptor)classAdvisor.getFieldAspect(field, def);
/*     */         }
/*     */       }
/*     */     }
/*  87 */     return new PerJoinpointInterceptor(def, advisor, joinpoint);
/*     */   }
View Full Code Here

            }
            if (!isTransformable(ctRef)) continue;

            it.addSuperClass(ctRef);

            ClassAdvisor advisor = manager.getTempClassAdvisor(ctRef);


            if (!manager.getInterceptionMarkers().shouldSkipFieldAccess(ref) && !ref.equals(clazz.getName()))
            {
               List fields = getAdvisableFields(ctRef);
View Full Code Here

   private boolean isTargetConstructorAdvised(CtConstructor calledConstructor)
   {
      try
      {
         ClassAdvisor adv = manager.getTempClassAdvisor(calledConstructor.getDeclaringClass());
         return ConstructorExecutionTransformer.isAdvisableConstructor(calledConstructor, adv);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here

   {
      boolean converted = false;
      for (CtClass reference: getAllReferences(clazz))
      {
         String referenceName = reference.getName();
         ClassAdvisor advisor = reference == clazz? clazzAdvisor:
            manager.getTempClassAdvisor(reference);
         final ClassLoader refCl = reference.getClassPool().getClassLoader();
         InterceptionMarkers markers = manager.getInterceptionMarkers(refCl);

         if (!markers.shouldSkipFieldAccess(referenceName) &&
View Full Code Here

      if (superClass == null || superClass.getName().indexOf("java.") == 0)
      {
         return false;
      }

      ClassAdvisor advisor;
      try
      {
         //TODO Would ideally like to be able to use the existing advisor if class already exists
         advisor = instrumentor.getManager().getTempClassAdvisor(superClass);
      }
View Full Code Here

TOP

Related Classes of org.jboss.aop.ClassAdvisor

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.