org.openstreetmap.osmosis.core.tee.v0_6
Class ChangeTee

java.lang.Object
  extended by org.openstreetmap.osmosis.core.tee.v0_6.ChangeTee
All Implemented Interfaces:
Completable, Releasable, Task, ChangeSink, ChangeSinkMultiChangeSource, MultiChangeSource

public class ChangeTee
extends java.lang.Object
implements ChangeSinkMultiChangeSource

Sends input change data to two output destinations.

Author:
Brett Henderson

Constructor Summary
ChangeTee(int outputCount)
          Creates a new instance.
 
Method Summary
 void complete()
          Ensures that all information is fully persisted.
 ChangeSource getChangeSource(int index)
          Retrieves a specific change source that can then have a change sink attached.
 int getChangeSourceCount()
          Indicates the number of change sources that the task provides.
 void process(ChangeContainer change)
          Process the change.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeTee

public ChangeTee(int outputCount)
Creates a new instance.

Parameters:
outputCount - The number of output destinations to write to.
Method Detail

getChangeSource

public ChangeSource getChangeSource(int index)
Retrieves a specific change source that can then have a change sink attached.

Specified by:
getChangeSource in interface MultiChangeSource
Parameters:
index - The index of the change source to retrieve.
Returns:
The requested index.

getChangeSourceCount

public int getChangeSourceCount()
Indicates the number of change sources that the task provides.

Specified by:
getChangeSourceCount in interface MultiChangeSource
Returns:
The number of change sources.

process

public void process(ChangeContainer change)
Process the change.

Specified by:
process in interface ChangeSink
Parameters:
change - The change to be processed.

complete

public void complete()
Ensures that all information is fully persisted. This includes database commits, file buffer flushes, etc. Implementations must call complete on any nested Completable objects. Where the releasable method of a Releasable class should be called within a finally block, this method should typically be the final statement within the try block.

Specified by:
complete in interface Completable

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable