

package com.mediadriver.osgi.blueprint.test;

import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;

/**
 * A class resolver for loading classes in a loosly coupled manner to cater for different platforms such
 * as standalone, web container, j2ee container and OSGi platforms.
 */
public interface ClassResolver {

   
    /**
     * Loads the given resource as a stream
     *
     * @param uri the uri of the resource
     * @return as a stream
     */
    InputStream loadResourceAsStream(String uri);

    /**
     * Loads the given resource as a URL
     *
     * @param uri the uri of the resource
     * @return as a URL
     */
    URL loadResourceAsURL(String uri);

    /**
     * Loads the given resources as a URL from the current bundle/classloader
     *
     * @param uri the uri of the resource
     * @return the URLs found on the classpath
     */
    Enumeration<URL> loadResourcesAsURL(String uri);

    /**
     * Loads the given resources as a URL from all bundles/classloaders
     *
     * @param uri the uri of the resource
     * @return the URLs found on the classpath
     */
    Enumeration<URL> loadAllResourcesAsURL(String uri);
}