use of org.locationtech.geogig.storage.ConfigDatabase in project GeoGig by boundlessgeo.
the class RemoteListOp method _call.
/**
* Executes the remote-list operation.
*
* @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()));
}
}
return ImmutableList.copyOf(allRemotes);
}
use of org.locationtech.geogig.storage.ConfigDatabase in project GeoGig by boundlessgeo.
the class RemoteResolve method _call.
/**
* Executes the remote-add operation.
*
* @return the {@link Remote} that was added.
*/
@Override
protected Optional<Remote> _call() {
if (name == null || name.isEmpty()) {
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());
result = Optional.of(remote);
}
}
return result;
}
use of org.locationtech.geogig.storage.ConfigDatabase in project GeoGig by boundlessgeo.
the class JEObjectDatabaseTest method createDb.
private ObjectDatabase createDb() {
ConfigDatabase configDB = new IniFileConfigDatabase(platform);
JEObjectDatabase db = new JEObjectDatabase_v0_1(configDB, envProvider, hints);
db.open();
return db;
}
use of org.locationtech.geogig.storage.ConfigDatabase in project GeoGig by boundlessgeo.
the class JEGraphDatabaseV1StressTest method createDatabase.
@Override
protected GraphDatabase createDatabase(TestPlatform platform) {
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());
}
use of org.locationtech.geogig.storage.ConfigDatabase in project GeoGig by boundlessgeo.
the class JEGraphDatabaseV1Test method createDatabase.
@Override
protected GraphDatabase createDatabase(Platform platform) throws Exception {
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());
}
Aggregations