Package org.apache.commons.discovery

Examples of org.apache.commons.discovery.ResourceClass.loadClass()


           
            // If it's set as a property.. it had better be there!
            if (classes.hasNext()) {
                ResourceClass info = classes.nextResourceClass();
                try {
                    return info.loadClass();
                } catch (Exception e) {
                    // ignore
                }
            }
        } else {
View Full Code Here


           
            // Services we iterate through until we find one that loads..
            while (classes.hasNext()) {
                ResourceClass info = classes.nextResourceClass();
                try {
                    return info.loadClass();
                } catch (Exception e) {
                    // ignore
                }
            }
        }
View Full Code Here

            DiscoverClasses classDiscovery = new DiscoverClasses(loaders);
            ResourceClassIterator classes = classDiscovery.findResourceClasses(getDefaultName());
            if (classes.hasNext()) {
                ResourceClass info = classes.nextResourceClass();
                try {
                    defaultClass = info.loadClass();
                } catch (Exception e) {
                    // ignore
                }
            }
        }
View Full Code Here

        DiscoverClasses discovery = new DiscoverClasses(loaders);
        ResourceClassIterator iter = discovery.findResourceClasses(name);
        while (iter.hasNext()) {
            ResourceClass resource = iter.nextResourceClass();
            try {               
                Class implClass = resource.loadClass();
                if ( implClass != null ) {
                    assertEquals("org.apache.commons.discovery.test.TestImpl2_1", implClass.getName());
                    return;
                }
            }
View Full Code Here

            private Object getNextClassInstance() {
                while (services.hasNext()) {
                    ResourceClass info = services.nextResourceClass();
                    try {
                        return spi.newInstance(info.loadClass());
                    } catch (Exception e) {
                        // ignore
                    }
                }
                return null;
View Full Code Here

        if (classNames.length > 0) {
            classDiscovery.find(classNames[0]);

            // If it's set as a property.. it had better be there!
            ResourceClass resource = listener.getFirst();
            return (resource == null) ? null : resource.loadClass();
        } else {
            DiscoverServiceNames discoverServices = new DiscoverServiceNames(loaders);
   
            /**
             * Feed service (name) discovery to classDiscovery
View Full Code Here

            discoverServices.setListener(classDiscovery);

            discoverServices.find(spi.getSPName());
            ResourceClass resource = listener.getFirst();

            Class clazz = (resource == null) ? null : resource.loadClass();

            if (clazz != null) {
                return clazz;
            }
           
View Full Code Here

            private Object getNextClassInstance() {
                while (services.hasNext()) {
                    ResourceClass info = services.nextResourceClass();
                    try {
                        return spi.newInstance(info.loadClass());
                    } catch (Exception e) {
                        // ignore
                    }
                }
                return null;
View Full Code Here

           
            // If it's set as a property.. it had better be there!
            if (classes.hasNext()) {
                ResourceClass info = classes.nextResourceClass();
                try {
                    return info.loadClass();
                } catch (Exception e) {
                    // ignore
                }
            }
        } else {
View Full Code Here

           
            // Services we iterate through until we find one that loads..
            while (classes.hasNext()) {
                ResourceClass info = classes.nextResourceClass();
                try {
                    return info.loadClass();
                } catch (Exception e) {
                    // ignore
                }
            }
        }
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.