public class SpringResourceAccessor extends AbstractResourceAccessor
Constructor and Description |
---|
SpringResourceAccessor(org.springframework.core.io.ResourceLoader resourceLoader) |
Modifier and Type | Method and Description |
---|---|
SortedSet<String> |
describeLocations()
Returns a description of the places this classloader will look for paths.
|
protected String |
finalizeSearchPath(String searchPath)
Ensure the given searchPath is a valid searchPath.
|
protected String |
getCompletePath(String relativeTo,
String path)
Returns the complete path to the resource, taking the relative path into account
|
protected org.springframework.core.io.Resource |
getResource(String resourcePath)
Looks up the given resource.
|
protected String |
getResourcePath(org.springframework.core.io.Resource resource)
Returns the lookup path to the given resource.
|
SortedSet<String> |
list(String relativeTo,
String path,
boolean recursive,
boolean includeFiles,
boolean includeDirectories)
Returns the path to all resources contained in the given path.
|
InputStreamList |
openStreams(String relativeTo,
String streamPath)
Return the streams for each resource mapped by the given path.
|
protected boolean |
resourceIsFile(org.springframework.core.io.Resource resource)
Return true if the given resource is a standard file.
|
openStream
clone, describe, equals, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, hashCode, set, toString
public SpringResourceAccessor(org.springframework.core.io.ResourceLoader resourceLoader)
public SortedSet<String> list(String relativeTo, String path, boolean recursive, boolean includeFiles, boolean includeDirectories) throws IOException
ResourceAccessor
ResourceAccessor.openStreams(String, String)
and return the contents.
Returned paths should normally be root-relative and therefore not be an absolute path, unless there is a good reason to be absolute.relativeTo
- Location that streamPath should be found relative to. If null, path is an absolute pathpath
- The path to lookup resources in.recursive
- Set to true and will return paths to contents in sub directories as well.includeFiles
- Set to true and will return paths to files.includeDirectories
- Set to true and will return paths to directories.IOException
- if there is an error reading an existing root.public SortedSet<String> describeLocations()
ResourceAccessor
public InputStreamList openStreams(String relativeTo, String streamPath) throws IOException
ResourceAccessor
InputStreamList
since multiple resources can map to the same path, such as "META-INF/MAINFEST.MF".
Remember to close streams when finished with them.relativeTo
- Location that streamPath should be found relative to. If null, streamPath is an absolute pathIOException
- if there is an error reading an existing path.protected String getResourcePath(org.springframework.core.io.Resource resource)
protected String getCompletePath(String relativeTo, String path) throws IOException
IOException
protected org.springframework.core.io.Resource getResource(String resourcePath)
protected boolean resourceIsFile(org.springframework.core.io.Resource resource) throws IOException
IOException
Copyright © 2022 Liquibase.org. All rights reserved.