Examples of EasyBeansEjbJarMethodMetadata


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

                    // If the method is overriden, take care of using the
                    // annotation of the lower class in the inheritance classes.
                    // As the method is only add once for a single interceptor
                    // class.
                    EasyBeansEjbJarMethodMetadata analyzedMethod = method;
                    EasyBeansEjbJarMethodMetadata methodSubClass = interceptorMetadata.getMethodMetadata(method
                            .getJMethod());
                    if (methodSubClass != null) {
                        analyzedMethod = methodSubClass;
                    }
View Full Code Here

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

        // For Bean only
        if (this.classAnnotationMetadata.isBean()) {
            // Add default lifecycle methods. These methods will call defined
            // lifecycle callback method and super methods or will do nothing.
            EasyBeansEjbJarMethodMetadata posConsMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, POST_CONSTRUCT);
            EasyBeansEjbJarMethodMetadata preDesMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, PRE_DESTROY);
            EasyBeansEjbJarMethodMetadata postActMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, POST_ACTIVATE);
            EasyBeansEjbJarMethodMetadata prePassMetaData = generateBeanLifeCycleMethod(this.classAnnotationMetadata, PRE_PASSIVATE);

            // Generate class for dependency injection
            generateClass(
                    new EasyBeansEjbJarMethodMetadata(InjectionClassAdapter.INJECTED_JMETHOD, this.classAnnotationMetadata),
                    DEP_INJECT);

            // Generate class for timer
            // Create the method by cloning the existing timer method
            EasyBeansEjbJarMethodMetadata timerMethodAnnotationMetadata = null;
            for (EasyBeansEjbJarMethodMetadata m : this.classAnnotationMetadata.getMethodMetadataCollection()) {
                // Found the timer method ?
                if (m.isTimeout()) {
                    // clone this method (to get the correct interceptors, etc)
                    timerMethodAnnotationMetadata = (EasyBeansEjbJarMethodMetadata) m.clone();
                    // Change the method name to the generated method
                    timerMethodAnnotationMetadata.setJMethod(BeanClassAdapter.TIMER_JMETHOD);

                    // set the class
                    timerMethodAnnotationMetadata.setClassMetadata(this.classAnnotationMetadata);
                    // It is not inherited as it's build on this class level
                    timerMethodAnnotationMetadata.setInherited(false, null);
                    break;
                }

            }
            // build an empty one if not built just before
            if (timerMethodAnnotationMetadata == null) {
                timerMethodAnnotationMetadata = new EasyBeansEjbJarMethodMetadata(BeanClassAdapter.TIMER_JMETHOD,
                        this.classAnnotationMetadata);
            }
            // Generate the class
            generateClass(timerMethodAnnotationMetadata, TIMED_OBJECT);
View Full Code Here

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

                        || 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);
            }
          }
        }

        // Add isIdentical on EJBObject and EJBLocalObject
        bean.addStandardMethodMetadata(new EasyBeansEjbJarMethodMetadata(ISIDENTICAL_METHOD, bean));
        bean.addStandardMethodMetadata(new EasyBeansEjbJarMethodMetadata(ISIDENTICAL_LOCAL_METHOD, bean));

        // GetHandle
        bean.addStandardMethodMetadata(new EasyBeansEjbJarMethodMetadata(GETHANDLE_METHOD, bean));

        // GetPrimaryKey
        bean.addStandardMethodMetadata(new EasyBeansEjbJarMethodMetadata(GETPRIMARYKEY_METHOD, bean));

    }
View Full Code Here

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

     * @throws ResolverException if there is a failure in a resolver
     */
    public static void resolve(final EasyBeansEjbJarClassMetadata mdbBean) throws ResolverException {

        // ejbCreate() method
        EasyBeansEjbJarMethodMetadata ejbCreateMethod = getMethod(mdbBean, EJBCREATE_METHOD, true, MDB_METHODS, false);
        if (ejbCreateMethod != null) {
            ejbCreateMethod.setPostConstruct(true);
            if (!mdbBean.getPostConstructMethodsMetadata().contains(ejbCreateMethod)) {
                mdbBean.addPostConstructMethodMetadata(ejbCreateMethod);
            }
        }

        // ejbRemove() method
        EasyBeansEjbJarMethodMetadata ejbRemoveMethod = getMethod(mdbBean, EJBREMOVE_METHOD, true, MDB_METHODS, false);
        if (ejbRemoveMethod != null) {
            ejbRemoveMethod.setPreDestroy(true);
            if (!mdbBean.getPreDestroyMethodsMetadata().contains(ejbRemoveMethod)) {
                mdbBean.addPreDestroyMethodMetadata(ejbRemoveMethod);
            }
        }

View Full Code Here

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

     */
    public static void resolve(final EasyBeansEjbJarClassMetadata sessionBean) {
        //TODO: use of another interface than JMS

        // Set business method for onMessage Method (JMS)
        EasyBeansEjbJarMethodMetadata onMessageMethod = sessionBean.getMethodMetadata(ONMESSAGE_METHOD);
        if (onMessageMethod != null) {
            onMessageMethod.setBusinessMethod(true);
        }

    }
View Full Code Here

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

     * @param notFoundException if true, throws an exception if method is not present
     * @return the method metadata, else exception
     */
    public static EasyBeansEjbJarMethodMetadata getMethod(final EasyBeansEjbJarClassMetadata bean, final JMethod jMethod,
            final boolean inherited, final String interfaceName, final boolean notFoundException) {
        EasyBeansEjbJarMethodMetadata method = bean.getMethodMetadata(jMethod);
        if (method == null) {
            if (notFoundException) {
                throw new IllegalStateException("Bean '" + bean + "' implements " + interfaceName
                    + " but no " + jMethod + " method found in metadata");
            }
            return null;
        }
        // gets the correct method on the correct level. (not the inherited method) if we don't want the inherited method.
        if (method.isInherited() && !inherited) {
            String superClassName = bean.getSuperName();
            // loop while class is not java.lang.Object
            while (!JAVA_LANG_OBJECT.equals(superClassName)) {
                EasyBeansEjbJarClassMetadata superMetaData = bean.getLinkedClassMetadata(superClassName);
                // If the method is found in the super class and is not inherited, use this one
                if (superMetaData != null) {
                    EasyBeansEjbJarMethodMetadata superMethod = superMetaData.getMethodMetadata(jMethod);
                    if (superMethod != null && !superMethod.isInherited()) {
                        return superMethod;
                    }
                    superClassName = superMetaData.getSuperName();
                } else {
                    // break the loop
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.