Examples of ConfigDatabase


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_2(configDB, envProvider, new Hints());
    }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        envProvider = new EnvironmentBuilder(platform);

    }

    private ObjectDatabase createDb() {
        ConfigDatabase configDB = new IniFileConfigDatabase(platform);
        JEObjectDatabase db = new JEObjectDatabase_v0_1(configDB, envProvider, hints);
        db.open();
        return db;
    }
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

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

Examples of org.locationtech.geogig.storage.ConfigDatabase

     *
     * @return {@code List<Remote>} of all remotes found in the config database, may be empty.
     */
    @Override
    protected ImmutableList<Remote> _call() {
        ConfigDatabase config = configDatabase();
        List<String> remotes = config.getAllSubsections("remote");
        List<Remote> allRemotes = new ArrayList<Remote>();
        for (String remoteName : remotes) {
            String remoteSection = "remote." + remoteName;
            Optional<String> remoteFetchURL = config.get(remoteSection + ".url");
            Optional<String> remoteFetch = config.get(remoteSection + ".fetch");
            Optional<String> remoteMapped = config.get(remoteSection + ".mapped");
            Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch");
            Optional<String> remoteUserName = config.get(remoteSection + ".username");
            Optional<String> remotePassword = config.get(remoteSection + ".password");
            if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) {
                Optional<String> remotePushURL = config.get(remoteSection + ".pushurl");
                allRemotes.add(new Remote(remoteName, remoteFetchURL.get(), remotePushURL
                        .or(remoteFetchURL.get()), remoteFetch.get(), remoteMapped.or("false")
                        .equals("true"), remoteMappedBranch.orNull(), remoteUserName.orNull(),
                        remotePassword.orNull()));
            }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

            throw new RemoteException(StatusCode.MISSING_NAME);
        }

        Optional<Remote> result = Optional.absent();

        ConfigDatabase config = configDatabase();
        List<String> allRemotes = config.getAllSubsections("remote");
        if (allRemotes.contains(name)) {

            String remoteSection = "remote." + name;
            Optional<String> remoteFetchURL = config.get(remoteSection + ".url");
            Optional<String> remoteFetch = config.get(remoteSection + ".fetch");
            Optional<String> remoteMapped = config.get(remoteSection + ".mapped");
            Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch");
            Optional<String> remoteUserName = config.get(remoteSection + ".username");
            Optional<String> remotePassword = config.get(remoteSection + ".password");
            if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) {
                Optional<String> remotePushURL = config.get(remoteSection + ".pushurl");

                Remote remote = new Remote(name, remoteFetchURL.get(),
                        remotePushURL.or(remoteFetchURL.get()), remoteFetch.get(), remoteMapped.or(
                                "false").equals("true"), remoteMappedBranch.orNull(),
                        remoteUserName.orNull(), remotePassword.orNull());
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        }
        if (branch == null || branch.isEmpty()) {
            branch = "*";
        }

        ConfigDatabase config = configDatabase();
        List<String> allRemotes = config.getAllSubsections("remote");
        if (allRemotes.contains(name)) {
            throw new RemoteException(StatusCode.REMOTE_ALREADY_EXISTS);
        }

        String configSection = "remote." + name;
        String fetch = "+" + Ref.HEADS_PREFIX + branch + ":" + Ref.REMOTES_PREFIX + name + "/"
                + branch;

        config.put(configSection + ".url", url);
        config.put(configSection + ".fetch", fetch);
        if (mapped) {
            config.put(configSection + ".mapped", "true");
            config.put(configSection + ".mappedBranch", branch);
        }
        if (username != null) {
            config.put(configSection + ".username", username);
        }
        if (password != null) {
            password = Remote.encryptPassword(password);
            config.put(configSection + ".password", password);
        }

        return new Remote(name, url, url, fetch, mapped, branch, username, password);
    }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

                bind(ObjectSerializingFactory.class).toInstance(sfac);

                bind(ObjectDatabase.class).to(HeapObjectDatabse.class).in(Scopes.SINGLETON);
                bind(StagingDatabase.class).to(HeapStagingDatabase.class).in(Scopes.SINGLETON);

                ConfigDatabase config = new IniFileConfigDatabase(platform);
                bind(ConfigDatabase.class).toInstance(config);

                bind(ObjectDatabaseCacheFactory.class).toInstance(odbCacheFac);
                bind(StagingDatabaseCacheFactory.class).toInstance(indexCacheFac);
            }
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

    @Override
    protected Remote _call() {
        if (name == null || name.isEmpty()) {
            throw new RemoteException(StatusCode.MISSING_NAME);
        }
        ConfigDatabase config = configDatabase();
        List<String> allRemotes = config.getAllSubsections("remote");
        if (!allRemotes.contains(name)) {
            throw new RemoteException(StatusCode.REMOTE_NOT_FOUND);
        }

        Remote remote = null;
        String remoteSection = "remote." + name;
        Optional<String> remoteFetchURL = config.get(remoteSection + ".url");
        Optional<String> remoteFetch = config.get(remoteSection + ".fetch");
        Optional<String> remotePushURL = Optional.absent();
        Optional<String> remoteMapped = config.get(remoteSection + ".mapped");
        Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch");
        Optional<String> remoteUserName = config.get(remoteSection + ".username");
        Optional<String> remotePassword = config.get(remoteSection + ".password");
        if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) {
            remotePushURL = config.get(remoteSection + ".pushurl");
        }

        remote = new Remote(name, remoteFetchURL.or(""), remotePushURL.or(remoteFetchURL.or("")),
                remoteFetch.or(""), remoteMapped.or("false").equals("true"),
                remoteMappedBranch.orNull(), remoteUserName.orNull(), remotePassword.orNull());

        config.removeSection(remoteSection);

        // Remove refs
        final ImmutableSet<Ref> localRemoteRefs = command(LsRemote.class).retrieveLocalRefs(true)
                .setRemote(Suppliers.ofInstance(Optional.of(remote))).call();
View Full Code Here

Examples of org.locationtech.geogig.storage.ConfigDatabase

        test(ConfigScope.DEFAULT);
    }

    @Test
    public void testListDefaultWithNoLocalRepository() {
        ConfigDatabase database = mock(ConfigDatabase.class);
        when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION));
        ConfigOp config = new ConfigOp(database);

        config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_LIST).setName(null)
                .setValue(null).call();
    }
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.