gpt4 book ai didi

org.openstreetmap.osmosis.xml.v0_6.XmlChangeReader类的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 04:35:05 34 4
gpt4 key购买 nike

本文整理了Java中org.openstreetmap.osmosis.xml.v0_6.XmlChangeReader类的一些代码示例,展示了XmlChangeReader类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlChangeReader类的具体详情如下:
包路径:org.openstreetmap.osmosis.xml.v0_6.XmlChangeReader
类名称:XmlChangeReader

XmlChangeReader介绍

[英]A change source reading from an xml file. The entire contents of the file are read.
[中]从xml文件读取的更改源。将读取文件的全部内容。

代码示例

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

@Override
public XmlChangeReader getData(long sequence) {
  File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz");
  return new XmlChangeReader(changeFile, false, CompressionMethod.GZip);
}

代码示例来源:origin: openstreetmap/osmosis

private void writeChangeset(XmlChangeReader xmlReader) {
  final ChangeSink localChangeSink = changeSink;
  xmlReader.setChangeSink(new ChangeSink() {
    private ChangeSink suppressedWriter = localChangeSink;
    @Override
    public void initialize(Map<String, Object> metaData) {
      // Suppress the call.
    }
    @Override
    public void process(ChangeContainer change) {
      suppressedWriter.process(change);
    }
    @Override
    public void complete() {
      // Suppress the call.
    }
    @Override
    public void close() {
      // Suppress the call.
    }
  });
  xmlReader.run();
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * Tests non-acceptance of nodes in a non-delete change with lat/lon attribute not set.
 * 
 * @throws Exception if something goes wrong.
 */
@Test(expected = OsmosisRuntimeException.class)
public void testNonDeleteLatLonNotSet() throws Exception {
  File inputFile = dataUtils.createDataFile("v0_6/xml-create-no-coordinates.osc");
  XmlChangeReader reader = new XmlChangeReader(inputFile, false, CompressionMethod.None);
  reader.setChangeSink(new NullChangeWriter());
  reader.run();
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

changeReader = new XmlChangeReader(
  tmpFile,
  true,
  changeReader.setChangeSink(changeMerger.getChangeSink(1));

代码示例来源:origin: openstreetmap/osmosis

/**
 * Tests acceptance of nodes in a delete change with lat/lon attribute not set.
 * 
 * @throws Exception if something goes wrong.
 */
@Test
public void testDeleteLatLonNotSet() throws Exception {
  XmlChangeReader xmlReader;
  XmlChangeWriter xmlWriter;
  File inputFile;
  File outputFile;
  
  inputFile = dataUtils.createDataFile("v0_6/xml-delete-no-coordinates.osc");
  outputFile = dataUtils.newFile();
  
  // Create and connect the xml tasks.
  xmlReader = new XmlChangeReader(inputFile, true, CompressionMethod.None);
  xmlWriter = new XmlChangeWriter(outputFile, CompressionMethod.None);
  xmlReader.setChangeSink(xmlWriter);
  
  // Process the xml.
  xmlReader.run();
  
  // Validate that the output file matches the input file.
  dataUtils.compareFiles(inputFile, outputFile);
}

代码示例来源:origin: openstreetmap/osmosis

changeReader = new XmlChangeReader(
  tmpFile,
  true,
  changeReader.setChangeSink(changeMerger.getChangeSink(1));

代码示例来源:origin: openstreetmap/osmosis

/**
 * A basic test reading and writing an osm file testing both reader and
 * writer tasks.
 * 
 * @throws IOException
 *             if any file operations fail.
 */
@Test
public void testSimple() throws IOException {
  XmlChangeReader xmlReader;
  XmlChangeWriter xmlWriter;
  File inputFile;
  File outputFile;
  
  inputFile = dataUtils.createDataFile("v0_6/xml-task-tests-v0_6.osc");
  outputFile = dataUtils.newFile();
  
  // Create and connect the xml tasks.
  xmlReader = new XmlChangeReader(inputFile, true, CompressionMethod.None);
  xmlWriter = new XmlChangeWriter(outputFile, CompressionMethod.None);
  xmlReader.setChangeSink(xmlWriter);
  
  // Process the xml.
  xmlReader.run();
  
  // Validate that the output file matches the input file.
  dataUtils.compareFiles(inputFile, outputFile);
}

代码示例来源:origin: org.locationtech.geogig/geogig-osm

timeoutUnit);
XmlChangeReader reader = new XmlChangeReader(file, true, resolveCompressionMethod(file));
reader.setChangeSink(sink);

代码示例来源:origin: openstreetmap/osmosis

@Override
public XmlChangeReader getData(long sequence) {
  File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz");
  return new XmlChangeReader(changeFile, false, CompressionMethod.GZip);
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * {@inheritDoc}
 */
@Override
protected void processChangeset(XmlChangeReader xmlReader, ReplicationState replicationState) {
  final ChangeSink localChangeSink = changeSorter;
  
  xmlReader.setChangeSink(new ChangeSink() {
    private ChangeSink suppressedChangeSink = localChangeSink;
    @Override
    public void initialize(Map<String, Object> metaData) {
      // Suppress the call.
    }
    @Override
    public void process(ChangeContainer change) {
      suppressedChangeSink.process(change);
    }
    @Override
    public void complete() {
      // Suppress the call.
    }
    @Override
    public void close() {
      // Suppress the call.
    } });
  
  xmlReader.run();
}

代码示例来源:origin: openstreetmap/osmosis

private void processReplicationFile(File replicationFile, ReplicationState replicationState) {
  try {
    XmlChangeReader xmlReader;
    
    // Send the contents of the replication file to the sink but suppress the complete
    // and release methods.
    xmlReader = new XmlChangeReader(replicationFile, true, CompressionMethod.GZip);
    
    // Delegate to the sub-class to process the xml.
    processChangeset(xmlReader, replicationState);
    
  } finally {
    if (!replicationFile.delete()) {
      LOG.warning("Unable to delete file " + replicationFile.getName());
    }
  }
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

private void writeChangeset(XmlChangeReader xmlReader) {
  final ChangeSink localChangeSink = changeSink;
  xmlReader.setChangeSink(new ChangeSink() {
    private ChangeSink suppressedWriter = localChangeSink;
    @Override
    public void initialize(Map<String, Object> metaData) {
      // Suppress the call.
    }
    @Override
    public void process(ChangeContainer change) {
      suppressedWriter.process(change);
    }
    @Override
    public void complete() {
      // Suppress the call.
    }
    @Override
    public void close() {
      // Suppress the call.
    }
  });
  xmlReader.run();
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

private void processReplicationFile(File replicationFile, ReplicationState replicationState) {
  try {
    XmlChangeReader xmlReader;
    
    // Send the contents of the replication file to the sink but suppress the complete
    // and release methods.
    xmlReader = new XmlChangeReader(replicationFile, true, CompressionMethod.GZip);
    
    // Delegate to the sub-class to process the xml.
    processChangeset(xmlReader, replicationState);
    
  } finally {
    if (!replicationFile.delete()) {
      LOG.warning("Unable to delete file " + replicationFile.getName());
    }
  }
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

/**
 * {@inheritDoc}
 */
@Override
protected void processChangeset(XmlChangeReader xmlReader, ReplicationState replicationState) {
  final ChangeSink localChangeSink = changeSorter;
  
  xmlReader.setChangeSink(new ChangeSink() {
    private ChangeSink suppressedChangeSink = localChangeSink;
    @Override
    public void initialize(Map<String, Object> metaData) {
      // Suppress the call.
    }
    @Override
    public void process(ChangeContainer change) {
      suppressedChangeSink.process(change);
    }
    @Override
    public void complete() {
      // Suppress the call.
    }
    @Override
    public void close() {
      // Suppress the call.
    } });
  
  xmlReader.run();
}

代码示例来源:origin: openstreetmap/osmosis

private void sendReplicationData(File chunkFile) {
  // Release all class level resources and prepare for passing the
  // replication data downstream.
  replicationState = null;
  replicationStateReceived = false;
  sinkInitInvoked = false;
  
  // Send the replication data downstream but don't call any lifecycle
  // methods on the change sink because we're managing those separately.
  if (chunkFile != null) {
    RunnableChangeSource changeReader = new XmlChangeReader(chunkFile, true, CompressionMethod.GZip);
    changeReader.setChangeSink(noLifecycleChangeSink);
    changeReader.run();
  }
  
  changeSink.complete();
}

代码示例来源:origin: openstreetmap/osmosis

/**
   * {@inheritDoc}
   */
  @Override
  protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    String fileName;
    File file;
    boolean enableDateParsing;
    CompressionMethod compressionMethod;
    XmlChangeReader task;
    
    // Get the task arguments.
    fileName = getStringArgument(
      taskConfig,
      ARG_FILE_NAME,
      getDefaultStringArgument(taskConfig, DEFAULT_FILE_NAME)
    );
    enableDateParsing = getBooleanArgument(taskConfig, ARG_ENABLE_DATE_PARSING, DEFAULT_ENABLE_DATE_PARSING);
    compressionMethod = getCompressionMethodArgument(taskConfig, fileName);
    
    // Create a file object from the file name provided.
    file = new File(fileName);
    
    // Build the task object.
    task = new XmlChangeReader(file, enableDateParsing, compressionMethod);
    
    return new RunnableChangeSourceManager(taskConfig.getId(), task, taskConfig.getPipeArgs());
  }
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

/**
   * {@inheritDoc}
   */
  @Override
  protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    String fileName;
    File file;
    boolean enableDateParsing;
    CompressionMethod compressionMethod;
    XmlChangeReader task;
    
    // Get the task arguments.
    fileName = getStringArgument(
      taskConfig,
      ARG_FILE_NAME,
      getDefaultStringArgument(taskConfig, DEFAULT_FILE_NAME)
    );
    enableDateParsing = getBooleanArgument(taskConfig, ARG_ENABLE_DATE_PARSING, DEFAULT_ENABLE_DATE_PARSING);
    compressionMethod = getCompressionMethodArgument(taskConfig, fileName);
    
    // Create a file object from the file name provided.
    file = new File(fileName);
    
    // Build the task object.
    task = new XmlChangeReader(file, enableDateParsing, compressionMethod);
    
    return new RunnableChangeSourceManager(taskConfig.getId(), task, taskConfig.getPipeArgs());
  }
}

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com