private Collection findResourceUrls()

in tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java [75:98]


    private Collection<URL> findResourceUrls(final String inName, final String nameWithoutSlash) throws MalformedURLException {
        final String name;
        if (inName.startsWith("/") && inName.length() > 1) {
            name = inName.substring(1);
        } else {
            name = inName;
        }

        Collection<URL> urls = null; // created lazily
        if ((name.startsWith("META-INF/batch-jobs/")
                || name.endsWith("batch.xml") || name.endsWith("batchee.xml"))
                && nameWithoutSlash.endsWith(".xml")) {
            for (final File folder : resources) {
                final File resource = new File(folder, nameWithoutSlash.replace("META-INF/", ""));
                if (resource.isFile()) {
                    if (urls == null) {
                        urls = new LinkedList<URL>();
                    }
                    urls.add(resource.toURI().toURL());
                }
            }
        }
        return urls;
    }