Package org.ow2.util.ee.metadata.common.api.struct

Examples of org.ow2.util.ee.metadata.common.api.struct.IJEjbEJB


                    callBindLookupJndiRef(jAnnotationResource.getName(), mappedName, mv);
                }
            }

            // @EJB annotation
            IJEjbEJB jEjb = methodMetaData.getJEjbEJB();
            if (jEjb != null) {
                logger.debug("Add injection for EJB on method {0} of class {1}", methodMetaData.getMethodName(),
                        this.classAnnotationMetadata.getClassName());

                Type typeInterface = validateSetterMethod(methodMetaData);
                String itfName = typeInterface.getClassName();

                // ejbName ?
                String beanName = jEjb.getBeanName();

                // JNDI name
                String jndiName = null;

                // Mapped Name ? if not null, use it as JNDI name
                String mappedName = jEjb.getMappedName();
                if (mappedName != null && !mappedName.equals("")) {
                    jndiName = mappedName;
                }

                // JNDI name still null, ask the JNDI resolver
                if (jndiName == null) {
                    try {
                        jndiName = this.containerJNDIResolver.getEJBJNDIUniqueName(itfName, beanName);
                    } catch (EZBJNDIResolverException e) {
                        logger.error("Cannot find JNDI Name on class {0} for interface {1} and beanName {2}. Result = {3}",
                            this.classAnnotationMetadata.getClassName(), itfName, beanName);
                    }
                }

                // Not null, bind it
                if (jndiName != null) {
                    logger.debug("Asking jndi name on class {0} for interface {1} and beanName {2}. Result = {3}",
                            this.classAnnotationMetadata.getClassName(), itfName, beanName, jndiName);

                    callMethodJndiEnv(jndiName, typeInterface, mv, methodMetaData, this.classAnnotationMetadata
                            .getClassName(), REGISTRY);

                    // get enc name (or the default name) and bind result
                    String encName = getJndiName(jEjb.getName(), methodMetaData);
                    callBindLookupJndiRef(encName, jndiName, mv);
                }
            }

            // @PersistenceContext annotation
View Full Code Here


    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

            } catch (DeployableMetadataException e) {
                logger.error("Unable to analyze the metadata of the war '" + warURL + "'.", e);
            }

            // Now, get the bindings for this web application
            ENCBindingHolder encBindingHolder = null;
            if (warDeployableMetadata != null) {
                try {
                    encBindingHolder = ENCBindingBuilder.analyze(warDeployableMetadata);
                } catch (ENCBindingException e) {
                    logger.error("Unable to analyze metadata of '" + warURL + "'", e);
View Full Code Here

        List<String> allInterfaces = getAllInterfacesFromClass(sessionBean);

        // if SESSION_BEAN_INTERFACE is contained in the list, add some metadata
        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);
View Full Code Here

     *        EAR).
     * @return a BeanNamingInfo instance
     */
    public static BeanNamingInfo buildInfo(final EasyBeansEjbJarClassMetadata beanClassMetadata, final String interfaceName,
            final String mode, final String javaEEApplicationName) {
        IJCommonBean commonBean = beanClassMetadata.getJCommonBean();

        BeanNamingInfo beanNamingInfo = new BeanNamingInfo();
        beanNamingInfo.setName(commonBean.getName());
        beanNamingInfo.setBeanClassName(beanClassMetadata.getClassName());
        beanNamingInfo.setInterfaceName(interfaceName);
        beanNamingInfo.setMode(mode);
        beanNamingInfo.setMappedName(commonBean.getMappedName());
        beanNamingInfo.setJavaEEApplicationName(javaEEApplicationName);

        return beanNamingInfo;

    }
View Full Code Here

     * @see <a href="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 Spec ?4.6.6</a>
     * @param sessionBean Session bean to analyze
     */
    public static void resolve(final EasyBeansEjbJarClassMetadata sessionBean) {

        IJLocal jLocal = sessionBean.getLocalInterfaces();
        IJRemote jRemote = sessionBean.getRemoteInterfaces();

        // No business interface or empty annotation (@Remote or @Local)
        if ((jLocal == null && jRemote == null) || (jLocal == null && jRemote != null && jRemote.getInterfaces().isEmpty())
                || (jRemote == null && jLocal != null && jLocal.getInterfaces().isEmpty())) {

            // The following interfaces are excluded when determining whether
            // the bean class has
            // more than one interface: java.io.Serializable;
            // java.io.Externalizable;
View Full Code Here

        // As the Bean class may not implement the interface, ads also the local and remote business interfaces
        List<String> businessInterfaces = new ArrayList<String>();
        // Add implemented interfaces
        businessInterfaces.addAll(Arrays.asList(visitingclassAnnotationMetadata.getInterfaces()));
        // Add local interfaces
        IJLocal localInterfaces = beanclassAnnotationMetadata.getLocalInterfaces();
        if (localInterfaces != null) {
            for (String itf : localInterfaces.getInterfaces()) {
                if (!businessInterfaces.contains(itf)) {
                    businessInterfaces.add(itf);
                }
            }
        }
View Full Code Here

     * @param sessionBean Session bean to analyze
     */
    public static void resolve(final EasyBeansEjbJarClassMetadata sessionBean) {

        IJLocal jLocal = sessionBean.getLocalInterfaces();
        IJRemote jRemote = sessionBean.getRemoteInterfaces();

        // No business interface or empty annotation (@Remote or @Local)
        if ((jLocal == null && jRemote == null) || (jLocal == null && jRemote != null && jRemote.getInterfaces().isEmpty())
                || (jRemote == null && jLocal != null && jLocal.getInterfaces().isEmpty())) {

            // The following interfaces are excluded when determining whether
            // the bean class has
            // more than one interface: java.io.Serializable;
            // java.io.Externalizable;
            // any of the interfaces defined by the javax.ejb package.
            String[] interfaces = sessionBean.getInterfaces();
            List<String> inheritedInterfaces = sessionBean.getInheritedInterfaces();

            int numberItfFound = 0;
            String itfFound = null;
            for (String itf : interfaces) {
                if (!itf.equals(java.io.Serializable.class.getName().replace(".", "/"))
                        && !itf.equals(java.io.Externalizable.class.getName().replace(".", "/"))
                        && !itf.startsWith("javax/ejb")
                        // Should not be inherited
                        && !inheritedInterfaces.contains(itf)
                        ) {
                    itfFound = itf;
                    numberItfFound++;
                }
            }

            // No business interface found but there is only one inherited interface, use it.
            if (numberItfFound == 0 && inheritedInterfaces != null && inheritedInterfaces.size() == 1) {
                itfFound = inheritedInterfaces.get(0);
                numberItfFound = 1;
            }


            // No business interface found
            if (numberItfFound == 0) {
                // if this is a 2.1 bean, it could be normal
                if (sessionBean.getRemoteHome() != null || sessionBean.getLocalHome() != null) {
                    return;
                }

                logger.warn("No business interface found on bean class {0}.", sessionBean.getClassName());
            } else {

                if (numberItfFound > 1) {
                    throw new IllegalStateException("More than 1 itf on class '" + sessionBean.getClassName() + "'.");
                }

                // If bean class implements a single interface, that interface is
                // assumed to be the business
                // interface of the bean. This business interface will be a local
                // interface unless the
                // interface is designated as a remote business interface by use of
                // the Remote annotation
                // on the bean class or interface or by means of the deployment
                // descriptor.

                // Build a local interface if no @Remote annotation, else add interface in the existing object
                if (jRemote == null) {
                    JLocal addedJLocal = new JLocal();
                    addedJLocal.addInterface(itfFound);
                    sessionBean.setLocalInterfaces(addedJLocal);
                } else {
                    jRemote.addInterface(itfFound);
                    sessionBean.setRemoteInterfaces(jRemote);
                }
            }
        }
    }
View Full Code Here

                    businessInterfaces.add(itf);
                }
            }
        }
        // Remote interfaces
        IJRemote remoteInterfaces = beanclassAnnotationMetadata.getRemoteInterfaces();
        if (remoteInterfaces != null) {
            for (String itf : remoteInterfaces.getInterfaces()) {
                if (!businessInterfaces.contains(itf)) {
                    businessInterfaces.add(itf);
                }
            }
        }
View Full Code Here

                // on the bean class or interface or by means of the deployment
                // descriptor.

                // Build a local interface if no @Remote annotation, else add interface in the existing object
                if (jRemote == null) {
                    JLocal addedJLocal = new JLocal();
                    addedJLocal.addInterface(itfFound);
                    sessionBean.setLocalInterfaces(addedJLocal);
                } else {
                    jRemote.addInterface(itfFound);
                    sessionBean.setRemoteInterfaces(jRemote);
                }
View Full Code Here

TOP

Related Classes of org.ow2.util.ee.metadata.common.api.struct.IJEjbEJB

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.