Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.Beans


public class BeanManagerHelperTest {
    private static OpenEJBScripter.BeanManagerHelper helper = new OpenEJBScripter.BeanManagerHelper();

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


            IAnnotationFinder finder = ejbModule.getFinder();


            final List<String> managedClasses;
            {
                final Beans beans = ejbModule.getBeans();

                if (beans != null) {
                    managedClasses = beans.getManagedClasses();
                    final List<String> classNames = getBeanClasses(finder);
                    for (String rawClassName : classNames) {
                        final String className = realClassName(rawClassName);
                        try {
                            final ClassLoader loader = ejbModule.getClassLoader();
View Full Code Here

        } catch (IOException e) {

            return;
        }

        Beans complete = null;
        for (final URL url : xmls) {
            if (url == null) continue;
            try {
                final Beans beans = ReadDescriptors.readBeans(url);

                if (complete == null) {
                    complete = beans;
                } else {
                    complete.getAlternativeClasses().addAll(beans.getAlternativeClasses());
                    complete.getAlternativeStereotypes().addAll(beans.getAlternativeStereotypes());
                    complete.getDecorators().addAll(beans.getDecorators());
                    complete.getInterceptors().addAll(beans.getInterceptors());
                }
            } catch (OpenEJBException e) {
                logger.error("Unable to read beans.xml from :" + url.toExternalForm());
            }
        }
View Full Code Here

            return;
        }

        final List<Archive> jars = new ArrayList<Archive>();

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

                final Beans beans = ReadDescriptors.readBeans(url);

                if (complete == null) {
                    complete = beans;
                } else {
                    complete.getAlternativeClasses().addAll(beans.getAlternativeClasses());
                    complete.getAlternativeStereotypes().addAll(beans.getAlternativeStereotypes());
                    complete.getDecorators().addAll(beans.getDecorators());
                    complete.getInterceptors().addAll(beans.getInterceptors());
                }
                jars.add(new JarArchive(appModule.getClassLoader(), url));
//            } catch (MalformedURLException e) {
//                logger.error("Unable to resolve jar path of beans.xml:"+ url.toExternalForm(), e);
            } catch (OpenEJBException e) {
View Full Code Here

        Object data = ejbModule.getAltDDs().get("beans.xml");
        if (data instanceof Beans) {
            ejbModule.setBeans((Beans) data);
        } else if (data instanceof URL) {
            URL url = (URL) data;
            Beans beans = readBeans(url);
            ejbModule.setBeans(beans);
        } else {
//            DeploymentLoader.logger.debug("No beans.xml found assuming annotated beans present: " + appModule.getJarLocation() + ", module: " + ejbModule.getModuleId());
//            ejbModule.setBeans(new Beans());
        }
View Full Code Here

        }
    }

    public static Beans readBeans(URL url) throws OpenEJBException {
        try {
            if (isEmptyBeansXml(url)) return new Beans();
            return (Beans) JaxbJavaee.unmarshalJavaee(Beans.class, IO.read(url));
        } catch (SAXException e) {
            throw new OpenEJBException("Cannot parse the beans.xml file: " + url.toExternalForm(), e);
        } catch (JAXBException e) {
            throw new OpenEJBException("Cannot unmarshall the beans.xml file: " + url.toExternalForm(), e);
View Full Code Here

                    final PersistenceUnit unit = (PersistenceUnit) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                } else if (obj instanceof Beans) {

                    final Beans beans = (Beans) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setBeans(beans);
                    appModule.getEjbModules().add(ejbModule);

                } else if (obj instanceof Class[]) {

                    final Class[] beans = (Class[]) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(beans)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                } else if (obj instanceof Class) {

                    final Class bean = (Class) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(bean)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                }
            }

            // Application is final in AppModule, which is fine, so we'll create a new one and move everything
View Full Code Here

                        final PersistenceUnit unit = (PersistenceUnit) modules;
                        appModule.getPersistenceModules().add(new PersistenceModule("", 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

            final IAnnotationFinder finder = ejbModule.getFinder();


            final List<String> managedClasses;
            {
                final Beans beans = ejbModule.getBeans();

                if (beans != null) {
                    managedClasses = beans.getManagedClasses();
                    final List<String> classNames = getBeanClasses(finder);

                    final Set<String> notLoadedClasses = new TreeSet<String>();
                    for (final String rawClassName : classNames) {
                        final String className = realClassName(rawClassName);
View Full Code Here

                    final PersistenceUnit unit = (PersistenceUnit) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                } else if (obj instanceof Beans) {

                    final Beans beans = (Beans) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setBeans(beans);
                    appModule.getEjbModules().add(ejbModule);

                } else if (obj instanceof Class[]) {

                    final Class[] beans = (Class[]) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(beans)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                } else if (obj instanceof Class) {

                    final Class bean = (Class) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
                    ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(bean)).link());
                    ejbModule.setBeans(new Beans());
                    appModule.getEjbModules().add(ejbModule);
                }
            }

            // Application is final in AppModule, which is fine, so we'll create a new one and move everything
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.Beans

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.