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

com.liquibase.ext.config.MongoshConfiguration Maven / Gradle / Ivy

The newest version!
package com.liquibase.ext.config;

import liquibase.configuration.AutoloadedConfigurations;
import liquibase.configuration.ConfigurationDefinition;

public class MongoshConfiguration implements AutoloadedConfigurations {

    public static final ConfigurationDefinition PATH;
    public static final ConfigurationDefinition TIMEOUT;
    public static final ConfigurationDefinition TEMP_KEEP;
    public static final ConfigurationDefinition TEMP_NAME;
    public static final ConfigurationDefinition TEMP_PATH;
    public static final ConfigurationDefinition ARGS;
    public static final ConfigurationDefinition LOG_FILE;
    public static final ConfigurationDefinition EXECUTOR;

    static {
        ConfigurationDefinition.Builder builder = new ConfigurationDefinition.Builder(MongoshConfiguration.ConfigurationKeys.BASE);

        PATH = builder.define("path", String.class)
                .setDescription("Path to mongosh executable")
                .build();

        TIMEOUT = builder.define("timeout", Integer.class)
                .setDescription("Seconds to wait for mongosh timeout")
                .build();

        TEMP_KEEP = builder.define(MongoshConfiguration.ConfigurationKeys.KEEP_TEMP_BASE, Boolean.class)
                .setDescription("Retain generated temp files")
                .build();

        TEMP_NAME = builder.define(MongoshConfiguration.ConfigurationKeys.KEEP_TEMP_NAME, String.class)
                .setDescription("Optionally, specify a custom filename")
                .build();

        TEMP_PATH = builder.define(MongoshConfiguration.ConfigurationKeys.KEEP_TEMP_PATH, String.class)
                .setDescription("Optionally, specify the path in which to store the temporary files. If not specified," +
                        " the files will be stored in the system's temp directory")
                .build();

        LOG_FILE = builder.define(MongoshConfiguration.ConfigurationKeys.LOG_FILE, String.class)
                .setDescription("Log file for mongosh output")
                .build();

        ARGS = builder.define("args", String.class)
                .setDescription("Extra arguments which will be passed to the mongosh executable")
                .build();

        EXECUTOR = builder.define(MongoshConfiguration.ConfigurationKeys.EXECUTOR, String.class)
                .setDescription("Custom executor that can be specified")
                .build();
    }

    public static class ConfigurationKeys {
        public static final String BASE = "liquibase.mongosh";
        public static final String KEEP_TEMP_BASE = "keep.temp";
        public static final String KEEP_TEMP_NAME = KEEP_TEMP_BASE + ".name";
        public static final String KEEP_TEMP_PATH = KEEP_TEMP_BASE + ".path";
        public static final String LOG_FILE = "logFile";
        public static final String EXECUTOR = "executor";

        public static String getFullKey(String keyName) {
            return BASE + "." + keyName;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy