Package org.codehaus.aspectwerkz

Examples of org.codehaus.aspectwerkz.IndexTuple


    public Object proceed(final JoinPointBase joinPoint) throws Throwable {
        if (!joinPoint.isInCflow()) {
            return null;
        }
        for (int i = m_adviceIndexes.length - 1; i >= 0; i--) {
            IndexTuple index = m_adviceIndexes[i];
            int aspectIndex = index.getAspectIndex();
            int methodIndex = index.getMethodIndex();
            index.getAspectManager().getAspectContainer(aspectIndex).invokeAdvice(methodIndex, joinPoint);
        }
        return null;
    }
View Full Code Here


     * Records entering into cflow.
     *
     * @param joinPointInfo
     */
    private void enterCflow(final JoinPointInfo joinPointInfo) throws Throwable {
        IndexTuple enter = joinPointInfo.enterCflow;
        if (enter != null) {
            enter.getAspectManager().getAspectContainer(enter.getAspectIndex()).invokeAdvice(
                    enter.getMethodIndex(),
                    joinPointInfo.joinPoint
            );
        }
    }
View Full Code Here

     * Records exiting from cflow.
     *
     * @param joinPointInfo
     */
    private void exitCflow(final JoinPointInfo joinPointInfo) throws Throwable {
        IndexTuple exit = joinPointInfo.exitCflow;
        if (exit != null) {
            exit.getAspectManager().getAspectContainer(exit.getAspectIndex()).invokeAdvice(
                    exit.getMethodIndex(),
                    joinPointInfo.joinPoint
            );
        }
    }
View Full Code Here

        if (hasBeforeAfterAdvice) {
            cv.visitLabel(switchCaseLabels[0]);

            // add invocations to the before advices
            for (int i = 0; i < beforeAdvices.length; i++) {
                IndexTuple beforeAdvice = beforeAdvices[i];
                AspectContainer container = beforeAdvice.getAspectManager().getAspectContainer(
                        beforeAdvice
                        .getAspectIndex()
                );
                Method adviceMethod = container.getAdvice(beforeAdvice.getMethodIndex());
                String aspectClassName = container.getCrossCuttingInfo().getAspectClass().getName().replace('.', '/');
                String aspectFieldName = BEFORE_ADVICE_FIELD_PREFIX + i;
                String aspectClassSignature = L + aspectClassName + SEMICOLON;
                cv.visitVarInsn(Constants.ALOAD, 0);
                cv.visitFieldInsn(Constants.GETFIELD, className, aspectFieldName, aspectClassSignature);
                cv.visitVarInsn(Constants.ALOAD, 0);
                cv.visitMethodInsn(
                        Constants.INVOKEVIRTUAL, aspectClassName, adviceMethod.getName(),
                        BEFORE_ADVICE_METHOD_SIGNATURE
                );
            }

            // add invocation to this.proceed
            cv.visitVarInsn(Constants.ALOAD, 0);
            cv.visitMethodInsn(Constants.INVOKEVIRTUAL, className, PROCEED_METHOD_NAME, PROCEED_METHOD_SIGNATURE);
            cv.visitVarInsn(Constants.ASTORE, 1);

            // add invocations to the after advices
            for (int i = afterAdvices.length - 1; i >= 0; i--) {
                IndexTuple afterAdvice = afterAdvices[i];
                AspectContainer container = afterAdvice.getAspectManager().getAspectContainer(
                        afterAdvice
                        .getAspectIndex()
                );
                Method adviceMethod = container.getAdvice(afterAdvice.getMethodIndex());
                String aspectClassName = container.getCrossCuttingInfo().getAspectClass().getName().replace('.', '/');
                String aspectFieldName = AFTER_ADVICE_FIELD_PREFIX + i;
                String aspectClassSignature = L + aspectClassName + SEMICOLON;
                cv.visitVarInsn(Constants.ALOAD, 0);
                cv.visitFieldInsn(Constants.GETFIELD, className, aspectFieldName, aspectClassSignature);
View Full Code Here

        int j = 0;
        if (hasBeforeAfterAdvice) {
            j = 1;
        }
        for (; i < aroundAdvices.length; i++, j++) {
            IndexTuple aroundAdvice = aroundAdvices[i];
            AspectContainer container = aroundAdvice.getAspectManager().getAspectContainer(
                    aroundAdvice.getAspectIndex()
            );
            Method adviceMethod = container.getAdvice(aroundAdvice.getMethodIndex());
            String aspectClassName = container.getCrossCuttingInfo().getAspectClass().getName().replace('.', '/');
            String aspectFieldName = AROUND_ADVICE_FIELD_PREFIX + i;
            String aspectClassSignature = L + aspectClassName + SEMICOLON;
            cv.visitLabel(switchCaseLabels[j]);
            cv.visitVarInsn(Constants.ALOAD, 0);
View Full Code Here

    public Object proceed(final JoinPointBase joinPoint) throws Throwable {
        if (!joinPoint.isInCflow()) {
            return null;
        }
        for (int i = 0, j = m_adviceIndexes.length; i < j; i++) {
            IndexTuple index = m_adviceIndexes[i];
            int aspectIndex = index.getAspectIndex();
            int methodIndex = index.getMethodIndex();
            index.getAspectManager().getAspectContainer(aspectIndex).invokeAdvice(methodIndex, joinPoint);
        }
        return null;
    }
View Full Code Here

                    m_currentAdviceIndex = m_adviceIndexes.length - 1;
                }
            } else {
                m_currentAdviceIndex++;
                try {
                    IndexTuple index = m_adviceIndexes[m_currentAdviceIndex];
                    AspectContainer container = index.getAspectManager().getAspectContainer(index.getAspectIndex());
                    result = container.invokeAdvice(index.getMethodIndex(), joinPoint);
                } finally {
                    m_currentAdviceIndex--;
                }
            }
            if (m_stackIndex == 0) {
View Full Code Here

                                // retrieve a sorted advices list => matches the sorted method list in the aspectContainer
                                List advices = crossCuttingInfo.getAspectDefinition().getAllAdvices();
                                for (Iterator it = advices.iterator(); it.hasNext();) {
                                    final AdviceDefinition adviceDef = (AdviceDefinition)it.next();
                                    IndexTuple tuple = new IndexTuple(
                                            indexAspect, adviceDef.getMethodIndex(),
                                            m_aspectManager
                                    );

                                    //prefix AdviceName with AspectName to allow AspectReuse
View Full Code Here

     */
    public IndexTuple getAdviceIndexFor(final String name) {
        if (name == null) {
            throw new IllegalArgumentException("advice name can not be null");
        }
        final IndexTuple index = (IndexTuple)m_adviceIndexes.get(name);
        if (index == null) {
            throw new DefinitionException("advice " + name + " is not properly defined");
        }
        return index;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.IndexTuple

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.