Package liquibase.resource
Class PathHandlerFactory
- All Implemented Interfaces:
PluginFactory,SingletonObject
Singleton for working with
PathHandlers.-
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 intgetPriority(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 aResourceAccessorfor 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:
getPluginClassin classAbstractPluginFactory<PathHandler>
-
getPriority
Description copied from class:AbstractPluginFactoryReturns 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:
getPriorityin classAbstractPluginFactory<PathHandler>
-
getResourceAccessor
Creates aResourceAccessorfor 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_MODEoverrides 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)