Package liquibase.resource
Class PathHandlerFactory
- All Implemented Interfaces:
PluginFactory
,SingletonObject
Singleton for working with
PathHandler
s.-
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(String resourcePath) Creates a new resource at the specified path and returns an OutputStream for writing to it.protected Class<PathHandler>
protected int
getPriority
(PathHandler obj, Object... args) Returns the priority of the given object based on the passed args array.getResource
(String resourcePath) Return the resource for the given path.getResourceAccessor
(String root) Creates aResourceAccessor
for the given path.openResourceOutputStream
(String resourcePath, boolean createIfNotExists) Deprecated.openResourceOutputStream
(String resourcePath, OpenOptions openOptions) Returns the outputStream fromgetResource(String)
, using settings from the passedOpenOptions
.Methods inherited from class liquibase.plugin.AbstractPluginFactory
findAllInstances, getPlugin, getPlugins, register, removeInstance
-
Method Details
-
getPluginClass
- Specified by:
getPluginClass
in classAbstractPluginFactory<PathHandler>
-
getPriority
Description copied from class:AbstractPluginFactory
Returns the priority of the given object based on the passed args array. The args are created as part of the custom public getPlugin method in implementations are passed throughAbstractPluginFactory.getPlugin(Object...)
- Specified by:
getPriority
in classAbstractPluginFactory<PathHandler>
-
getResourceAccessor
Creates aResourceAccessor
for the given path.- Throws:
IOException
-
createResource
Creates a new resource at the specified path and returns an OutputStream for writing to it.- Throws:
FileAlreadyExistsException
- if the file already existsIOException
- if the path cannot be written to
-
getResource
Return the resource for the given path.- Returns:
- A resource, regardless of whether it exists or not.
- Throws:
IOException
- if the path cannot be understood or if there is a problem parsing the pathIOException
- if the path exists as both a direct resourcePath and also in the resourceAccessor (if included). UnlessGlobalConfiguration.DUPLICATE_FILE_MODE
overrides that behavior.
-
openResourceOutputStream
@Deprecated public OutputStream openResourceOutputStream(String resourcePath, boolean createIfNotExists) throws IOException Deprecated.Returns the outputStream fromgetResource(String)
if it exists, and the outputStream fromcreateResource(String)
if it does not.- Returns:
- null if resourcePath does not exist and createIfNotExists is false
- Throws:
IOException
- if there is an error opening the stream
-
openResourceOutputStream
public OutputStream openResourceOutputStream(String resourcePath, OpenOptions openOptions) throws IOException Returns the outputStream fromgetResource(String)
, using settings from the passedOpenOptions
.- Returns:
- null if resourcePath does not exist and
OpenOptions.isCreateIfNeeded()
is false - Throws:
IOException
- if there is an error opening the stream
-
openResourceOutputStream(String, OpenOptions)