Package liquibase.resource
Class AbstractResource
- java.lang.Object
-
- liquibase.resource.AbstractResource
-
- All Implemented Interfaces:
Resource
- Direct Known Subclasses:
MockResource,PathResource,ResourceAccessor.NotFoundResource,URIResource
public abstract class AbstractResource extends Object implements Resource
-
-
Constructor Summary
Constructors Constructor Description AbstractResource(String path, URI uri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetPath()Returns the normalized, ResourceAccessor-relative path for this resource.URIgetUri()Returns a unique and complete identifier for this resource.inthashCode()booleanisWritable()Return true if the resource can be written toOutputStreamopenOutputStream(OpenOptions openOptions)Opens an output stream given the passedOpenOptions.protected StringresolvePath(String other)Convenience method for computing the relative path inResource.resolve(String)implementationsprotected StringresolveSiblingPath(String other)Convenience method for computing the relative path inResource.resolveSibling(String)implementations.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface liquibase.resource.Resource
exists, openInputStream, openOutputStream, resolve, resolveSibling
-
-
-
-
Method Detail
-
getPath
public String getPath()
Description copied from interface:ResourceReturns the normalized, ResourceAccessor-relative path for this resource. To get the unique location of this resource, useResource.getUri()This should always use `/` for separators This should not include any sort of protocol or prefixes This should not have a leading /. This should have any relative paths smoothed out -- return "path/to/resource" not "path/from/../to/resource".
-
getUri
public URI getUri()
Description copied from interface:ResourceReturns a unique and complete identifier for this resource. This will be different than what is returned byResource.getPath()because the path within the resource accessor whereas this is the a complete path to it.For example, a file resource may return a path of
my/file.txtand a uri offile:/tmp/project/liquibase/my/file.txtfor a resource accessor usingfile:/tmp/project/liquibaseas a root
-
isWritable
public boolean isWritable()
Description copied from interface:ResourceReturn true if the resource can be written to- Specified by:
isWritablein interfaceResource
-
openOutputStream
public OutputStream openOutputStream(OpenOptions openOptions) throws IOException
Description copied from interface:ResourceOpens an output stream given the passedOpenOptions. Cannot pass a null OpenOptions value- Specified by:
openOutputStreamin interfaceResource- Throws:
IOException
-
resolvePath
protected String resolvePath(String other)
Convenience method for computing the relative path inResource.resolve(String)implementations
-
resolveSiblingPath
protected String resolveSiblingPath(String other)
Convenience method for computing the relative path inResource.resolveSibling(String)implementations.
-
-