Package org.apache.commons.discovery

Examples of org.apache.commons.discovery.Resource


        DiscoverResources disc = new DiscoverResources();
        disc.addClassLoader(JDKHooks.getJDKHooks().getThreadContextClassLoader());
        disc.addClassLoader(loader);
        ResourceIterator iterator = disc.findResources(location);
        if (iterator.hasNext()) {
            Resource resource = iterator.nextResource();
            is = resource.getResourceAsStream();
        }

        /**
         * If we don't find it, then look on the file system.
         */
 
View Full Code Here


        DiscoverResources disc = new DiscoverResources();
        disc.addClassLoader(JDKHooks.getJDKHooks().getThreadContextClassLoader());
        disc.addClassLoader(this.getClass().getClassLoader());
        ResourceIterator iterator = disc.findResources(location);
        if (iterator.hasNext()) {
            Resource resource = iterator.nextResource();
            is = resource.getResourceAsStream();
        }
       
        /**
         * If we don't find it, then look on the file system.
         */
View Full Code Here

                disc.addClassLoader(classLoader);

                ResourceIterator iterator = disc
                        .findResources(keyStorelocation);
                if (iterator.hasNext()) {
                    Resource resource = iterator.nextResource();
                    is = resource.getResourceAsStream();
                }

                if (is == null) {
                    iterator = disc.findResources("META-INF/"
                            + keyStorelocation);
                    if (iterator.hasNext()) {
                        Resource resource = iterator.nextResource();
                        is = resource.getResourceAsStream();
                    }
                }
            }
            if (is == null) {
                throw new Exception("specified keystore doesn't exist");
View Full Code Here

                return resource != null;
            }

            @Override
            public Resource nextResource() {
                Resource rsrc = resource;
                resource = null;
                return rsrc;
            }

            private Resource getNextResource() {
View Full Code Here

                return resource != null;
            }

            @Override
            public Resource nextResource() {
                Resource element = resource;
                resource = null;
                return element;
            }

            private Resource getNextResource() {
                if (resources == null || !resources.hasMoreElements()) {
                    resources = getNextResources();
                }

                Resource resourceInfo;
                if (resources != null) {
                    URL url = resources.nextElement();

                    if (log.isDebugEnabled()) {
                        log.debug("getNextResource: next URL='" + url + "'");
                    }

                    resourceInfo = new Resource(resourceName, url, loader);
                } else {
                    resourceInfo = null;
                }

                return resourceInfo;
View Full Code Here

                                            ClassLoaders classLoaders) throws DiscoveryException {
        Properties properties = null;

        if (propertiesFileName != null) {
            try {
                Resource resource = getResource(spi, propertiesFileName, classLoaders);
                if (resource != null) {
                    InputStream stream = resource.getResourceAsStream();

                    if (stream != null) {
                        properties = new Properties();
                        try {
                            properties.load(stream);
View Full Code Here

        DiscoverResources discovery = new DiscoverResources(loaders);
        ResourceIterator iter = discovery.findResources(name);
        int count = 0;
       
        while (iter.hasNext()) {
            Resource resource = iter.nextResource();
            URL url = resource.getResource();
            if ( url != null ) {
                if (url.getFile().indexOf(partialPaths[count]) == -1) {
                    fail(url + " does not contain " + partialPaths[count]);
                }
                count++;
View Full Code Here

    {
        Properties properties = null;
       
        if (propertiesFileName != null) {
            try {
                Resource resource = getResource(spi, propertiesFileName, classLoaders);
                if (resource != null) {
                    InputStream stream = resource.getResourceAsStream();
       
                    if (stream != null) {
                        properties = new Properties();
                        try {
                            properties.load(stream);
View Full Code Here

                }
                return resource != null;
            }
           
            public Resource nextResource() {
                Resource element = resource;
                resource = null;
                return element;
            }
           
            private Resource getNextResource() {
                if (resources == null || !resources.hasMoreElements()) {
                    resources = getNextResources();
                }

                Resource resourceInfo;
                if (resources != null) {
                    URL url = (URL)resources.nextElement();

                    if (log.isDebugEnabled())
                        log.debug("getNextResource: next URL='" + url + "'");

                    resourceInfo = new Resource(resourceName, url, loader);
                } else {
                    resourceInfo = null;
                }
               
                return resourceInfo;
View Full Code Here

                }
                return resource != null;
            }
           
            public Resource nextResource() {
                Resource rsrc = resource;
                resource = null;
                return rsrc;
            }
           
            private Resource getNextResource() {
View Full Code Here

TOP

Related Classes of org.apache.commons.discovery.Resource

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.