Top Constructors Methods
liquibase.resource

public abstract Class AbstractPathResourceAccessor

extends AbstractResourceAccessor
Class Inheritance
Known Direct Subclasses
liquibase.resource.DirectoryResourceAccessor, liquibase.resource.ZipResourceAccessor
Imports
liquibase.Scope, liquibase.logging.Logger, java.io.File, .IOException, java.nio.file.*, java.nio.file.attribute.BasicFileAttributes, java.util.*

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract Resource
createResource(Path file, String pathToAdd)

public List<String>
describeLocations()

Implements liquibase.resource.ResourceAccessor.describeLocations.

Returns a description of the places this classloader will look for paths.

public List<Resource>
getAll(String path)

Implements liquibase.resource.ResourceAccessor.getAll.

Returns all Resources at the given path.

protected abstract Path
public List<Resource>
search(String
The path to lookup resources in.
startPath
,
ResourceAccessor.SearchOptions
A set of criteria for how resources should be found/filtered
searchOptions
)

Overrides default liquibase.resource.ResourceAccessor.search.

Returns the path to all resources contained in the given path that match the searchOptions criteria.

public List<Resource>
search(String
The path to lookup resources in.
startPath
,
boolean
Set to true and will return paths to contents in subdirectories as well.
recursive
)

Implements liquibase.resource.ResourceAccessor.search.

Returns the path to all resources contained in the given path.

private String
public String
toString()

Overrides liquibase.AbstractExtensibleObject.toString.

Returns a string representation of the object.

Constructor Detail

AbstractPathResourceAccessorback to summary
public AbstractPathResourceAccessor()

Method Detail

createResourceback to summary
protected abstract Resource createResource(Path file, String pathToAdd)
describeLocationsback to summary
public List<String> describeLocations()

Implements liquibase.resource.ResourceAccessor.describeLocations.

Doc from liquibase.resource.ResourceAccessor.describeLocations.

Returns a description of the places this classloader will look for paths. Used in error messages and other troubleshooting cases.

Annotations
@Override
getAllback to summary
public List<Resource> getAll(String path) throws IOException

Implements liquibase.resource.ResourceAccessor.getAll.

Doc from liquibase.resource.ResourceAccessor.getAll.

Returns all Resources 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".

Returns:List<Resource>

null if no resources match the path

Annotations
@Override
Exceptions
IOException:
if there is an unexpected error determining what is at the path
getRootPathback to summary
protected abstract Path getRootPath()
searchback to summary
public List<Resource> search(String startPath, ResourceAccessor.SearchOptions searchOptions) throws IOException

Overrides default liquibase.resource.ResourceAccessor.search.

Doc from liquibase.resource.ResourceAccessor.search.

Returns the path to all resources contained in the given path that match the searchOptions criteria. Multiple resources may be returned with the same path, but only if they are actually unique files. Order is important to pay attention to, they should be returned in a user-expected manner based on this resource accessor.

Should return an empty list if:

  • Path does not exist or maxDepth less or equals than zero
Should throw an exception if:
  • Path is null
  • Path is not a "directory"
  • Path exists but cannot be read from
Parameters
startPath:String

The path to lookup resources in.

searchOptions:ResourceAccessor.SearchOptions

A set of criteria for how resources should be found/filtered

Returns:List<Resource>

empty set if nothing was found

Annotations
@Override
Exceptions
IOException:
if there is an error searching the system.
searchback to summary
public List<Resource> search(String startPath, boolean recursive) throws IOException

Implements liquibase.resource.ResourceAccessor.search.

Doc from liquibase.resource.ResourceAccessor.search.

Returns the path to all resources contained in the given path. Multiple resources may be returned with the same path, but only if they are actually unique files. Order is important to pay attention to, they should be returned in a user-expected manner based on this resource accessor.

Should return an empty list if:

  • Path does not exist
Should throw an exception if:
  • Path is null
  • Path is not a "directory"
  • Path exists but cannot be read from
Parameters
startPath:String

The path to lookup resources in.

recursive:boolean

Set to true and will return paths to contents in subdirectories as well.

Returns:List<Resource>

empty set if nothing was found

Annotations
@Override
Exceptions
IOException:
if there is an error searching the system.
standardizePathback to summary
private String standardizePath(String path)
toStringback to summary
public String toString()

Overrides liquibase.AbstractExtensibleObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override