Examples of Beans


Examples of org.apache.openejb.jee.Beans

                        final PersistenceUnit unit = (PersistenceUnit) modules;
                        appModule.addPersistenceModule(new PersistenceModule(appModule, "", new Persistence(unit)));

                    } else if (modules instanceof Beans) {

                        final Beans beans = (Beans) modules;
                        final EjbModule ejbModule = new EjbModule(new EjbJar());
                        ejbModule.setBeans(beans);
                        appModule.getEjbModules().add(ejbModule);
                    }
                }
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        final Object raw = ejbModule.getAltDDs().get("beans.xml");
        final Source data = getSource(raw);
        if (data != null) {
            try {
                final Beans beans = readBeans(data.get());
                checkDuplicatedByBeansXml(beans, beans);
                ejbModule.setBeans(beans);
            } catch (final IOException e) {
                throw new OpenEJBException(e);
            }
View Full Code Here

Examples of org.apache.openejb.jee.Beans

    public static Beans readBeans(final InputStream inputStream) throws OpenEJBException {
        try {
            final String content = IO.slurp(inputStream);
            if (isEmptyBeansXml(new ByteArrayInputStream(content.getBytes()))) {
                return new Beans();
            }
            return (Beans) JaxbJavaee.unmarshalJavaee(Beans.class, new ByteArrayInputStream(content.getBytes()));
        } catch (final SAXException e) {
            throw new OpenEJBException("Cannot parse the beans.xml", e);// file: " + url.toExternalForm(), e);
        } catch (final JAXBException e) {
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        } catch (final IOException e) {

            return;
        }

        Beans complete = null;
        for (final URL url : xmls) {
            if (url == null) {
                continue;
            }
            complete = mergeBeansXml(complete, url);
        }
        if (complete != null) {
            complete.removeDuplicates();
        }

        webModule.getAltDDs().put("beans.xml", complete);
    }
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        webModule.getAltDDs().put("beans.xml", complete);
    }

    private Beans mergeBeansXml(final Beans current, final URL url) {
        Beans returnValue = current;
        try {
            final Beans beans;
            try {
                beans = ReadDescriptors.readBeans(url.openStream());
            } catch (final IOException e) {
                return returnValue;
            }

            if (current == null) {
                returnValue = beans;
            } else {
                current.getAlternativeClasses().addAll(beans.getAlternativeClasses());
                current.getAlternativeStereotypes().addAll(beans.getAlternativeStereotypes());
                current.getDecorators().addAll(beans.getDecorators());
                current.getInterceptors().addAll(beans.getInterceptors());
            }
            // check is done here since later we lost the data of the origin
            ReadDescriptors.checkDuplicatedByBeansXml(beans, returnValue);
        } catch (final OpenEJBException e) {
            logger.error("Unable to read beans.xml from: " + url.toExternalForm(), e);
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        } catch (final IOException e) {

            return;
        }

        Beans complete = null;
        for (final URL url : xmls) {
            if (url == null) {
                continue;
            }
            complete = mergeBeansXml(complete, url);
        }

        if (complete == null) {
            return;
        }
        complete.removeDuplicates();

        IAnnotationFinder finder;
        try {
            finder = FinderFactory.createFinder(appModule);
        } catch (final Exception e) {
View Full Code Here

Examples of org.apache.openejb.jee.Beans

                } catch (final ClassNotFoundException e) {
                    // no-op
                }
            }

            final Beans beans = ejb.getBeans();
            if (beans != null && ejb.getEjbJar() != null) {
                for (final String name : beans.getManagedClasses()) {
                    try {
                        finderClasses.addAll(ancestors(classLoader.loadClass(name)));
                    } catch (final ClassNotFoundException e) {
                        // no-op
                    }
                }
                for (final String name : beans.getInterceptors()) {
                    try {
                        finderClasses.addAll(ancestors(classLoader.loadClass(name)));
                    } catch (final ClassNotFoundException e) {
                        // no-op
                    }
                }
                for (final String name : beans.getAlternativeClasses()) {
                    try {
                        finderClasses.addAll(ancestors(classLoader.loadClass(name)));
                    } catch (final ClassNotFoundException e) {
                        // no-op
                    }
                }
                for (final String name : beans.getDecorators()) {
                    try {
                        finderClasses.addAll(ancestors(classLoader.loadClass(name)));
                    } catch (final ClassNotFoundException e) {
                        // no-op
                    }
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        final EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(bean);
        ejbJar.addEnterpriseBean(test);

        final Beans beans = new Beans();
        beans.addManagedClass(PlcBaseDAO.class);
        beans.addManagedClass(PlcBaseJpaDAO.class);

        final EjbModule jar = new EjbModule(ejbJar);
        jar.setBeans(beans);

        return jar;
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        return new SingletonBean(OrangeStateful.class);
    }

    @Module
    public Beans getBeans() {
        final Beans beans = new Beans();
        beans.addManagedClass(Peeler.class);
        return beans;
    }
View Full Code Here

Examples of org.apache.openejb.jee.Beans

        final EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(bean);
        ejbJar.addEnterpriseBean(test);

        final Beans beans = new Beans();
        beans.addManagedClass(PlcBaseDAO.class);
        beans.addManagedClass(PlcBaseJpaDAO.class);
        beans.addManagedClass(AppCDI.class);
        beans.addManagedClass(AppJpaDAO.class);

        final EjbModule jar = new EjbModule(ejbJar);
        jar.setBeans(beans);

        return jar;
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.