Package org.apache.openejb.util

Examples of org.apache.openejb.util.AnnotationFinder


                return ClientModule.class;
            }
        }

        if (searchForDescriptorlessApplications) {
            AnnotationFinder classFinder = new AnnotationFinder(classLoader, baseUrl);

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                public boolean accept(String annotationName) {
                    if (annotationName.startsWith("javax.ejb.")) {
                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                return EjbModule.class;
            }
        }

        if (descriptors.containsKey("persistence.xml")) {
View Full Code Here


    }

    private Class<? extends DeploymentModule> checkAnnotations(final URL urls, final ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
        Class<? extends DeploymentModule> cls = null;
        if (scanPotentialEjbModules || scanPotentialClientModules) {
            final AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();

            final AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");

                @Override
                public boolean accept(final String annotationName) {
                    if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                        if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                        if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                    } else if (scanPotentialEjbModules) {
                        if (annotationName.startsWith("javax.ejb.")) {
                            if ("javax.ejb.Stateful".equals(annotationName)) return true;
                            if ("javax.ejb.Stateless".equals(annotationName)) return true;
                            if ("javax.ejb.Singleton".equals(annotationName)) return true;
                            if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
                            return true;
                        }
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                cls = EjbModule.class;
            }

            if (otherTypes.size() > 0) {
                // We may want some ordering/sorting if we add more type scanning
View Full Code Here

                if (mainClass != null) {
                    return false;
                }
            }

            AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                public boolean accept(String annotationName) {
                    if (annotationName.startsWith("javax.ejb.")) {
                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                    } else if ("javax.annotation.ManagedBean".equals(annotationName)) {
                        return true;
                    }
                    return false;
                }
            };

            return classFinder.find(filter);

        } catch (Exception e) {
            log.warn("Unable to determine module type for jar: " + baseUrl.toExternalForm(), e);
            return false;
        }
View Full Code Here

                return ClientModule.class;
            }
        }

        if (searchForDescriptorlessApplications) {
            AnnotationFinder classFinder = new AnnotationFinder(classLoader, baseUrl);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet();

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");
                public boolean accept(String annotationName) {
                    if (annotationName.startsWith("javax.ejb.")) {
                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                    } else if (annotationName.startsWith(packageName)){
                        if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                        if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                return EjbModule.class;
            }

            if (otherTypes.size() > 0){
                // We may want some ordering/sorting if we add more type scanning
View Full Code Here

    }

    private Class<? extends DeploymentModule> checkAnnotations(URL urls, ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
        Class<? extends DeploymentModule> cls = null;
        if (scanPotentialEjbModules || scanPotentialClientModules) {
            AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");

                public boolean accept(String annotationName) {
                    if (scanPotentialEjbModules) {
                        if (annotationName.startsWith("javax.ejb.")) {
                            if ("javax.ejb.Stateful".equals(annotationName)) return true;
                            if ("javax.ejb.Stateless".equals(annotationName)) return true;
                            if ("javax.ejb.Singleton".equals(annotationName)) return true;
                            if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
                            return true;
                        }
                    } else if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                        if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                        if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                cls = EjbModule.class;
            }

            if (otherTypes.size() > 0) {
                // We may want some ordering/sorting if we add more type scanning
View Full Code Here

                if (mainClass != null) {
                    return false;
                }
            }

            AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                public boolean accept(String annotationName) {
                    if (annotationName.startsWith("javax.ejb.")) {
                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                    } else if ("javax.annotation.ManagedBean".equals(annotationName)) {
                        return true;
                    }
                    return false;
                }
            };

            return classFinder.find(filter);

        } catch (Exception e) {
            log.warn("Unable to determine module type for jar: " + baseUrl.toExternalForm(), e);
            return false;
        }
View Full Code Here

    }

    private Class<? extends DeploymentModule> checkAnnotations(URL urls, ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
        Class<? extends DeploymentModule> cls = null;
        if (scanPotentialEjbModules || scanPotentialClientModules) {
            AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");

                public boolean accept(String annotationName) {
                    if (scanPotentialEjbModules) {
                        if (annotationName.startsWith("javax.ejb.")) {
                            if ("javax.ejb.Stateful".equals(annotationName)) return true;
                            if ("javax.ejb.Stateless".equals(annotationName)) return true;
                            if ("javax.ejb.Singleton".equals(annotationName)) return true;
                            if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
                            return true;
                        }
                    } else if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                        if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                        if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                cls = EjbModule.class;
            }

            if (otherTypes.size() > 0) {
                // We may want some ordering/sorting if we add more type scanning
View Full Code Here

    }

    private Class<? extends DeploymentModule> checkAnnotations(final URL urls, final ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
        Class<? extends DeploymentModule> cls = null;
        if (scanPotentialEjbModules || scanPotentialClientModules) {
            final AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();

            final AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");

                @Override
                public boolean accept(final String annotationName) {
                    if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                        if (LocalClient.class.getName().equals(annotationName)) {
                            otherTypes.add(ClientModule.class);
                        }
                        if (RemoteClient.class.getName().equals(annotationName)) {
                            otherTypes.add(ClientModule.class);
                        }
                    } else if (scanPotentialEjbModules) {
                        if (annotationName.startsWith("javax.ejb.")) {
                            if ("javax.ejb.Stateful".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.Stateless".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.Singleton".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.MessageDriven".equals(annotationName)) {
                                return true;
                            }
                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
                            return true;
                        }
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                cls = EjbModule.class;
                // if it is a war just throw an error
                try {
                    final File ar = URLs.toFile(urls);
                    if (!ar.isDirectory() && !ar.getName().endsWith("ar")) { // guess no archive extension, check it is not a hidden war
View Full Code Here

                return ClientModule.class;
            }
        }

        if (scanPotentialEjbModules || scanPotentialClientModules) {
            AnnotationFinder classFinder = new AnnotationFinder(classLoader, baseUrl);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet();

            AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");
                public boolean accept(String annotationName) {
                    if (scanPotentialEjbModules && annotationName.startsWith("javax.ejb.")) {
                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
                    } else if (scanPotentialClientModules && annotationName.startsWith(packageName)){
                        if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                        if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                return EjbModule.class;
            }

            if (otherTypes.size() > 0){
                // We may want some ordering/sorting if we add more type scanning
View Full Code Here

    }

    private Class<? extends DeploymentModule> checkAnnotations(final URL urls, final ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
        Class<? extends DeploymentModule> cls = null;
        if (scanPotentialEjbModules || scanPotentialClientModules) {
            final AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);

            final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();

            final AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                final String packageName = LocalClient.class.getName().replace("LocalClient", "");

                @Override
                public boolean accept(final String annotationName) {
                    if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                        if (LocalClient.class.getName().equals(annotationName)) {
                            otherTypes.add(ClientModule.class);
                        }
                        if (RemoteClient.class.getName().equals(annotationName)) {
                            otherTypes.add(ClientModule.class);
                        }
                    } else if (scanPotentialEjbModules) {
                        if (annotationName.startsWith("javax.ejb.")) {
                            if ("javax.ejb.Stateful".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.Stateless".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.Singleton".equals(annotationName)) {
                                return true;
                            }
                            if ("javax.ejb.MessageDriven".equals(annotationName)) {
                                return true;
                            }
                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
                            return true;
                        }
                    }
                    return false;
                }
            };

            if (classFinder.find(filter)) {
                cls = EjbModule.class;
                // if it is a war just throw an error
                try {
                    final File ar = URLs.toFile(urls);
                    if (!ar.isDirectory() && !ar.getName().endsWith("ar")) { // guess no archive extension, check it is not a hidden war
View Full Code Here

TOP

Related Classes of org.apache.openejb.util.AnnotationFinder

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.