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

java.lang.Object
  extended by org.openstreetmap.osmosis.core.tee.v0_6.EntityTee
All Implemented Interfaces:
Completable, Releasable, Task, MultiSource, Sink, SinkMultiSource

public class EntityTee
extends java.lang.Object
implements SinkMultiSource

Sends input data to two output destinations.

Author:
Brett Henderson

Constructor Summary
EntityTee(int outputCount)
          Creates a new instance.
 
Method Summary
 void complete()
          Ensures that all information is fully persisted.
 Source getSource(int index)
          Retrieves a specific source that can then have a sink attached.
 int getSourceCount()
          Indicates the number of sources that the task provides.
 void process(EntityContainer entityContainer)
          Process the entity.
 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

EntityTee

public EntityTee(int outputCount)
Creates a new instance.

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

getSource

public Source getSource(int index)
Retrieves a specific source that can then have a sink attached.

Specified by:
getSource in interface MultiSource
Parameters:
index - The index of the source to retrieve.
Returns:
The requested index.

getSourceCount

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

Specified by:
getSourceCount in interface MultiSource
Returns:
The number of sources.

process

public void process(EntityContainer entityContainer)
Process the entity.

Specified by:
process in interface Sink
Parameters:
entityContainer - The entity 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