Package org.codehaus.plexus.resource
Class DefaultResourceManager
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.plexus.resource.DefaultResourceManager
-
- All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled,ResourceManager
@Component(role=ResourceManager.class, instantiationStrategy="per-lookup") public class DefaultResourceManager extends org.codehaus.plexus.logging.AbstractLogEnabled implements ResourceManager
- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FileoutputDirectoryprivate java.util.Map<java.lang.String,ResourceLoader>resourceLoaders-
Fields inherited from interface org.codehaus.plexus.resource.ResourceManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSearchPath(java.lang.String id, java.lang.String path)voidcreateResourceAsFile(PlexusResource resource, java.io.File outputFile)Downloads the resource to the given output file.PlexusResourcegetResource(java.lang.String name)Searches for a resource with the given name.java.io.FilegetResourceAsFile(java.lang.String name)java.io.FilegetResourceAsFile(java.lang.String name, java.lang.String outputPath)java.io.FilegetResourceAsFile(PlexusResource resource)Returns a file with the given resources contents.java.io.InputStreamgetResourceAsInputStream(java.lang.String name)java.io.FileresolveLocation(java.lang.String name)Provides compatibility with the Locator utility used by several Maven Plugins.java.io.FileresolveLocation(java.lang.String name, java.lang.String outputPath)Provides compatibility with the Locator utility used by several Maven Plugins.voidsetOutputDirectory(java.io.File outputDirectory)
-
-
-
Field Detail
-
resourceLoaders
@Requirement(role=ResourceLoader.class) private java.util.Map<java.lang.String,ResourceLoader> resourceLoaders
-
outputDirectory
private java.io.File outputDirectory
-
-
Method Detail
-
getResourceAsInputStream
public java.io.InputStream getResourceAsInputStream(java.lang.String name) throws ResourceNotFoundException- Specified by:
getResourceAsInputStreamin interfaceResourceManager- Throws:
ResourceNotFoundException
-
getResourceAsFile
public java.io.File getResourceAsFile(java.lang.String name) throws ResourceNotFoundException, FileResourceCreationException- Specified by:
getResourceAsFilein interfaceResourceManager- Throws:
ResourceNotFoundExceptionFileResourceCreationException
-
getResourceAsFile
public java.io.File getResourceAsFile(java.lang.String name, java.lang.String outputPath) throws ResourceNotFoundException, FileResourceCreationException- Specified by:
getResourceAsFilein interfaceResourceManager- Throws:
ResourceNotFoundExceptionFileResourceCreationException
-
resolveLocation
public java.io.File resolveLocation(java.lang.String name, java.lang.String outputPath) throws java.io.IOExceptionDescription copied from interface:ResourceManagerProvides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocationin interfaceResourceManager- Throws:
java.io.IOException
-
resolveLocation
public java.io.File resolveLocation(java.lang.String name) throws java.io.IOExceptionDescription copied from interface:ResourceManagerProvides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocationin interfaceResourceManager- Throws:
java.io.IOException
-
setOutputDirectory
public void setOutputDirectory(java.io.File outputDirectory)
- Specified by:
setOutputDirectoryin interfaceResourceManager
-
addSearchPath
public void addSearchPath(java.lang.String id, java.lang.String path)- Specified by:
addSearchPathin interfaceResourceManager
-
getResource
public PlexusResource getResource(java.lang.String name) throws ResourceNotFoundException
Description copied from interface:ResourceManagerSearches for a resource with the given name.- Specified by:
getResourcein interfaceResourceManager- Throws:
ResourceNotFoundException
-
getResourceAsFile
public java.io.File getResourceAsFile(PlexusResource resource) throws FileResourceCreationException
Description copied from interface:ResourceManagerReturns a file with the given resources contents. If the resource is already available as a file, returns that file. Otherwise, a file in the resource managers output directory is created and the resource is downloaded to that file.- Specified by:
getResourceAsFilein interfaceResourceManager- Throws:
FileResourceCreationException
-
createResourceAsFile
public void createResourceAsFile(PlexusResource resource, java.io.File outputFile) throws FileResourceCreationException
Description copied from interface:ResourceManagerDownloads the resource to the given output file.- Specified by:
createResourceAsFilein interfaceResourceManager- Throws:
FileResourceCreationException
-
-