org.codehaus.plexus.classloader
Class DefaultResourceManager

java.lang.Object
  extended byorg.codehaus.plexus.logging.AbstractLogEnabled
      extended byorg.codehaus.plexus.classloader.DefaultResourceManager
All Implemented Interfaces:
LogEnabled, ResourceManager

public class DefaultResourceManager
extends AbstractLogEnabled
implements ResourceManager

ClassLoading resource manager.

Version:
$Id: DefaultResourceManager.java,v 1.9 2004/01/12 22:02:05 jvanzyl Exp $
Author:
bob mcwhirter

Field Summary
private  PlexusClassLoader plexusClassLoader
          The classloader to use for loading resources and classes.
 
Fields inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
 
Fields inherited from interface org.codehaus.plexus.classloader.ResourceManager
ROLE
 
Constructor Summary
DefaultResourceManager()
           
 
Method Summary
 void addJarRepository(java.io.File repository)
          Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
 void addJarResource(java.io.File jar)
          Add a jar resource.
 void configure(PlexusConfiguration configuration)
          Perform configuration.
 PlexusClassLoader getPlexusClassLoader()
          Retrieve the resource-loading ClassLoader.
 java.io.InputStream getResourceAsStream(java.lang.String resource)
          Get a resource returned as a string.
 java.net.URL[] getURLs()
          Get the available URLs from the underlying classloader.
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plexusClassLoader

private PlexusClassLoader plexusClassLoader
The classloader to use for loading resources and classes.

Constructor Detail

DefaultResourceManager

public DefaultResourceManager()
Method Detail

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)

getPlexusClassLoader

public PlexusClassLoader getPlexusClassLoader()
Retrieve the resource-loading ClassLoader.

Returns:
The class-loader.

getURLs

public java.net.URL[] getURLs()
Get the available URLs from the underlying classloader.


getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String resource)
Get a resource returned as a string.


configure

public void configure(PlexusConfiguration configuration)
               throws PlexusConfigurationException
Perform configuration.

Parameters:
configuration - The configuration.
Throws:
PlexusConfigurationException - If an error occurs while attempting to perform configuration.

addJarResource

public void addJarResource(java.io.File jar)
                    throws java.lang.Exception
Add a jar resource.

Parameters:
jar - The jar.
Throws:
java.lang.Exception - If an error occurs while adding the resource.

addJarRepository

public void addJarRepository(java.io.File repository)
                      throws java.lang.Exception
Add a new repository to the set of places this ClassLoader can look for classes to be loaded.

Parameters:
repository - Name of a source of classes to be loaded, such as a directory pathname, a JAR file pathname, or a ZIP file pathname. The parameter must be in the form of an URL.
Throws:
java.lang.IllegalArgumentException - if the specified repository is invalid or does not exist
java.lang.Exception