Package org.codehaus.aspectwerkz

Examples of org.codehaus.aspectwerkz.DeploymentModel




        // create a field depending on the aspect deployment model

        DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();

        if (deploymentModel.equals(DeploymentModel.PER_JVM) ||

            deploymentModel.equals(DeploymentModel.PER_CLASS)) {

            // add the aspect static field

            cw.visitField(ACC_PRIVATE + ACC_STATIC, aspectInfo.getAspectFieldName(), aspectClassSignature, null, null);

        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {

            // add the aspect field as a non static field

            //TODO - may bee skip the aspect and all its advice is target is static, or ctor call
View Full Code Here


        String aspectClassName = aspectInfo.getAspectClassName();

        // retrieve the aspect set it to the field

        DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();

        if (CflowCompiler.isCflowClass(aspectClassName)) {

            // handle Cflow native aspectOf

            cv.visitMethodInsn(

                    INVOKESTATIC,

                    aspectClassName,

                    CflowCompiler.CFLOW_ASPECTOF_METHOD_NAME,

                    "()"+aspectClassSignature

            );

            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);

        } else if (deploymentModel.equals(DeploymentModel.PER_JVM)) {

            // AW-355, AW-415 we need a ClassLoader here

            cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);

            cv.visitMethodInsn(

                    INVOKEVIRTUAL, CLASS_CLASS, GETCLASSLOADER_METHOD_NAME,

                    CLASS_CLASS_GETCLASSLOADER_METHOD_SIGNATURE

            );

            cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());

            cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());

            cv.visitMethodInsn(

                    INVOKESTATIC,

                    ASPECTS_CLASS_NAME,

                    ASPECT_OF_METHOD_NAME,

                    ASPECT_OF_PER_JVM_METHOD_SIGNATURE

            );

            cv.visitTypeInsn(CHECKCAST, aspectClassName);

            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);

        } else if (deploymentModel.equals(DeploymentModel.PER_CLASS)) {

            cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());

            cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());

            cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);

            cv.visitMethodInsn(

                    INVOKESTATIC,

                    ASPECTS_CLASS_NAME,

                    ASPECT_OF_METHOD_NAME,

                    ASPECT_OF_PER_CLASS_METHOD_SIGNATURE

            );

            cv.visitTypeInsn(CHECKCAST, aspectClassName);

            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);

        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {

        } else {

            throw new UnsupportedOperationException(
View Full Code Here

                              final int joinPointIndex,

                              final AspectInfo aspectInfo) {

        DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();

        if (deploymentModel.equals(DeploymentModel.PER_JVM) ||

            deploymentModel.equals(DeploymentModel.PER_CLASS)) {

            cv.visitFieldInsn(

                    GETSTATIC, m_joinPointClassName, aspectInfo.getAspectFieldName(),

                    aspectInfo.getAspectClassSignature()

            );

        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {

            loadJoinPointInstance(cv, isOptimizedJoinPoint, joinPointIndex);

            cv.visitFieldInsn(
View Full Code Here

                );
                e.printStackTrace();
                continue;
            }

            final DeploymentModel deploymentModel =
                    (deploymentModelAsString != null) ? DeploymentModel.getDeploymentModelFor(deploymentModelAsString)
                    : DeploymentModel.PER_INSTANCE;

            final MixinDefinition mixinDefinition =
                    DefinitionParserHelper.createAndAddMixinDefToSystemDef(
View Full Code Here

                );
                e.printStackTrace();
                continue;
            }

            final DeploymentModel deploymentModel =
                    (deploymentModelAsString != null) ? DeploymentModel.getDeploymentModelFor(deploymentModelAsString)
                    : DeploymentModel.PER_INSTANCE;

            final MixinDefinition mixinDefinition =
                    DefinitionParserHelper.createAndAddMixinDefToSystemDef(
View Full Code Here

            }

            for (Iterator it2 = mixinDefs.iterator(); it2.hasNext();) {
                final MixinDefinition mixinDef = (MixinDefinition) it2.next();
                final ClassInfo mixinImpl = mixinDef.getMixinImpl();
                final DeploymentModel deploymentModel = mixinDef.getDeploymentModel();

                if (m_mixinFields.containsKey(mixinImpl)) {
                    continue;
                }
                final MixinFieldInfo fieldInfo = new MixinFieldInfo();
View Full Code Here

            }

            for (Iterator it2 = mixinDefs.iterator(); it2.hasNext();) {
                final MixinDefinition mixinDef = (MixinDefinition) it2.next();
                final ClassInfo mixinImpl = mixinDef.getMixinImpl();
                final DeploymentModel deploymentModel = mixinDef.getDeploymentModel();

                if (m_mixinFields.containsKey(mixinImpl)) {
                    continue;
                }
                final MixinFieldInfo fieldInfo = new MixinFieldInfo();
View Full Code Here

        List adviceMethodInfosSet = new ArrayList();
        for (int i = 0; i < adviceInfos.length; i++) {
            AdviceInfo adviceInfo = adviceInfos[i];

            // if we have a perinstance deployed aspect and a static member CALLER -> skip and go on
            DeploymentModel deploymentModel = adviceInfo.getAdviceDefinition().getAspectDefinition()
                    .getDeploymentModel();
            if (deploymentModel.equals(DeploymentModel.PER_INSTANCE) &&
                Modifier.isStatic(m_callerMethodModifiers)) {
                continue;
            }

            final String aspectClassName = adviceInfo.getAspectClassName().replace('.', '/');
View Full Code Here

    public static void createAspectReferenceField(final ClassWriter cw,
                                                  final AspectInfo aspectInfo) {
        String aspectClassSignature = aspectInfo.getAspectClassSignature();

        // create a field depending on the aspect deployment model
        DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();
        if (deploymentModel.equals(DeploymentModel.PER_JVM) ||
            deploymentModel.equals(DeploymentModel.PER_CLASS)) {
            // add the aspect static field
            cw.visitField(ACC_PRIVATE + ACC_STATIC, aspectInfo.getAspectFieldName(), aspectClassSignature, null, null);
        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {
            // add the aspect field as a non static field
            //TODO - may bee skip the aspect and all its advice is target is static, or ctor call
            //that is no instance available
            cw.visitField(ACC_PRIVATE, aspectInfo.getAspectFieldName(), aspectClassSignature, null, null);
        } else {
View Full Code Here

                                                 final AspectInfo aspectInfo,
                                                 final String joinPointClassName) {
        String aspectClassSignature = aspectInfo.getAspectClassSignature();
        String aspectClassName = aspectInfo.getAspectClassName();
        // retrieve the aspect set it to the field
        DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();
        if (CflowCompiler.isCflowClass(aspectClassName)) {
            // handle Cflow native aspectOf
            cv.visitMethodInsn(
                    INVOKESTATIC,
                    aspectClassName,
                    CflowCompiler.CFLOW_ASPECTOF_METHOD_NAME,
                    "()"+aspectClassSignature
            );
            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
        } else if (deploymentModel.equals(DeploymentModel.PER_JVM)) {
            // AW-355, AW-415 we need a ClassLoader here
            cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);
            cv.visitMethodInsn(
                    INVOKEVIRTUAL, CLASS_CLASS, GETCLASSLOADER_METHOD_NAME,
                    CLASS_CLASS_GETCLASSLOADER_METHOD_SIGNATURE
            );
            cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());
            cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());
            cv.visitMethodInsn(
                    INVOKESTATIC,
                    ASPECTS_CLASS_NAME,
                    ASPECT_OF_METHOD_NAME,
                    ASPECT_OF_PER_JVM_METHOD_SIGNATURE
            );
            cv.visitTypeInsn(CHECKCAST, aspectClassName);
            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
        } else if (deploymentModel.equals(DeploymentModel.PER_CLASS)) {
            cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());
            cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());
            cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);
            cv.visitMethodInsn(
                    INVOKESTATIC,
                    ASPECTS_CLASS_NAME,
                    ASPECT_OF_METHOD_NAME,
                    ASPECT_OF_PER_CLASS_METHOD_SIGNATURE
            );
            cv.visitTypeInsn(CHECKCAST, aspectClassName);
            cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {
        } else {
            throw new UnsupportedOperationException(
                    "unsupported deployment model - " +
                    aspectInfo.getAspectClassName() + " " +
                    deploymentModel
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.DeploymentModel

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.