Examples of IJRemote


Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

     * @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

Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

                    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

Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

            sessionBeanInfo.setWebServiceInfo(info);
        } // else this bean is not webservices annotated

        // get interfaces of bean
        IJLocal localItfs = sessionBean.getLocalInterfaces();
        IJRemote remoteItfs = sessionBean.getRemoteInterfaces();

        if (localItfs != null) {
            sessionBeanInfo.setLocalInterfaces(localItfs.getInterfaces());
            for (String itf : localItfs.getInterfaces()) {
                this.bindingReferences.add(createLocalItfRef(itf,
                                                             getEmbedded().getID(),
                                                             getId(),
                                                             factoryName,
                                                             sessionBean,
                                                             sessionFactory));
            }
        }
        if (remoteItfs != null) {
            sessionBeanInfo.setRemoteInterfaces(remoteItfs.getInterfaces());
            for (String itf : remoteItfs.getInterfaces()) {
                this.bindingReferences.add(createRemoteItfRef(itf,
                                                              getId(),
                                                              factoryName,
                                                              sessionBean,
                                                              sessionFactory));
View Full Code Here

Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

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

Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

                        }
                    }
                }

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

Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJRemote

    public static void resolve(final EasyBeansEjbJarClassMetadata sessionBean) throws ResolverException {
        sessionBean.getEjbJarDeployableMetadata();

        // Local and remote interfaces of the bean.
        IJLocal currentLocalInterfaces = sessionBean.getLocalInterfaces();
        IJRemote currentRemoteInterfaces = sessionBean.getRemoteInterfaces();

        // Get all interfaces of the bean
        String[] interfaces = sessionBean.getInterfaces();
        for (String itf : interfaces) {
            EasyBeansEjbJarClassMetadata itfAnnotationMetadata = sessionBean.getLinkedClassMetadata(itf);

            // Interface was analyzed, try to see the type of the interface
            if (itfAnnotationMetadata != null) {
                // Report type of interface in the bean
                IJLocal jLocal = itfAnnotationMetadata.getLocalInterfaces();
                if (jLocal != null) {
                    if (currentLocalInterfaces == null) {
                        currentLocalInterfaces = new JLocal();
                        sessionBean.setLocalInterfaces(currentLocalInterfaces);
                    }
                    String itfName = itfAnnotationMetadata.getClassName();
                    if (!currentLocalInterfaces.getInterfaces().contains(itfName)) {
                        currentLocalInterfaces.addInterface(itfName);
                    }
                }

                // Report type of interface in the bean
                IJRemote jRemote = itfAnnotationMetadata.getRemoteInterfaces();
                if (jRemote != null) {
                    if (currentRemoteInterfaces == null) {
                        currentRemoteInterfaces = new JRemote();
                        sessionBean.setRemoteInterfaces(currentRemoteInterfaces);
                    }
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.