Package org.ow2.asm.tree

Examples of org.ow2.asm.tree.IntInsnNode


            metadataRemove = new EasyBeansEjbJarMethodMetadata(REMOVE_METHOD, bean);
            bean.addStandardMethodMetadata(metadataRemove);
        }

        // flag method as a remove method
        metadataRemove.setRemove(new JRemove());
        metadataRemove.setBusinessMethod(true);


        // Flag ejbXXX() method as business method (so interceptors are invoked)
        for (EasyBeansEjbJarMethodMetadata methodData : bean.getMethodMetadataCollection()) {
View Full Code Here


                throw new DeployerException("Cannot get the URL for the archive '" + war.getArchive() + "'.", e);
            }


            // Analyze the war archive
            IWarDeployableMetadata warDeployableMetadata = null;
            try {
                warDeployableMetadata = new WarDeployableMetadataFactory().createDeployableMetadata(war);
            } catch (DeployableMetadataException e) {
                logger.error("Unable to analyze the metadata of the war '" + warURL + "'.", e);
            }
View Full Code Here


            // Analyze the war archive
            IWarDeployableMetadata warDeployableMetadata = null;
            try {
                warDeployableMetadata = new WarDeployableMetadataFactory().createDeployableMetadata(war);
            } catch (DeployableMetadataException e) {
                logger.error("Unable to analyze the metadata of the war '" + warURL + "'.", e);
            }

            // Now, get the bindings for this web application
View Full Code Here

                        + "' referenced in the home/localhome of the bean '" + bean.getClassName() + "'.");
            }

            // Get all methods
            for (EasyBeansEjbJarMethodMetadata methodData : interfaceUsed.getMethodMetadataCollection()) {
                JMethod itfMethod = methodData.getJMethod();

                // Ignore class init method
                if (itfMethod.getName().equals(BusinessMethodResolver.CLASS_INIT)
                        || itfMethod.getName().equals(BusinessMethodResolver.CONST_INIT)) {
                    continue;
                }

                // take the method from the bean class
                EasyBeansEjbJarMethodMetadata beanMethod = bean.getMethodMetadata(itfMethod);
                if (beanMethod == null) {
                    throw new IllegalStateException("No method was found for method " + itfMethod + " in class "
                            + bean.getClassName());
                }
                beanMethod.setBusinessMethod(true);
            }

        }

        // Add remove method
        EasyBeansEjbJarMethodMetadata metadataRemove = bean.getMethodMetadata(REMOVE_METHOD);
        // not present ? add it
        if (metadataRemove == null) {
            metadataRemove = new EasyBeansEjbJarMethodMetadata(REMOVE_METHOD, bean);
            bean.addStandardMethodMetadata(metadataRemove);
        }

        // flag method as a remove method
        metadataRemove.setRemove(new JRemove());
        metadataRemove.setBusinessMethod(true);


        // Flag ejbXXX() method as business method (so interceptors are invoked)
        for (EasyBeansEjbJarMethodMetadata methodData : bean.getMethodMetadataCollection()) {
          JMethod method = methodData.getJMethod();
          if (method.getName().startsWith("ejbActivate") || method.getName().startsWith("ejbCreate")) {
            if ("()V".equals(method.getDescriptor())) {
              methodData.setBusinessMethod(true);
            }
          }
        }
View Full Code Here

        // Get methods
        for (EasyBeansEjbJarMethodMetadata method : homeMetadata.getMethodMetadataCollection()) {
            // if method name begins with "create", it's matching
            if (method.getMethodName().startsWith("create")) {
                // Get return type
                JMethod jMethod = method.getJMethod();
                Type returnType = Type.getReturnType(jMethod.getDescriptor());
                String returnTypeClassname = returnType.getClassName();
                // Not yet present in the list ? add it
                if (!interfacesList.contains(returnTypeClassname)) {
                    interfacesList.add(returnTypeClassname.replace(".", "/"));
                }
View Full Code Here

     *         this method.
     */
    @Override
    public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature,
            final String[] exceptions) {
        JMethod jMethod = new JMethod(access, name, desc, signature, exceptions);
        String newName = name;
        int newAccess = access;

        // Intercepted method : need to change the method name for Beans
        if (isInterceptedMethod(jMethod) && this.classAnnotationMetadata.isBean()) {
View Full Code Here

     * @param method the annotation metadata of the method
     */
    private void generateCallSuperEncodedMethod(final EasyBeansEjbJarMethodMetadata method) {

        String generatedMethodName = MethodRenamer.encode(method.getMethodName());
        JMethod jMethod = method.getJMethod();
        MethodVisitor mv = this.cv.visitMethod(jMethod.getAccess(), generatedMethodName,
                jMethod.getDescriptor(), jMethod.getSignature(), jMethod.getExceptions());

        // Add some flags on the generated method
        CommonClassGenerator.addAnnotationsOnGeneratedMethod(mv);

        mv.visitCode();

        // Add bean (as first argument)
        mv.visitVarInsn(ALOAD, 0);

        // for each argument
        Type[] args = Type.getArgumentTypes(jMethod.getDescriptor());
        int methodArg = 1;
        for (Type type : args) {
            int opCode = CommonClassGenerator.putFieldLoadOpCode(type.getSort());
            mv.visitVarInsn(opCode, methodArg);
            // Double and Long are special parameters
            if (opCode == LLOAD || opCode == DLOAD) {
                methodArg++;
            }
            methodArg++;
        }

        // call super class method()
        mv.visitMethodInsn(INVOKESPECIAL, method.getClassMetadata().getSuperName(),
                jMethod.getName(), jMethod.getDescriptor());

        Type returnType = Type.getReturnType(jMethod.getDescriptor());
        CommonClassGenerator.addReturnType(returnType, mv);


        mv.visitMaxs(0, 0);
        mv.visitEnd();
View Full Code Here

            // Takes method metadata of the super class and adds them to the
            // bean class
            // Note : the flag inherited is set to true
            for (EasyBeansEjbJarMethodMetadata methodAnnotationMetadata : superClassMetadata.getMethodMetadataCollection()) {
                // check that the method has not be redefined
                JMethod method = methodAnnotationMetadata.getJMethod();

                EasyBeansEjbJarMethodMetadata beanMethod = beanclassAnnotationMetadata.getMethodMetadata(method);

                // overriding ?
                boolean overrided = true;
                overrided = !((method.getAccess() & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE);

                // Add only if it is not present or if current method is not
                // overriding super method (it means super method is private)
                if (beanMethod == null || (!overrided && beanMethod != null && !beanMethod.isInherited())) {

                    // Add a clone of the method to bean class
                    EasyBeansEjbJarMethodMetadata clonedMethodAnnotationMetadata =
                        (EasyBeansEjbJarMethodMetadata) methodAnnotationMetadata.clone();
                    // set new class linked to this method metadata
                    clonedMethodAnnotationMetadata
                            .setClassMetadata(beanclassAnnotationMetadata);

                    // method is inherited
                    clonedMethodAnnotationMetadata.setInherited(true, superClassMetadata);

                    // Final method ? ignore it
                    if ((method.getAccess() & Opcodes.ACC_FINAL) == Opcodes.ACC_FINAL) {
                        logger.warn("Ignoring final method ''{0}'' from the class ''{1}''", method.getName(),
                                beanclassAnnotationMetadata.getClassName());
                        clonedMethodAnnotationMetadata.setIgnored(true);
                    }

                    beanclassAnnotationMetadata
View Full Code Here

        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();

        // add method in the class metadata
        JMethod method = new JMethod(ACC_PUBLIC, generatedMethodName, "()V", null, null);
        EasyBeansEjbJarMethodMetadata generatedMetadata = new EasyBeansEjbJarMethodMetadata(method, classMetaData);

        // Set value
        switch (interceptorType) {
            case POST_CONSTRUCT:
View Full Code Here

            }

            // for each method of the interface, set the business method to true
            // in bean
            for (EasyBeansEjbJarMethodMetadata methodData : itfMetadata.getMethodMetadataCollection()) {
                JMethod itfMethod = methodData.getJMethod();

                // Ignore class init method
                if (itfMethod.getName().equals(CLASS_INIT) || itfMethod.getName().equals(CONST_INIT)) {
                    continue;
                }

                // take the method from the bean class
                EasyBeansEjbJarMethodMetadata beanMethod = beanclassAnnotationMetadata.getMethodMetadata(itfMethod);
View Full Code Here

TOP

Related Classes of org.ow2.asm.tree.IntInsnNode

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.