public class SpringResourceAccessor extends AbstractResourceAccessor
ResourceAccessor.NotFoundResource
Constructor and Description |
---|
SpringResourceAccessor(org.springframework.core.io.ResourceLoader resourceLoader) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
List<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.
|
List<Resource> |
getAll(String path)
Returns all
Resource s at the given path. |
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.
|
protected boolean |
resourceIsFile(org.springframework.core.io.Resource resource)
Return true if the given resource is a standard file.
|
List<Resource> |
search(String searchPath,
boolean recursive)
Returns the path to all resources contained in the given path.
|
clone, describe, equals, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, hashCode, set, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
get, getExisting, list, openStream, openStreams
public SpringResourceAccessor(org.springframework.core.io.ResourceLoader resourceLoader)
public List<Resource> getAll(String path) throws IOException
ResourceAccessor
Resource
s at the given path.
For many resource accessors (such as a file system), only one resource can exist at a given spot,
but some accessors (such as CompositeResourceAccessor
or ClassLoaderResourceAccessor
) can have multiple resources for a single path.
If the resourceAccessor returns multiple values, the returned List should be considered sorted for that resource accessor.
For example, ClassLoaderResourceAccessor
returns them in order based on the configured classloader.
Order is important to pay attention to, because users may set GlobalConfiguration.DUPLICATE_FILE_MODE
to pick the "best" file which is defined as
"the first file from this function".
IOException
- if there is an unexpected error determining what is at the pathpublic List<Resource> search(String searchPath, boolean recursive) throws IOException
ResourceAccessor
searchPath
- The path to lookup resources in.recursive
- Set to true and will return paths to contents in subdirectories as well.IOException
- if there is an error searching the system.public List<String> describeLocations()
ResourceAccessor
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 © 2023 Liquibase.org. All rights reserved.