Examples of ApidbChangeReader


Examples of org.openstreetmap.osmosis.apidb.v0_6.ApidbChangeReader

  /**
   * Runs the changeset extraction.
   */
  public void run() {
    ApidbChangeReader reader;
    XmlChangeWriter writer;
    ChangeTagSorter tagSorter;
    String fileName;
    File tmpFile;
    File file;

    // Generate the changeset file name.
    fileName = new ChangesetFileNameFormatter(config.getChangeFileBeginFormat(), config.getChangeFileEndFormat())
        .generateFileName(intervalBegin, intervalEnd);

    // Generate the temporary output file.
    tmpFile = new File(baseDirectory, TMP_FILE_NAME);

    // Generate the changeset output file.
    file = new File(baseDirectory, fileName);

    // Create the output task to write to a compressed xml file.
    writer = new XmlChangeWriter(tmpFile, CompressionMethod.GZip);

    // Create the input task to read the change interval from the database.
    reader = new ApidbChangeReader(config.getDatabaseLoginCredentials(), config.getDatabasePreferences(),
        intervalBegin, intervalEnd, fullHistory);
   
    // Create the tag sorter to ensure that output files are consistent allowing simple
    // comparisons when auditing results.
    tagSorter = new ChangeTagSorter();

    // Connect the tasks together.
    reader.setChangeSink(tagSorter);
    tagSorter.setChangeSink(writer);

    // Run the changeset extraction.
    reader.run();

    // Delete the destination file if it already exists.
    if (file.exists()) {
      if (!file.delete()) {
        throw new OsmosisRuntimeException("Unable to delete existing file " + file + ".");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.