Package org.codehaus.plexus.resource
Class DefaultResourceManager
- java.lang.Object
-
- org.codehaus.plexus.resource.DefaultResourceManager
-
- All Implemented Interfaces:
ResourceManager
@Named public class DefaultResourceManager extends java.lang.Object implements ResourceManager
- Version:
- $Id$
- Author:
- Trygve Laugstøl, Jason van Zyl
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceManager(java.util.Map<java.lang.String,ResourceLoader> resourceLoaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSearchPath(java.lang.String id, java.lang.String path)
void
createResourceAsFile(PlexusResource resource, java.io.File outputFile)
Downloads the resource to the given output file.PlexusResource
getResource(java.lang.String name)
Searches for a resource with the given name.java.io.File
getResourceAsFile(java.lang.String name)
java.io.File
getResourceAsFile(java.lang.String name, java.lang.String outputPath)
java.io.File
getResourceAsFile(PlexusResource resource)
Returns a file with the given resources contents.java.io.InputStream
getResourceAsInputStream(java.lang.String name)
java.io.File
resolveLocation(java.lang.String name)
Provides compatibility with the Locator utility used by several Maven Plugins.java.io.File
resolveLocation(java.lang.String name, java.lang.String outputPath)
Provides compatibility with the Locator utility used by several Maven Plugins.void
setOutputDirectory(java.io.File outputDirectory)
-
-
-
Constructor Detail
-
DefaultResourceManager
@Inject public DefaultResourceManager(java.util.Map<java.lang.String,ResourceLoader> resourceLoaders)
-
-
Method Detail
-
getResourceAsInputStream
public java.io.InputStream getResourceAsInputStream(java.lang.String name) throws ResourceNotFoundException
- Specified by:
getResourceAsInputStream
in interfaceResourceManager
- Throws:
ResourceNotFoundException
-
getResourceAsFile
public java.io.File getResourceAsFile(java.lang.String name) throws ResourceNotFoundException, FileResourceCreationException
- Specified by:
getResourceAsFile
in interfaceResourceManager
- Throws:
ResourceNotFoundException
FileResourceCreationException
-
getResourceAsFile
public java.io.File getResourceAsFile(java.lang.String name, java.lang.String outputPath) throws ResourceNotFoundException, FileResourceCreationException
- Specified by:
getResourceAsFile
in interfaceResourceManager
- Throws:
ResourceNotFoundException
FileResourceCreationException
-
resolveLocation
public java.io.File resolveLocation(java.lang.String name, java.lang.String outputPath)
Description copied from interface:ResourceManager
Provides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocation
in interfaceResourceManager
-
resolveLocation
public java.io.File resolveLocation(java.lang.String name)
Description copied from interface:ResourceManager
Provides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocation
in interfaceResourceManager
-
setOutputDirectory
public void setOutputDirectory(java.io.File outputDirectory)
- Specified by:
setOutputDirectory
in interfaceResourceManager
-
addSearchPath
public void addSearchPath(java.lang.String id, java.lang.String path)
- Specified by:
addSearchPath
in interfaceResourceManager
-
getResource
public PlexusResource getResource(java.lang.String name) throws ResourceNotFoundException
Description copied from interface:ResourceManager
Searches for a resource with the given name.- Specified by:
getResource
in interfaceResourceManager
- Throws:
ResourceNotFoundException
-
getResourceAsFile
public java.io.File getResourceAsFile(PlexusResource resource) throws FileResourceCreationException
Description copied from interface:ResourceManager
Returns 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:
getResourceAsFile
in interfaceResourceManager
- Throws:
FileResourceCreationException
-
createResourceAsFile
public void createResourceAsFile(PlexusResource resource, java.io.File outputFile) throws FileResourceCreationException
Description copied from interface:ResourceManager
Downloads the resource to the given output file.- Specified by:
createResourceAsFile
in interfaceResourceManager
- Throws:
FileResourceCreationException
-
-