Examples of EasyBeansEjbJarMethodMetadata


Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

        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:
                generatedMetadata.setPostConstruct(true);
                break;
            case PRE_DESTROY:
                generatedMetadata.setPreDestroy(true);
                break;
            case PRE_PASSIVATE:
                generatedMetadata.setPrePassivate(true);
                break;
            case POST_ACTIVATE:
                generatedMetadata.setPostActivate(true);
                break;
            default:
                    throw new RuntimeException("No generated method name found for interceptorType '" + interceptorType + "'");
        }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

        if (isInjectedMethod(jMethod)) {
            return false;
        }

        // get method metadata
        EasyBeansEjbJarMethodMetadata method = this.classAnnotationMetadata.getMethodMetadata(jMethod);
        if (method == null) {
            throw new IllegalStateException("Cannot find a method " + jMethod + " in class "
                    + this.classAnnotationMetadata.getClassName());
        }
        return method.isBusinessMethod();
    }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

     * @param jMethod object to check
     * @return true if the given method is an interceptor method (ie AroundInvoke, PostConstruct, etc).
     */
    private boolean isInterceptorMethod(final JMethod jMethod) {
        // get method metadata
        EasyBeansEjbJarMethodMetadata method = this.classAnnotationMetadata.getMethodMetadata(jMethod);
        if (method == null) {
            throw new IllegalStateException("Cannot find a method " + jMethod + " in class "
                    + this.classAnnotationMetadata.getClassName());
        }
        return (method.isAroundInvoke() || method.isLifeCycleMethod());
    }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

            // 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
                            .addStandardMethodMetadata(clonedMethodAnnotationMetadata);


                    // lifecycle / aroundInvoke
                    if (clonedMethodAnnotationMetadata.isPostConstruct()) {
                        beanclassAnnotationMetadata.addPostConstructMethodMetadata(clonedMethodAnnotationMetadata);
                    }
                    if (clonedMethodAnnotationMetadata.isPreDestroy()) {
                        beanclassAnnotationMetadata.addPreDestroyMethodMetadata(clonedMethodAnnotationMetadata);
                    }
                    if (clonedMethodAnnotationMetadata.isPostActivate()) {
                        beanclassAnnotationMetadata.addPostActivateMethodMetadata(clonedMethodAnnotationMetadata);
                    }
                    if (clonedMethodAnnotationMetadata.isPrePassivate()) {
                        beanclassAnnotationMetadata.addPrePassivateMethodMetadata(clonedMethodAnnotationMetadata);
                    }
                    if (clonedMethodAnnotationMetadata.isAroundInvoke()) {
                        beanclassAnnotationMetadata.addAroundInvokeMethodMetadata(clonedMethodAnnotationMetadata);
                    }
                }
            }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

        if (allInterfaces.contains(SESSION_BEAN_INTERFACE)) {
            // first add dependency injection for setSessionContext method.
            JAnnotationResource jAnnotationResource = new JAnnotationResource();

            // add resource on setSessionContext method
            EasyBeansEjbJarMethodMetadata setCtxMethod = getMethod(sessionBean, SETSESSIONCONTEXT_METHOD, false,
                    SESSION_BEAN_INTERFACE);
            setCtxMethod.setJAnnotationResource(jAnnotationResource);


            // ejbRemove() method
            EasyBeansEjbJarMethodMetadata ejbRemoveMethod = getMethod(sessionBean, EJBREMOVE_METHOD, true, SESSION_BEAN_INTERFACE);
            ejbRemoveMethod.setPreDestroy(true);
            if (!sessionBean.getPreDestroyMethodsMetadata().contains(ejbRemoveMethod)) {
                sessionBean.addPreDestroyMethodMetadata(ejbRemoveMethod);
            }

            // ejbActivate() method
            EasyBeansEjbJarMethodMetadata ejbActivateMethod = getMethod(sessionBean, EJBACTIVATE_METHOD, true, SESSION_BEAN_INTERFACE);
            ejbRemoveMethod.setPostActivate(true);
            if (!sessionBean.getPostActivateMethodsMetadata().contains(ejbActivateMethod)) {
                sessionBean.addPostActivateMethodMetadata(ejbActivateMethod);
            }

            // ejbPassivate() method
            EasyBeansEjbJarMethodMetadata ejbPassivateMethod = getMethod(sessionBean, EJBPASSIVATE_METHOD, true,
                    SESSION_BEAN_INTERFACE);
            ejbRemoveMethod.setPrePassivate(true);
            if (!sessionBean.getPrePassivateMethodsMetadata().contains(ejbPassivateMethod)) {
                sessionBean.addPrePassivateMethodMetadata(ejbPassivateMethod);
            }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

     */
    public static void resolve(final EasyBeansEjbJarClassMetadata sessionBean) {

        Iterator<EasyBeansEjbJarMethodMetadata> itMethods = sessionBean.getMethodMetadataCollection().iterator();
        while (itMethods.hasNext()) {
            EasyBeansEjbJarMethodMetadata method = itMethods.next();
            IJavaxJwsWebMethod webMethod = method.getJavaxJwsWebMethod();
            // Annotation present and not excluded
            if (webMethod != null && !webMethod.getExclude()) {
                method.setBusinessMethod(true);
            }
        }
    }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

                if (itfMethod.getName().equals(CLASS_INIT) || itfMethod.getName().equals(CONST_INIT)) {
                    continue;
                }

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

            // loop again
            if (itfMetadata.getInterfaces() != null) {
                loop(beanclassAnnotationMetadata, itfMetadata, visitedInterfaces);
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

    }

    @Override
    protected IMethodConfigurator createMethodMetadataConfigurator(final JMethod method,
            final EasyBeansEjbJarClassMetadata classMetadata, final boolean annotationParsingDesactived) {
        EasyBeansEjbJarMethodMetadata methodMetadata = new EasyBeansEjbJarMethodMetadata(method, classMetadata);
        return new EasyBeansEjbJarMethodMetadataConfigurator(methodMetadata, annotationParsingDesactived);
    }
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

     * @param bean bean to validate.
     */
    public static void validate(final EasyBeansEjbJarClassMetadata bean) {

        // Existing timer method
        EasyBeansEjbJarMethodMetadata alreadyFoundTimerMethod = null;

        // Get timer method if any and do a call on this timer method
        for (EasyBeansEjbJarMethodMetadata method : bean.getMethodMetadataCollection()) {

            // Check if the timeout method is valid
View Full Code Here

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarMethodMetadata

        // if TIMEDOBJECT_INTERFACE is contained in the list, add some metadata
        if (allInterfaces.contains(TIMEDOBJECT_INTERFACE)) {

            // Flag the method as the timeout method
            EasyBeansEjbJarMethodMetadata timeoutMethod = getMethod(bean, EJBTIMEOUT_METHOD, true, TIMEDOBJECT_INTERFACE);
            timeoutMethod.setTimeout(true);
        }


    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.