Example #1
0
  /** {@inheritDoc} */
  @Override
  public void process(Dataset dataset) {
    ReleasableIterator<EntityContainer> bboxData;

    if (datasetReader != null) {
      throw new OsmosisRuntimeException("process may only be invoked once.");
    }

    datasetReader = dataset.createReader();

    // Pass all data within the dataset to the sink.
    bboxData = datasetReader.iterate();
    try {
      while (bboxData.hasNext()) {
        sink.process(bboxData.next());
      }

      sink.complete();

    } finally {
      bboxData.release();
    }
  }
Example #2
0
 /** {@inheritDoc} */
 @Override
 public void release() {
   if (datasetReader != null) {
     datasetReader.release();
   }
 }