Examples of ConfigDatabase


Examples of org.geoserver.jdbcconfig.internal.ConfigDatabase

    public void setUp() throws Exception {
        super.GET_LAYER_BY_ID_WITH_CONCURRENT_ADD_TEST_COUNT = 10;
       
        testSupport.setUp();

        ConfigDatabase configDb = testSupport.getDatabase();
        facade = new JDBCCatalogFacade(configDb);

        super.setUp();
    }
View Full Code Here

Examples of org.geoserver.jdbcconfig.internal.ConfigDatabase

            return new DataSourceTransactionManager(dataSource());
        }

        @Bean
        public ConfigDatabase configDatabase() {
            return new ConfigDatabase(dataSource(), new XStreamInfoSerialBinding(
                new XStreamPersisterFactory()));
        }
View Full Code Here

Examples of org.geoserver.jdbcconfig.internal.ConfigDatabase

        if (!config.isEnabled()) {
            return;
        }

        ConfigDatabase configDatabase = ((JDBCCatalogFacade) catalogFacade).getConfigDatabase();

        URL initScript = config.isInitDb() ? config.getInitScript() : null;
        configDatabase.initDb(initScript);

        config.setInitDb(false);
        config.save();
    }
View Full Code Here

Examples of org.geoserver.jdbcconfig.internal.ConfigDatabase

    @Override
    public void setUp() throws Exception {
        testSupport.setUp();

        ConfigDatabase configDb = testSupport.getDatabase();
        facade = new JDBCGeoServerFacade(configDb);
        facade.setResourceLoader(testSupport.getResourceLoader());

        super.setUp();
    }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

     * @throws ConfigException if an error is encountered. More specific information can be found in
     *         the exception's statusCode.
     */
    @Override
    protected  Optional<Map<String, String>> _call() {
        final ConfigDatabase config = configDatabase();
        switch (action) {
        case CONFIG_GET: {
            if (name == null || name.isEmpty())
                throw new ConfigException(StatusCode.SECTION_OR_NAME_NOT_PROVIDED);

            if (value == null || value.isEmpty()) {
                Optional<String> val = Optional.absent();
                if (scope == ConfigScope.GLOBAL) {
                    val = config.getGlobal(name);
                } else {
                    try {
                        val = config.get(name);
                    } catch (ConfigException e) {
                        if (scope == ConfigScope.LOCAL) {
                            throw new ConfigException(e.statusCode);
                        }
                    }

                    // Fallback on global config file if name wasn't found locally
                    if (!val.isPresent()) {
                        val = config.getGlobal(name);
                    }
                }

                if (val.isPresent()) {
                    Map<String, String> resultMap = new HashMap<String, String>();
                    resultMap.put(name, val.get());
                    return Optional.of(resultMap);
                }
            } else {
                throw new ConfigException(StatusCode.TOO_MANY_ARGS);
            }
            break;
        }
        case CONFIG_SET: {
            if (name == null || name.isEmpty())
                throw new ConfigException(StatusCode.SECTION_OR_NAME_NOT_PROVIDED);

            if (scope == ConfigScope.GLOBAL) {
                config.putGlobal(name, value);
            } else {
                config.put(name, value);
            }
            break;
        }
        case CONFIG_UNSET: {
            if (name == null || name.isEmpty())
                throw new ConfigException(StatusCode.SECTION_OR_NAME_NOT_PROVIDED);

            if (scope == ConfigScope.GLOBAL) {
                config.removeGlobal(name);
            } else {
                config.remove(name);
            }
            break;
        }
        case CONFIG_REMOVE_SECTION: {
            if (name == null || name.isEmpty())
                throw new ConfigException(StatusCode.SECTION_OR_NAME_NOT_PROVIDED);

            if (scope == ConfigScope.GLOBAL) {
                config.removeSectionGlobal(name);
            } else {
                config.removeSection(name);
            }
            break;
        }
        case CONFIG_LIST: {
            Map<String, String> results = null;
            if (scope == ConfigScope.LOCAL) {
                results = config.getAll();
            } else {
                results = config.getAllGlobal();
                if (scope == ConfigScope.DEFAULT) {
                    try {
                        Map<String, String> localresults = config.getAll();

                        results.putAll(localresults);

                    } catch (ConfigException e) {

View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        }

        Repository repository;
        try {
            if (!repoExisted) {
                ConfigDatabase configDB = context.configDatabase();
                try {
                    for (Entry<String, String> pair : effectiveConfigBuilder.entrySet()) {
                        String key = pair.getKey();
                        String value = pair.getValue();
                        configDB.put(key, value);
                    }
                    repository = repository();
                    repository.configure();
                } catch (RepositoryConnectionException e) {
                    throw new IllegalStateException(
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

    }

    @SuppressWarnings("unchecked")
    private <T> T getConfig(final String keyword, final T defaultValue) {
        final String kw = configKeywordPrefix + "." + keyword;
        ConfigDatabase configDatabase = configDb.get();
        try {
            Optional<? extends Object> value = configDatabase.get(kw, defaultValue.getClass());
            if (value.isPresent()) {
                LOGGER.trace("Got cache config property {} = {}", kw, value.get());
                return (T) value.get();
            }
        } catch (ConfigException e) {
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

            throws CannotRunGeogigOperationException {
        Boolean enabled;
        if (command.context().repository() == null) {
            return command;
        }
        ConfigDatabase configDb = command.context().configDatabase();
        try {
            enabled = configDb.get(METRICS_ENABLED, Boolean.class).or(Boolean.FALSE);
        } catch (ConfigException e) {
            if (StatusCode.INVALID_LOCATION.equals(e.statusCode)) {
                enabled = Boolean.FALSE;
            } else {
                throw e;
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        MongoClient client = new MongoClient(new MongoClientURI(uri));
        DB db = client.getDB(database);
        db.dropDatabase();

        MongoConnectionManager manager = new MongoConnectionManager();
        ConfigDatabase config = new TestConfigDatabase(platform);
        MongoGraphDatabase mongoGraphDatabase = new MongoGraphDatabase(manager, config);
        return mongoGraphDatabase;
    }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        File root = platform.pwd();
        Preconditions.checkState(new File(root, ".geogig").exists());

        envProvider = new EnvironmentBuilder(platform);

        ConfigDatabase configDB = new IniFileConfigDatabase(platform);
        return new JEGraphDatabase_v0_1(configDB, envProvider, new Hints());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.