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$
- Author:
- Trygve Laugstøl, Jason van Zyl
-
-
Field Summary
-
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(String id, String path)voidcreateResourceAsFile(PlexusResource resource, File outputFile)Downloads the resource to the given output file.PlexusResourcegetResource(String name)Searches for a resource with the given name.FilegetResourceAsFile(String name)FilegetResourceAsFile(String name, String outputPath)FilegetResourceAsFile(PlexusResource resource)Returns a file with the given resources contents.InputStreamgetResourceAsInputStream(String name)FileresolveLocation(String name)Provides compatibility with the Locator utility used by several Maven Plugins.FileresolveLocation(String name, String outputPath)Provides compatibility with the Locator utility used by several Maven Plugins.voidsetOutputDirectory(File outputDirectory)
-
-
-
Method Detail
-
getResourceAsInputStream
public InputStream getResourceAsInputStream(String name) throws ResourceNotFoundException
- Specified by:
getResourceAsInputStreamin interfaceResourceManager- Throws:
ResourceNotFoundException
-
getResourceAsFile
public File getResourceAsFile(String name) throws ResourceNotFoundException, FileResourceCreationException
- Specified by:
getResourceAsFilein interfaceResourceManager- Throws:
ResourceNotFoundExceptionFileResourceCreationException
-
getResourceAsFile
public File getResourceAsFile(String name, String outputPath) throws ResourceNotFoundException, FileResourceCreationException
- Specified by:
getResourceAsFilein interfaceResourceManager- Throws:
ResourceNotFoundExceptionFileResourceCreationException
-
resolveLocation
public File resolveLocation(String name, String outputPath) throws IOException
Description copied from interface:ResourceManagerProvides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocationin interfaceResourceManager- Throws:
IOException
-
resolveLocation
public File resolveLocation(String name) throws IOException
Description copied from interface:ResourceManagerProvides compatibility with the Locator utility used by several Maven Plugins.- Specified by:
resolveLocationin interfaceResourceManager- Throws:
IOException
-
setOutputDirectory
public void setOutputDirectory(File outputDirectory)
- Specified by:
setOutputDirectoryin interfaceResourceManager
-
addSearchPath
public void addSearchPath(String id, String path)
- Specified by:
addSearchPathin interfaceResourceManager
-
getResource
public PlexusResource getResource(String name) throws ResourceNotFoundException
Description copied from interface:ResourceManagerSearches for a resource with the given name.- Specified by:
getResourcein interfaceResourceManager- Throws:
ResourceNotFoundException
-
getResourceAsFile
public 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, File outputFile) throws FileResourceCreationException
Description copied from interface:ResourceManagerDownloads the resource to the given output file.- Specified by:
createResourceAsFilein interfaceResourceManager- Throws:
FileResourceCreationException
-
-