Package org.codehaus.aspectwerkz.joinpoint

Examples of org.codehaus.aspectwerkz.joinpoint.JoinPoint


     * Helper method, pop the rtti from the stack and reset the JP with the next on stack
     *
     * @param joinPointInfo
     */
    private static void unsetRtti(final JoinPointInfo joinPointInfo) {
        JoinPoint joinPoint = joinPointInfo.joinPoint;
        // pop the old RTTI from the stack
        joinPointInfo.rttiStack.pop();
        // and peek the next one to pass it back to the joinpoint if there is one (else it means out of cflow)
        if (!joinPointInfo.rttiStack.isEmpty()) {
            ((JoinPointBase)joinPoint).setRtti((Rtti)joinPointInfo.rttiStack.peek());
View Full Code Here


     *
     * @param joinPointInfo
     * @param rtti
     */
    private static void setRtti(final JoinPointInfo joinPointInfo, final Rtti rtti) {
        JoinPoint joinPoint = joinPointInfo.joinPoint;
        ((JoinPointBase)joinPoint).setRtti(rtti);
        joinPointInfo.rttiStack.push(rtti);
    }
View Full Code Here

   

    for(int i = 0; i < s_joinPoints.size(); i++) {

      JoinPoint jp = (JoinPoint) s_joinPoints.get(i);

     

      assertNull(jp.getCaller());

     

      assertNull(jp.getThis());

     

      assertNull(jp.getCallee());

     

      assertNull(jp.getTarget());

     

      Rtti rtti = jp.getRtti();

     

      assertNotNull(rtti);
View Full Code Here

     

      for(int i = 0; i < s_joinPoints.size(); i++) {

          JoinPoint jp = (JoinPoint) s_joinPoints.get(i);

         

          assertEquals(CALLER_CLASS_NAME, jp.getCallerClass().getName());

          assertEquals(CALLEE_CLASS_NAME[i], jp.getCalleeClass().getName());

          assertEquals(CALLER_INSTANCE, String.valueOf(jp.getCaller()));

          assertEquals(CALLER_INSTANCE, String.valueOf(jp.getThis()));

         

          if(i < 4 || i > s_joinPoints.size() - 3) { // CTORS and HANDLERS CALLEE

              assertNotNull(jp.getCallee());

              assertNotNull(jp.getTarget());

          } else {

              assertEquals(CALLER_INSTANCE, String.valueOf(jp.getCallee()));

              assertEquals(CALLER_INSTANCE, String.valueOf(jp.getTarget()));

          }

         

          Rtti rtti = jp.getRtti();

         

          assertTrue("expected " + RTTI_CLASS[i].getName() + " found " + rtti.getClass().getName(),
View Full Code Here

    );
   
    Class siRtti = StaticInitializationRttiImpl.class;
   
    for(int i = 0; i < s_joinPoints.size(); i++) {
      JoinPoint jp = (JoinPoint) s_joinPoints.get(i);
     
      assertNull(jp.getCaller());
     
      assertNull(jp.getThis());
     
      assertNull(jp.getCallee());
     
      assertNull(jp.getTarget());
     
      Rtti rtti = jp.getRtti();
     
      assertNotNull(rtti);
     
      assertEquals(siRtti,
                   rtti.getClass());
View Full Code Here

              EXPECTED_SIGNATURES.length,
              s_joinPoints.size()
      );
     
      for(int i = 0; i < s_joinPoints.size(); i++) {
          JoinPoint jp = (JoinPoint) s_joinPoints.get(i);
         
          assertEquals(CALLER_CLASS_NAME, jp.getCallerClass().getName());
          assertEquals(CALLEE_CLASS_NAME[i], jp.getCalleeClass().getName());
          assertEquals(CALLER_INSTANCE, String.valueOf(jp.getCaller()));
          assertEquals(CALLER_INSTANCE, String.valueOf(jp.getThis()));
         
          if(i < 4 || i > s_joinPoints.size() - 3) { // CTORS and HANDLERS CALLEE
              assertNotNull(jp.getCallee());
              assertNotNull(jp.getTarget());
          } else {
              assertEquals(CALLER_INSTANCE, String.valueOf(jp.getCallee()));
              assertEquals(CALLER_INSTANCE, String.valueOf(jp.getTarget()));
          }
         
          Rtti rtti = jp.getRtti();
         
          assertTrue("expected " + RTTI_CLASS[i].getName() + " found " + rtti.getClass().getName(),
                  RTTI_CLASS[i].isAssignableFrom(rtti.getClass()));
      }
  }
View Full Code Here

            handleJitCompilation(
                    methodHash, joinPointType, PointcutType.EXECUTION, joinPointInfo, m_targetClass, m_targetClass
            );
        }

        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, methodHash);

            AdviceContainer[] adviceIndexes = null;
            switch (joinPointType) {
                case JoinPointType.METHOD_EXECUTION:
                    adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.EXECUTION);
                    joinPoint = createMethodJoinPoint(methodHash, joinPointType, m_targetClass, adviceIndexes);
                    break;

                case JoinPointType.CONSTRUCTOR_EXECUTION:
                    adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.EXECUTION);
                    joinPoint = createConstructorJoinPoint(methodHash, joinPointType, m_targetClass, adviceIndexes);
                    break;

                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            }
            else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // set the RTTI
        ((JoinPointBase)joinPoint).setTargetInstance(targetInstance);
        if (parameters != null) {
            ((CodeSignature)joinPoint.getSignature()).setParameterValues(parameters);
        }

        return ((JoinPointBase)joinPoint).proceed();
    }
View Full Code Here

            handleJitCompilation(
                    methodHash, joinPointType, PointcutType.CALL, joinPointInfo, declaringClass, m_targetClass
            );
        }

        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, methodHash);
            AdviceContainer[] adviceIndexes = null;
            switch (joinPointType) {
                case JoinPointType.METHOD_CALL:
                    adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.CALL);
                    joinPoint = createMethodJoinPoint(methodHash, joinPointType, declaringClass, adviceIndexes);
                    break;

                case JoinPointType.CONSTRUCTOR_CALL:
                    adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.CALL);
                    joinPoint = createConstructorJoinPoint(methodHash, joinPointType, declaringClass, adviceIndexes);
                    break;

                default:
                    throw new RuntimeException("join point type not valid");
            }

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            }
            else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        ((JoinPointBase)joinPoint).setTargetInstance(targetInstance);
        if (parameters != null) {
            ((CodeSignature)joinPoint.getSignature()).setParameterValues(parameters);
        }

        return ((JoinPointBase)joinPoint).proceed();
    }
View Full Code Here

            handleJitCompilation(
                    fieldHash, JoinPointType.FIELD_SET, PointcutType.SET, joinPointInfo, declaringClass, m_targetClass
            );
        }

        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, fieldHash);

            AdviceContainer[] adviceIndexes = null;
            adviceIndexes = (AdviceContainer[])pointcutTypeToAdvicesMap.get(PointcutType.SET);
            joinPoint =
            createFieldJoinPoint(fieldHash, fieldSignature, JoinPointType.FIELD_SET, m_targetClass, adviceIndexes);

            // set the join point
            joinPointInfo.joinPoint = joinPoint;

            // update the state
            if (adviceIndexes.length == 0) {
                joinPointInfo.state = JoinPointState.ADVISED;
            }
            else {
                joinPointInfo.state = JoinPointState.HAS_ADVICES;
            }
        }

        // intialize the join point before each usage
        ((JoinPointBase)joinPoint).setTargetInstance(targetInstance);
        if (fieldValue[0] != null) {
            ((FieldSignature)joinPoint.getSignature()).setFieldValue(fieldValue[0]);
        }
        ((JoinPointBase)joinPoint).proceed();
    }
View Full Code Here

            handleJitCompilation(
                    fieldHash, JoinPointType.FIELD_GET, PointcutType.GET, joinPointInfo, declaringClass, m_targetClass
            );
        }

        JoinPoint joinPoint = joinPointInfo.joinPoint;

        // if null or redefined -> create a new join point and cache it
        if (joinPoint == null) {
            Map pointcutTypeToAdvicesMap = s_registry.getAdvicesForJoinPoint(m_classHash, fieldHash);
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.joinpoint.JoinPoint

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.