Package org.apache.xbean.finder

Examples of org.apache.xbean.finder.BundleAssignableClassFinder


        ServiceReference reference = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
        Set<Class<? extends Application>> applicationClasses = new HashSet<Class<? extends Application>>();
        try {
            PackageAdmin packageAdmin = (PackageAdmin) bundle.getBundleContext().getService(reference);

            BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin, bundle, new Class<?>[] { Application.class }, new ClassDiscoveryFilter() {

                @Override
                public boolean directoryDiscoveryRequired(String directory) {
                    return true;
                }

                @Override
                public boolean jarFileDiscoveryRequired(String jarUrl) {
                    return true;
                }

                @Override
                public boolean packageDiscoveryRequired(String packageName) {
                    return true;
                }

                @Override
                public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
                    return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
                }
            });

            Set<String> classes = bundleClassFinder.find();

            for (String clazz : classes) {
                applicationClasses.add(bundle.loadClass(clazz).asSubclass(Application.class));
            }
View Full Code Here


                HandlesTypes handlesTypes = servletContainerInitializerClass.getAnnotation(HandlesTypes.class);
                if (handlesTypes == null || handlesTypes.value().length == 0) {
                    servletContainerInitializerClassNamesMap.put(servletContainerInitializer, null);
                    continue;
                }
                BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin, bundle, handlesTypes.value(), new ClassDiscoveryFilter() {

                    @Override
                    public boolean directoryDiscoveryRequired(String directory) {
                        return true;
                    }

                    @Override
                    public boolean jarFileDiscoveryRequired(String jarUrl) {
                        return !excludedJarNames.contains(jarUrl);
                    }

                    @Override
                    public boolean packageDiscoveryRequired(String packageName) {
                        return true;
                    }

                    @Override
                    public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
                        return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
                    }
                });
                Set<String> acceptedClassNames = bundleClassFinder.find();
                servletContainerInitializerClassNamesMap.put(servletContainerInitializer, acceptedClassNames.size() > 0 ? acceptedClassNames : null);
            }
            module.getEarContext().getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS, servletContainerInitializerClassNamesMap);
        } catch (Exception e) {
            throw new DeploymentException("Fail to scan javax.servlet.ServletContainerInitializer", e);
View Full Code Here

    }

    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
    {
        BundleClassFinder bundleClassFinder =
                new BundleAssignableClassFinder(packageAdmin, mainBundle,
                                                new Class<?>[]{Object.class},
                                                new ClassDiscoveryFilter()
         {

            @Override
            public boolean directoryDiscoveryRequired(String directory)
            {
                return true;
            }

            @Override
            public boolean jarFileDiscoveryRequired(String jarUrl)
            {
                return beanArchiveJarNames.contains(jarUrl);
            }

            @Override
            public boolean packageDiscoveryRequired(String packageName)
            {
                return true;
            }

            @Override
            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
            {
                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
            }
        });

        Set<String> acceptedClassNames = bundleClassFinder.find();
        for (String clsName : acceptedClassNames)
        {
            try
            {
                Class<?> cls = mainBundle.loadClass(clsName);
View Full Code Here

    }

    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
    {
        BundleClassFinder bundleClassFinder =
                new BundleAssignableClassFinder(packageAdmin, mainBundle,
                                                new Class<?>[]{Object.class},
                                                new ClassDiscoveryFilter()
         {

            public boolean directoryDiscoveryRequired(String directory)
            {
                return true;
            }

            public boolean jarFileDiscoveryRequired(String jarUrl)
            {
                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
                return isValidBeanArchive;
            }

            public boolean packageDiscoveryRequired(String packageName)
            {
                return true;
            }

            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
            {
                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
            }
        });

        Set<String> acceptedClassNames = bundleClassFinder.find();
        for (String clsName : acceptedClassNames)
        {
            try
            {
                Class<?> cls = mainBundle.loadClass(clsName);
View Full Code Here

                HandlesTypes handlesTypes = servletContainerInitializerClass.getAnnotation(HandlesTypes.class);
                if (handlesTypes == null || handlesTypes.value().length == 0) {
                    servletContainerInitializerClassNamesMap.put(servletContainerInitializer, null);
                    continue;
                }
                BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin, bundle, handlesTypes.value(), new ClassDiscoveryFilter() {

                    @Override
                    public boolean directoryDiscoveryRequired(String directory) {
                        return true;
                    }

                    @Override
                    public boolean jarFileDiscoveryRequired(String jarUrl) {
                        return !excludedJarNames.contains(jarUrl);
                    }

                    @Override
                    public boolean packageDiscoveryRequired(String packageName) {
                        return true;
                    }

                    @Override
                    public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
                        return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
                    }
                });
                Set<String> acceptedClassNames = bundleClassFinder.find();
                servletContainerInitializerClassNamesMap.put(servletContainerInitializer, acceptedClassNames.size() > 0 ? acceptedClassNames : null);
            }
            module.getEarContext().getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS, servletContainerInitializerClassNamesMap);
        } catch (Exception e) {
            throw new DeploymentException("Fail to scan javax.servlet.ServletContainerInitializer", e);
View Full Code Here

        ServiceReference reference = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
        Set<Class<? extends Application>> applicationClasses = new HashSet<Class<? extends Application>>();
        try {
            PackageAdmin packageAdmin = (PackageAdmin) bundle.getBundleContext().getService(reference);

            BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin, bundle, new Class<?>[] { Application.class }, new ClassDiscoveryFilter() {

                @Override
                public boolean directoryDiscoveryRequired(String directory) {
                    return true;
                }

                @Override
                public boolean jarFileDiscoveryRequired(String jarUrl) {
                    return true;
                }

                @Override
                public boolean packageDiscoveryRequired(String packageName) {
                    return true;
                }

                @Override
                public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
                    return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
                }
            });

            Set<String> classes = bundleClassFinder.find();

            for (String clazz : classes) {
                applicationClasses.add(bundle.loadClass(clazz).asSubclass(Application.class));
            }
View Full Code Here

    }

    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
    {
        BundleClassFinder bundleClassFinder =
                new BundleAssignableClassFinder(packageAdmin, mainBundle,
                                                new Class<?>[]{Object.class},
                                                new ClassDiscoveryFilter()
         {

            @Override
            public boolean directoryDiscoveryRequired(String directory)
            {
                return true;
            }

            @Override
            public boolean jarFileDiscoveryRequired(String jarUrl)
            {
                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
                return isValidBeanArchive;
            }

            @Override
            public boolean packageDiscoveryRequired(String packageName)
            {
                return true;
            }

            @Override
            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
            {
                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
            }
        });

        Set<String> acceptedClassNames = bundleClassFinder.find();
        for (String clsName : acceptedClassNames)
        {
            try
            {
                Class<?> cls = mainBundle.loadClass(clsName);
View Full Code Here

                HandlesTypes handlesTypes = servletContainerInitializerClass.getAnnotation(HandlesTypes.class);
                if (handlesTypes == null || handlesTypes.value().length == 0) {
                    servletContainerInitializerClassNamesMap.put(servletContainerInitializer, null);
                    continue;
                }
                BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin, bundle, handlesTypes.value(), new ClassDiscoveryFilter() {

                    @Override
                    public boolean directoryDiscoveryRequired(String directory) {
                        return true;
                    }

                    @Override
                    public boolean jarFileDiscoveryRequired(String jarUrl) {
                        return !excludedJarNames.contains(jarUrl);
                    }

                    @Override
                    public boolean packageDiscoveryRequired(String packageName) {
                        return true;
                    }

                    @Override
                    public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
                        return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
                    }
                });
                Set<String> acceptedClassNames = bundleClassFinder.find();
                servletContainerInitializerClassNamesMap.put(servletContainerInitializer, acceptedClassNames.size() > 0 ? acceptedClassNames : null);
            }
            earContext.getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS, servletContainerInitializerClassNamesMap);
        } catch (Exception e) {
            throw new DeploymentException("Fail to scan javax.servlet.ServletContainerInitializer", e);
View Full Code Here

    }

    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
    {
        BundleClassFinder bundleClassFinder =
                new BundleAssignableClassFinder(packageAdmin, mainBundle,
                                                new Class<?>[]{Object.class},
                                                new ClassDiscoveryFilter()
         {

            public boolean directoryDiscoveryRequired(String directory)
            {
                return true;
            }

            public boolean jarFileDiscoveryRequired(String jarUrl)
            {
                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
                return isValidBeanArchive;
            }

            public boolean packageDiscoveryRequired(String packageName)
            {
                return true;
            }

            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
            {
                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
            }
        });

        Set<String> acceptedClassNames = bundleClassFinder.find();
        for (String clsName : acceptedClassNames)
        {
            try
            {
                Class<?> cls = mainBundle.loadClass(clsName);
View Full Code Here

    }

    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
    {
        BundleClassFinder bundleClassFinder =
                new BundleAssignableClassFinder(packageAdmin, mainBundle,
                                                new Class<?>[]{Object.class},
                                                new ClassDiscoveryFilter()
         {

            @Override
            public boolean directoryDiscoveryRequired(String directory)
            {
                return true;
            }

            @Override
            public boolean jarFileDiscoveryRequired(String jarUrl)
            {
                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
                return isValidBeanArchive;
            }

            @Override
            public boolean packageDiscoveryRequired(String packageName)
            {
                return true;
            }

            @Override
            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
            {
                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
            }
        });

        Set<String> acceptedClassNames = bundleClassFinder.find();
        for (String clsName : acceptedClassNames)
        {
            try
            {
                Class<?> cls = mainBundle.loadClass(clsName);
View Full Code Here

TOP

Related Classes of org.apache.xbean.finder.BundleAssignableClassFinder

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.