Examples of RunnableSource


Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

    }
  };
 
  public OsmosisReader(File file) throws IOException {
   
    RunnableSource reader = createReaderForFile(file);
   
    reader.setSink(sinkImplementation);
   
    Thread readerThread = new Thread(reader);
    readerThread.start();
   
    while (readerThread.isAlive()) {
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

      compression = CompressionMethod.GZip;
    } else if (file.getName().endsWith(".bz2")) {
      compression = CompressionMethod.BZip2;
    }
   
    RunnableSource reader;
   
    if (pbf) {
      reader = new crosby.binary.osmosis.OsmosisReader(
          new FileInputStream(file));
    } else {
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

        } else {
            pbf = file.getName().endsWith(".pbf");
            compression = resolveCompressionMethod(file);
        }

        RunnableSource reader;
        if (pbf) {
            reader = new OsmosisReader(dataIn);
        } else {
            reader = new org.locationtech.geogig.osm.internal.XmlReader(dataIn, true, compression);
        }

        final WorkingTree workTree = workingTree();
        if (!add) {
            workTree.delete(OSMUtils.NODE_TYPE_NAME);
            workTree.delete(OSMUtils.WAY_TYPE_NAME);
        }

        final int queueCapacity = 100 * 1000;
        final int timeout = 1;
        final TimeUnit timeoutUnit = TimeUnit.SECONDS;
        // With this iterator and the osm parsing happening on a separate thread, we follow a
        // producer/consumer approach so that the osm parse thread produces featrures into the
        // iterator's queue, and WorkingTree.insert consumes them on this thread
        QueueIterator<Feature> iterator = new QueueIterator<Feature>(queueCapacity, timeout,
                timeoutUnit);

        ProgressListener progressListener = getProgressListener();
        ConvertAndImportSink sink = new ConvertAndImportSink(converter, iterator, platform(),
                mapping, noRaw, new SubProgressListener(progressListener, 100));
        reader.setSink(sink);

        Thread readerThread = new Thread(reader, "osm-import-reader-thread");
        readerThread.start();

        Function<Feature, String> parentTreePathResolver = new Function<Feature, String>() {
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

    // change contains deletes which have a current timestamp
    // that cannot be reliably predicted.
    // Therefore, check all relevant attributes manually.
   
    ChangeDeriver deriver = new ChangeDeriver(1);
    RunnableSource left = new XmlReader(dataUtils.createDataFile(
        "v0_6/derive_change/simple.osm"), true, CompressionMethod.None);
    RunnableSource right = new EmptyReader();
   
    SinkChangeInspector result = RunTaskUtilities.run(deriver, left, right);
    List<ChangeContainer> changes = result.getProcessedChanges();
   
    Assert.assertEquals(3, changes.size());
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testNeitherHasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), false);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), false);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testSource0HasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), true);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), false);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testSource1HasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), false);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), true);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   * @throws Exception if something goes wrong
   */
  @Test
  public void testBothHaveBounds() throws Exception {
    Bound bound0 = new Bound(1, 2, 4, 3, "source1");
    RunnableSource source0 = new BoundSource(bound0, true);

    Bound bound1 = new Bound(5, 6, 8, 7, "source2");
    RunnableSource source1 = new BoundSource(bound1, true);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testBothEmpty() throws Exception {
    RunnableSource source0 = new EmptyReader();
    RunnableSource source1 = new EmptyReader();

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

Examples of org.openstreetmap.osmosis.core.task.v0_6.RunnableSource

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testOneSourceEmpty() throws Exception {
    RunnableSource source0 = new EmptyReader();

    Bound bound1 = new Bound(5, 6, 8, 7, "source2");
    RunnableSource source1 = new BoundSource(bound1, true);
   
    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
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.