Package org.openstreetmap.osmosis.extract.apidb.common

Examples of org.openstreetmap.osmosis.extract.apidb.common.Configuration


   * Tests getting the current time from the database.
   */
  @Test
  public void testGetTime() {
    File authFile;
    Configuration config;
    DatabaseTimeLoader timeLoader;
    Date systemTime;
    Date databaseTime;
    long difference;
   
    authFile = dbUtils.getAuthorizationFile();
    config = new Configuration(authFile);
    timeLoader = new DatabaseTimeLoader(config.getDatabaseLoginCredentials());
   
    databaseTime = timeLoader.getDatabaseTime();
    systemTime = new Date();
    difference = databaseTime.getTime() - systemTime.getTime();
   
View Full Code Here


   * Creates a configuration object.
   *
   * @return The configuration.
   */
  private Configuration getConfiguration() {
    return new Configuration(CONFIG_FILE);
  }
View Full Code Here

  /**
   * Provides information about the state of the current working directory.
   */
  private void infoCommand() {
    Configuration configuration;
    TimestampTracker timestampTracker;

    configuration = getConfiguration();
    timestampTracker = getTimestampTracker();

    System.out.println("Configuration");
    System.out.println("\thost: " + configuration.getHost());
    System.out.println("\tdatabase: " + configuration.getDatabase());
    System.out.println("\tuser: " + configuration.getUser());
    System.out.println("\tpassword: " + configuration.getPassword());
    System.out.println("\tdb: " + configuration.getDbType());
    System.out.println("\tintervalLength: " + configuration.getIntervalLength());
    System.out.println("\tlagLength: " + configuration.getLagLength());
    System.out.println("\tchangeSetBeginFormat: " + configuration.getChangeFileBeginFormat());
    System.out.println("\tchangeSetEndFormat: " + configuration.getChangeFileEndFormat());
    System.out.println();
    System.out.println("Data");
    System.out.println("\tCurrent Timestamp: " + timestampTracker.getTime());
  }
View Full Code Here

  /**
   * Performs the extraction process.
   */
  private void extractCommand() {
    Configuration configuration;
    DatabaseTimeLoader timeLoader;
    boolean fullHistory;
    TimestampTracker timestampTracker;
    TimestampTracker dataTimestampSetter;
    long extractTime;
    long maximumExtractTime;
    long nextExtractTime;

    configuration = getConfiguration();
    timeLoader = new DatabaseTimeLoader(configuration.getDatabaseLoginCredentials());
    fullHistory = configuration.getReadFullHistory();
    timestampTracker = getTimestampTracker();
    dataTimestampSetter = getDataTimestampSetter();

    // Determine the last extraction time.
    extractTime = timestampTracker.getTime().getTime();

    while (true) {
      Date intervalBegin;
      Date intervalEnd;
      IntervalExtractor extractor;

      nextExtractTime = extractTime + configuration.getIntervalLength();

      // Determine the maximum extraction time. It is the current time minus the lag length.
      maximumExtractTime = timeLoader.getDatabaseTime().getTime() - configuration.getLagLength();

      // Stop when the maximum extraction time is passed.
      if (nextExtractTime > maximumExtractTime) {
        break;
      }
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.extract.apidb.common.Configuration

Copyright © 2018 www.massapicom. 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.