Examples of EasyBeansEjbJarClassMetadata


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

            if (superClass.equals(JAVA_LANG_OBJECT)) {
                return;
            }

            // Get meta data of the super class
            EasyBeansEjbJarClassMetadata superClassMetadata = beanclassAnnotationMetadata.getLinkedClassMetadata(superClass);

            if (superClassMetadata == null) {
                // TODO : I18n
                throw new ResolverException("The class " + beanclassAnnotationMetadata + " extends the class " + superClass
                        + "but this class seems to be outside of the ejb-jar");
            }

            // 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);
View Full Code Here

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

            }
            // add as visited
            visitedInterfaces.add(itf);

            // get meta data of the interface
            EasyBeansEjbJarClassMetadata itfMetadata = visitingclassAnnotationMetadata.getLinkedClassMetadata(itf);

            if (itfMetadata == null) {
                logger.warn("No class was found for interface {0}.", itf);
                continue;
            }

            // 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);
                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.EasyBeansEjbJarClassMetadata

        // First, call the super class method (if the super class has been
        // analyzed) and if there is one
        String superNameClass = this.classAnnotationMetadata.getSuperName();
        if (superNameClass != null && !superNameClass.equals(JAVA_LANG_OBJECT)) {
            EasyBeansEjbJarClassMetadata superMetadata = this.classAnnotationMetadata.getLinkedClassMetadata(superNameClass);
            if (superMetadata != null) {
                if (!this.staticMode) {
                    // generate call to super method : super.INJECTED_METHOD();
                    mv.visitVarInsn(ALOAD, 0);
                    mv.visitMethodInsn(INVOKESPECIAL, superMetadata.getClassName(), INJECTED_METHOD, "()V");
                } else {
                    mv.visitMethodInsn(INVOKESTATIC, superMetadata.getClassName(), INJECTED_METHOD, "()V");
                }
            }
        }

View Full Code Here

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

        // For each bean, get the interfaces and add the jndiName mapping.
        List<String> beanNames = ejbJarArchiveMetadata.getBeanNames();
        for (String beanName : beanNames) {
            List<String> keys = ejbJarArchiveMetadata.getClassesnameForBean(beanName);
            for (String key : keys) {
                EasyBeansEjbJarClassMetadata classAnnotationMetadata =  ejbJarArchiveMetadata.getClassForBean(beanName, key);
                if (classAnnotationMetadata.isBean()) {

                    // Look at local interfaces
                    IJLocal localItfs = classAnnotationMetadata.getLocalInterfaces();
                    IJRemote remoteItfs = classAnnotationMetadata.getRemoteInterfaces();
                    if (localItfs != null) {
                        for (String itf : localItfs.getInterfaces()) {
                            EZBBeanNamingInfo namingInfo = BeanNamingInfoHelper.buildInfo(classAnnotationMetadata, itf, "Local",
                                    this.applicationName);
                            addInterface(namingInfo, namingStrategy, url);
                        }
                    }

                    // Look at remote interfaces
                    if (remoteItfs != null) {
                        for (String itf : remoteItfs.getInterfaces()) {
                            EZBBeanNamingInfo namingInfo = BeanNamingInfoHelper.buildInfo(classAnnotationMetadata, itf, "Remote",
                                    this.applicationName);
                            addInterface(namingInfo, namingStrategy, url);
                        }
                    }

                    // Remote Home
                    String remoteHome = classAnnotationMetadata.getRemoteHome();
                    if (remoteHome != null) {
                        EZBBeanNamingInfo namingInfo = BeanNamingInfoHelper.buildInfo(classAnnotationMetadata, remoteHome,
                                "RemoteHome", this.applicationName);
                        addInterface(namingInfo, namingStrategy, url);
                    }

                    // Local Home
                    String localHome = classAnnotationMetadata.getLocalHome();
                    if (localHome != null) {
                        EZBBeanNamingInfo namingInfo = BeanNamingInfoHelper.buildInfo(classAnnotationMetadata, localHome,
                                "LocalHome", this.applicationName);
                        addInterface(namingInfo, namingStrategy, url);
                    }
View Full Code Here

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

                List<Session> sessionList = ejb.getSessions();
                if (sessionList != null) {
                    for (Session session : sessionList) {
                        // get ejb-name
                        String ejbName = session.getEjbName();
                        EasyBeansEjbJarClassMetadata classAnnotationMetadata = this.ejbMetadata
                                .getEjbJarClassMetadataForEjbName(ejbName);

                        // class is found, then apply all customization.
                        applySessionBean(session, classAnnotationMetadata);
                    }
                }

                // get MDB
                List<MessageDrivenBean> mdbList = ejb.getMessageDrivenBeans();
                if (mdbList != null) {
                    for (MessageDrivenBean mdb : mdbList) {
                        // get ejb-name
                        String ejbName = mdb.getEjbName();
                        EasyBeansEjbJarClassMetadata classAnnotationMetadata = this.ejbMetadata
                                .getEjbJarClassMetadataForEjbName(ejbName);

                        // class is found, then apply all customization.
                        applyMessageDrivenBean(mdb, classAnnotationMetadata);
                    }
View Full Code Here

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

        super(new EjbJarArchiveMetadata(ejbDeployable));
    }

    @Override
    protected EasyBeansEjbJarClassMetadata createClassMetadata(final JClass jClass, final EjbJarArchiveMetadata ejbJarArchiveMetadata) {
        EasyBeansEjbJarClassMetadata easyBeansEjbJarClassMetadata = new EasyBeansEjbJarClassMetadata();
        easyBeansEjbJarClassMetadata.setJClass(jClass);
        easyBeansEjbJarClassMetadata.setEjbJarArchiveMetadata(ejbJarArchiveMetadata);
        return easyBeansEjbJarClassMetadata;
    }
View Full Code Here

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

            final EasyBeansEjbJarClassMetadata visitingClassAnnotationMetadata) throws ResolverException {
          String superClass = visitingClassAnnotationMetadata.getSuperName();
        if (superClass != null) {
            // try to see if it was analyzed (and not java.lang.Object)
            if (!superClass.equals(JAVA_LANG_OBJECT)) {
                EasyBeansEjbJarClassMetadata superMetadata = beanClassAnnotationMetadata.getLinkedClassMetadata(superClass);

                if (superMetadata == null) {
                    throw new IllegalStateException("No super class named '" + superClass
                            + "' was analyzed. But it is referenced from '" + visitingClassAnnotationMetadata.getClassName()
                            + "'.");
                }

                // Add in a new list the existing interfaces
                List<String> newInterfacesLst = new ArrayList<String>();
                String[] currentInterfaces = beanClassAnnotationMetadata.getInterfaces();
                if (currentInterfaces != null) {
                    for (String itf : currentInterfaces) {
                        newInterfacesLst.add(itf);
                    }
                }

                // Add the interfaces of the super class only if there aren't
                // yet present
                String[] superInterfaces = superMetadata.getInterfaces();
                List<String> inheritedInterfaces = beanClassAnnotationMetadata.getInheritedInterfaces();

                if (superInterfaces != null) {
                    for (String itf : superInterfaces) {
                        if (!inheritedInterfaces.contains(itf) && !newInterfacesLst.contains(itf)) {
                            inheritedInterfaces.add(itf);
                        }

                        if (!newInterfacesLst.contains(itf)) {
                            newInterfacesLst.add(itf);
                        }


                    }
                }

                // Set the updated list.
                beanClassAnnotationMetadata.setInterfaces(newInterfacesLst.toArray(new String[newInterfacesLst.size()]));
                beanClassAnnotationMetadata.setInheritedInterfaces(inheritedInterfaces);

                // The local and remote interfaces need to be reported from the superclass to the current class.
                // Start with the local interfaces.
                IJLocal currentLocalInterfaces = beanClassAnnotationMetadata.getLocalInterfaces();
                IJLocal superLocalInterfaces = superMetadata.getLocalInterfaces();
                if (superLocalInterfaces != null) {
                    if (currentLocalInterfaces == null) {
                        currentLocalInterfaces = new JLocal();
                        beanClassAnnotationMetadata.setLocalInterfaces(currentLocalInterfaces);
                    }
                    for (String itf : superLocalInterfaces.getInterfaces()) {
                        if (!currentLocalInterfaces.getInterfaces().contains(itf)) {
                            currentLocalInterfaces.addInterface(itf);
                        }
                    }
                }

                // And then, with the remote interfaces
                IJRemote currentRemoteInterfaces = beanClassAnnotationMetadata.getRemoteInterfaces();
                IJRemote superRemoteInterfaces = superMetadata.getRemoteInterfaces();
                if (superRemoteInterfaces != null) {
                    if (currentRemoteInterfaces == null) {
                        currentRemoteInterfaces = new JRemote();
                        beanClassAnnotationMetadata.setRemoteInterfaces(currentRemoteInterfaces);
                    }
                    for (String itf : superRemoteInterfaces.getInterfaces()) {
                        if (!currentRemoteInterfaces.getInterfaces().contains(itf)) {
                            currentRemoteInterfaces.addInterface(itf);
                        }
                    }
                }

                // Loop again until java.lang.Object super class is found
                if (!superMetadata.getClassName().equals(JAVA_LANG_OBJECT)) {
                    loop(beanClassAnnotationMetadata, superMetadata);
                }
            }
        }
    }
View Full Code Here

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

        String runAs = bean.getRunAs();
        String superClassName = bean.getSuperName();
        // Search in super class
        while (runAs == null && !superClassName.equals(Type.getInternalName(Object.class))) {
            EasyBeansEjbJarClassMetadata superMetadata = bean.getLinkedClassMetadata(superClassName);
            if (superMetadata != null) {
                runAs = superMetadata.getRunAs();
                superClassName = superMetadata.getSuperName();
                // Set with the super class value
                if (runAs != null) {
                    bean.setRunAs(runAs);
                }
            }
        }




        // Inheritance for DeclaredRoles
        List<String> declaredRoles = bean.getDeclareRoles();
        superClassName = bean.getSuperName();
        // if null, search on super classes.
        while (declaredRoles == null && !superClassName.equals(Type.getInternalName(Object.class))) {
            EasyBeansEjbJarClassMetadata superMetadata = bean.getLinkedClassMetadata(superClassName);
            if (superMetadata != null) {
                declaredRoles = superMetadata.getDeclareRoles();
                superClassName = superMetadata.getSuperName();
                // Set with the super class value
                if (declaredRoles != null) {
                    bean.setDeclareRoles(declaredRoles);
                }
            }
View Full Code Here

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

        int interceptorClassAnalyzed = 0;

        // For each interceptors classes, take the method with @AroundInvoke or @PostConstruct, etc. and build list
        for (String className : interceptorsClasses) {
            EasyBeansEjbJarClassMetadata interceptorMetadata = classMetadata.getLinkedClassMetadata(className);
            if (interceptorMetadata == null) {
                throw new ResolverException("No medata for interceptor class " + className
                        + " referenced by " + referencingName);
            }

            // Another interceptor class
            interceptorClassAnalyzed++;

            // No inner class of the bean
            if (interceptorMetadata.getClassName().contains("$")) {
                throw new IllegalStateException("Interceptor can't be defined in an inner class.");
            }


            // Takes all methods of the super class and add them to the current class.
            InheritanceMethodResolver.resolve(interceptorMetadata);


            // Invert list of the inheritance on the current class
            LinkedList<EasyBeansEjbJarClassMetadata> invertedInheritanceClassesList =
                getInvertedSuperClassesMetadata(interceptorMetadata);

            // For each class (starting super class first, add the interceptor methods)
            for (EasyBeansEjbJarClassMetadata currentMetaData : invertedInheritanceClassesList) {
                // Analyze methods of the interceptor meta-data and add it in the map
                for (EasyBeansEjbJarMethodMetadata method : currentMetaData.getMethodMetadataCollection()) {
                    // Don't look inherited methods.
                    if (method.isInherited()) {
                        continue;
                    }
                    JClassInterceptor jInterceptor = new JClassInterceptor(className, method.getJMethod(),
                            interceptorClassAnalyzed);

                    // 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.EasyBeansEjbJarClassMetadata

        // get list of super classes
        LinkedList<EasyBeansEjbJarClassMetadata> superClassesList = new LinkedList<EasyBeansEjbJarClassMetadata>();
        String superClassName = classAnnotationMetadata.getSuperName();
        // loop while super class is not java.lang.Object
        while (!JAVA_LANG_OBJECT.equals(superClassName)) {
            EasyBeansEjbJarClassMetadata superMetaData = classAnnotationMetadata.getLinkedClassMetadata(superClassName);
            if (superMetaData != null) {
                superClassName = superMetaData.getSuperName();
                superClassesList.addFirst(superMetaData);
            } else {
                superClassName = JAVA_LANG_OBJECT;
            }
        }
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.