All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.resource.PathHandlerFactory Maven / Gradle / Ivy

There is a newer version: 4.31.0
Show newest version
package liquibase.resource;

import liquibase.plugin.AbstractPluginFactory;

import java.io.IOException;

/**
 * Singleton for working with {@link PathHandler}s.
 */
public class PathHandlerFactory extends AbstractPluginFactory {

    private PathHandlerFactory() {
    }

    @Override
    protected Class getPluginClass() {
        return PathHandler.class;
    }

    @Override
    protected int getPriority(PathHandler obj, Object... args) {
        return obj.getPriority((String) args[0]);
    }

    /**
     * Creates the {@link ResourceAccessor} for the given path.
     */
    public ResourceAccessor getResourceAccessor(String root) throws IOException {
        final PathHandler plugin = getPlugin(root);
        if (plugin == null) {
            throw new IOException("Cannot parse resource location: '" + root + "'");
        }
        return plugin.getResourceAccessor(root);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy