Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // This software is released into the Public Domain.  See copying.txt for details.
 package org.openstreetmap.osmosis.replication.v0_6;
 import java.util.Map;
This task allows a replication stream to be converted to a standard change stream. It handles the state persistence required by a replication sink, and then passes the replication data to a standard change sink destination. A typical use case would be receiving a replication stream live from a database, then applying those changes to another database where the change applier task doesn't support the replication metadata extensions.

Brett Henderson
public class ReplicationToChangeWriter implements ChangeSinkChangeSource {

This handles and persists the replication metadata.
Creates a new instance.

workingDirectory The directory containing configuration and tracking files.
	public ReplicationToChangeWriter(File workingDirectory) {
		 = new ReplicationStateWriter(workingDirectory);
	public void setChangeSink(ChangeSink changeSink) {
		this. = changeSink;
	public void initialize(Map<StringObjectmetaData) {
		// Initialise the replication meta data.
		// Get the replication state for this pipeline run.
		// Initialise the downstream tasks passing everything except the
		// replication state.
		if (.getSequenceNumber() > 0) {
			Map<StringObjectdownstreamMetaData = new HashMap<StringObject>(metaData);
	public void process(ChangeContainer change) {
		// Perform replication checks.
		// Pass the change downstream.
	public void complete() {
		// We must complete downstream before we complete the replication writer
		// so that we know the replication data has been committed before we
		// persist replication state.
		if (.getSequenceNumber() > 0) {
	public void release() {
New to GrepCode? Check out our FAQ X