@RequiresRepository(false) @Parameters(commandNames = "postgres-ddl", commandDescription = "Creates a DDL script to initialize a Geogig PostgreSQL database") public class PGCreateDDL extends AbstractCommand implements CLICommand { @Parameter(description = "<base URI> The URI without a repository name. (e.g. geogig postgres-ddl postgresql://localhost:5432/geogig_db?user=...&password=...)", arity = 1) private List<URI> baseuri = new ArrayList<>(); protected @Override void runInternal(GeogigCLI cli) throws IOException { checkParameter(!baseuri.isEmpty(), "Usage: geogig ls-repos <base URI> (e.g. geogig ls-repos postgresql://localhost:5432/geogig_db?user=...&password=...)"); URI baseURI = baseuri.get(0); List<String> statements = new CreateDDL().setBaseURI(baseURI).call(); for (String st : statements) { cli.getConsole().println(st); } } }
@RequiresRepository(true) @Parameters(commandNames = { "drop" }, commandDescription = "Remove an index from the repository.") public class DropIndex extends AbstractCommand implements CLICommand { @Parameter(names = "--tree", required = true, description = "Name or path of the feature tree of the index to drop.") private String treeRefSpec; @Parameter(names = { "-a", "--attribute" }, description = "Indexed attribute of the index to drop.") private String attribute; @Override protected void runInternal(GeogigCLI cli) throws InvalidParameterException, CommandFailedException, IOException { Repository repo = cli.getGeogig().getRepository(); repo.command(DropIndexOp.class)// .setTreeRefSpec(treeRefSpec)// .setAttributeName(attribute)// .setProgressListener(cli.getProgressListener())// .call(); cli.getConsole().println("Index successfully dropped."); } }
@RequiresRepository(true) @Parameters(commandNames = { "rebuild" }, commandDescription = "Rebuild the index trees of an index for the whole history of the repository.") public class RebuildIndex extends AbstractCommand implements CLICommand { @Parameter(names = "--tree", required = true, description = "Name or path of the feature tree to rebuild the index for.") private String treeRefSpec; @Parameter(names = { "-a", "--attribute" }, description = "Attribute to rebuild the index for.") private String attribute; @Override protected void runInternal(GeogigCLI cli) throws InvalidParameterException, CommandFailedException, IOException { Repository repo = cli.getGeogig().getRepository(); int treesRebuilt = repo.command(BuildFullHistoryIndexOp.class)// .setTreeRefSpec(treeRefSpec)// .setAttributeName(attribute)// .setProgressListener(cli.getProgressListener())// .call(); cli.getConsole().println(treesRebuilt + " trees were rebuilt."); } }
@RequiresRepository(false) @Parameters(commandNames = "postgres-upgrade", commandDescription = "Upgrade the schema of a geogig PostgreSQL databse to the latest version") public class PGStorageUpgrade extends AbstractCommand implements CLICommand { @Parameter(description = "<base URI> The URI without a repository name. (e.g. geogig postgres-upgrade postgresql://localhost:5432/geogig_db?user=...&password=...)", arity = 1) private List<URI> baseuri = new ArrayList<>(); protected @Override void runInternal(GeogigCLI cli) throws IOException { checkParameter(!baseuri.isEmpty(), "Usage: geogig postgres-upgrade <base URI> (e.g. geogig postgres-upgrade postgresql://localhost:5432/geogig_db?user=...&password=...)"); URI baseURI = baseuri.get(0); new PGDatabaseUpgrade().setBaseURI(baseURI).setProgressListener(cli.getProgressListener()) .call(); } public static void main(String... args) { Stopwatch sw = Stopwatch.createStarted(); GlobalContextBuilder.builder(new PluginsContextBuilder()); URI base = URI.create("postgresql://localhost:5432/test?user=postgres&password=geo123"); ProgressListener listener = new GeogigCLI(new Console()).getProgressListener(); new PGDatabaseUpgrade().setBaseURI(base).setProgressListener(listener).call(); System.err.println("done in " + sw.stop()); } }
@RequiresRepository(true) @Parameters(commandNames = { "drop" }, commandDescription = "Remove an index from the repository.") public class DropIndex extends AbstractCommand implements CLICommand {
@RequiresRepository(false) @Parameters(commandNames = "describe", commandDescription = "Describe a shapefile schema") public class ShpDescribe extends AbstractShpCommand implements CLICommand {
@RequiresRepository(false) @Parameters(commandNames = "describe", commandDescription = "Describe a shapefile schema") public class ShpDescribe extends AbstractShpCommand implements CLICommand {
@RequiresRepository(true) @Parameters(commandNames = { "drop" }, commandDescription = "Remove an index from the repository.") public class DropIndex extends AbstractCommand implements CLICommand {
@RequiresRepository(true) @Parameters(commandNames = { "rebuild" }, commandDescription = "Rebuild the index trees of an index for the whole history of the repository.")
@RequiresRepository(false) @Parameters(commandNames = "describe", commandDescription = "Describe a shapefile schema") public class ShpDescribe extends AbstractShpCommand implements CLICommand {
@RequiresRepository(true) @Parameters(commandNames = { "rebuild" }, commandDescription = "Rebuild the index trees of an index for the whole history of the repository.")
@RequiresRepository(true) @Parameters(commandNames = { "create" }, commandDescription = "Creates a spatial index for the specified feature tree")
@RequiresRepository(true) @Parameters(commandNames = { "update" }, commandDescription = "Update the extra attributes of an index.")
@RequiresRepository(true) @Parameters(commandNames = { "update" }, commandDescription = "Update the extra attributes of an index.")
@RequiresRepository(true) @Parameters(commandNames = "pull", commandDescription = "Import changes from a Geopackage audit log created with geopkg push") public class GeopkgPull extends AbstractCommand {
@RequiresRepository(true) @Parameters(commandNames = "pull", commandDescription = "Import changes from a Geopackage audit log created with geopkg push") public class GeopkgPull extends AbstractCommand {
@RequiresRepository(true) @Parameters(commandNames = "pull", commandDescription = "Import changes from a Geopackage audit log created with geopkg push") public class GeopkgPull extends AbstractCommand {
@RequiresRepository(false) @Parameters(commandNames = { "--help", "help" }, commandDescription = "Print this help message, or provide a command name to get help for") public class Help implements CLICommand {
@RequiresRepository(false) @Parameters(commandNames = { "--help", "help" }, commandDescription = "Print this help message, or provide a command name to get help for") public class Help implements CLICommand {
@RequiresRepository(false) @Parameters(commandNames = { "--help", "help" }, commandDescription = "Print this help message, or provide a command name to get help for") public class Help implements CLICommand {