Skip to content

OSHD Bootstrap Application

Rafael Troilo requested to merge application into master

Use OSHDBApplication as a bootstrap class to run oshdb querys. OSHDBApplication use picocli to parse command line parameters and initialize the oshdb context. Cli Arguments can be added via own subclass. Full access to parameters via parent class OSHDApplication see implementation.

@Command(name = "myQuery", version = "0.1", description = "my query")
public class MyApplication extends OSHDBApplication {
  @Option(names = {"--myoption"}, description = "my option")
  private String myOption;

  @Parameters(description = "my parameter")
  private Path myParameter;

   public static void main(String[] args){
     OSHDBApplication.run(MyApplication.class, args);
   }

   protected int run(OSHDBConnection oshdb){
     oshdb.getSnapshotView()
        .areaOfInterest((Geometry & Polygonal) areaOfInterest)
        .timestamps(tstamps)
        .osmTag(key)
        ...
   }
}

All parameters:

Usage: myQuery [-hV] [--multithreading] [--keytables=<keytableUrl>]
               [--myoption=<myOption>] [--oshdb=<oshdbUrl>] [--prefix=<prefix>]
               [--props=<config>] <myParameter>
my query
      <myParameter>        my parameter
  -h, --help               Show this help message and exit.
      --keytables=<keytableUrl>
                           keytablesUrl jdbc:...
      --multithreading     for jdbc based connecitions
      --myoption=<myOption>
                           my option
      --oshdb=<oshdbUrl>   oshdbUrl (ignite:...|h2:...)
      --prefix=<prefix>    prefix to use
      --props=<config>     properties location
  -V, --version            Print version information and exit.
Edited by Rafael Troilo

Merge request reports