use of org.locationtech.geogig.api.DefaultPlatform in project GeoGig by boundlessgeo.
the class Main method loadGeoGIG.
static GeoGIG loadGeoGIG(String repo) {
Platform platform = new DefaultPlatform();
platform.setWorkingDir(new File(repo));
Context inj = GlobalContextBuilder.builder.build();
GeoGIG geogig = new GeoGIG(inj, platform.pwd());
if (geogig.command(ResolveGeogigDir.class).call().isPresent()) {
geogig.getRepository();
return geogig;
}
return geogig;
}
use of org.locationtech.geogig.api.DefaultPlatform in project GeoGig by boundlessgeo.
the class SilentProgressListener method runCommand.
/**
* Runs a command on a given repository
*
* @param folder the repository folder
* @param args the args to run, including the command itself and additional parameters
* @return
* @throws IOException
*/
public int runCommand(String folder, String[] args) throws IOException {
System.gc();
GeogigCLI cli = new GeogigCLI(consoleReader) {
@Override
public synchronized ProgressListener getProgressListener() {
if (super.progressListener == null) {
super.progressListener = new DefaultProgressListener() {
@Override
public void setDescription(String s) {
GeogigPy4JEntryPoint.this.listener.setProgressText(s);
}
@Override
public synchronized void setProgress(float percent) {
GeogigPy4JEntryPoint.this.listener.setProgress(percent);
}
};
}
return super.progressListener;
}
};
DefaultPlatform platform = new DefaultPlatform();
platform.setWorkingDir(new File(folder));
cli.setPlatform(platform);
String command = Joiner.on(" ").join(args);
os.clear();
pages = null;
System.out.print("Running command: " + command);
int ret = cli.execute(args);
cli.close();
if (ret == 0) {
System.out.println(" [OK]");
} else {
System.out.println(" [Error]");
}
stream.flush();
os.flush();
return ret;
}
use of org.locationtech.geogig.api.DefaultPlatform in project GeoGig by boundlessgeo.
the class Serve method loadGeoGIG.
GeoGIG loadGeoGIG(String repo, GeogigCLI cli) {
Platform platform = new DefaultPlatform();
platform.setWorkingDir(new File(repo));
GeoGIG geogig = new GeoGIG(cli.getGeogigInjector(), platform.pwd());
if (geogig.command(ResolveGeogigDir.class).call().isPresent()) {
geogig.getRepository();
}
return geogig;
}
Aggregations