@Override public XmlChangeReader getData(long sequence) { File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz"); return new XmlChangeReader(changeFile, false, CompressionMethod.GZip); }
@Override public XmlChangeReader getData(long sequence) { File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz"); return new XmlChangeReader(changeFile, false, CompressionMethod.GZip); }
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()); } } }
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()); } } }
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(); }
changeReader = new XmlChangeReader( tmpFile, true,
changeReader = new XmlChangeReader( tmpFile, true,
/** * {@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()); } }
/** * {@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()); } }
/** * 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(); }
timeoutUnit); XmlChangeReader reader = new XmlChangeReader(file, true, resolveCompressionMethod(file));
/** * 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); }
/** * 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); }