org.openstreetmap.osmosis.core.customdb.v0_5.impl
Class DatasetStore

java.lang.Object
  extended by org.openstreetmap.osmosis.core.customdb.v0_5.impl.DatasetStore
All Implemented Interfaces:
Dataset, EntityProcessor, Completable, Releasable, Task, Sink

public class DatasetStore
extends java.lang.Object
implements Sink, EntityProcessor, Dataset

Provides a file based storage mechanism for implementing a dataset.

Author:
Brett Henderson

Constructor Summary
DatasetStore(DatasetStoreFileManager fileManager, boolean enableWayTileIndex)
          Creates a new instance.
 
Method Summary
 void complete()
          Ensures that all information is fully persisted.
 DatasetReader createReader()
          Creates a new reader instance providing access to the data within this set.
 void process(BoundContainer bound)
          Process the bound.
 void process(EntityContainer entityContainer)
          Process the entity.
 void process(NodeContainer nodeContainer)
          Process the node.
 void process(RelationContainer relationContainer)
          Process the relation.
 void process(WayContainer wayContainer)
          Process the way.
protected  void processImpl(EntityContainer entityContainer)
          The entity processing implementation.
 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

DatasetStore

public DatasetStore(DatasetStoreFileManager fileManager,
                    boolean enableWayTileIndex)
Creates a new instance.

Parameters:
fileManager - The manager providing access to store files.
enableWayTileIndex - If true a tile index is created for ways, otherwise a node-way index is used.
Method Detail

process

public void process(EntityContainer entityContainer)
Process the entity.

Specified by:
process in interface Sink
Parameters:
entityContainer - The entity to be processed.

processImpl

protected void processImpl(EntityContainer entityContainer)
The entity processing implementation. This must not be called directly, it is called by the internal sorted pipe validator.

Parameters:
entityContainer - The entity to be processed.

process

public void process(BoundContainer bound)
Process the bound.

Specified by:
process in interface EntityProcessor
Parameters:
bound - The bound to be processed.

process

public void process(NodeContainer nodeContainer)
Process the node.

Specified by:
process in interface EntityProcessor
Parameters:
nodeContainer - The node to be processed.

process

public void process(WayContainer wayContainer)
Process the way.

Specified by:
process in interface EntityProcessor
Parameters:
wayContainer - The way to be processed.

process

public void process(RelationContainer relationContainer)
Process the relation.

Specified by:
process in interface EntityProcessor
Parameters:
relationContainer - The relation 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

createReader

public DatasetReader createReader()
Creates a new reader instance providing access to the data within this set.

Specified by:
createReader in interface Dataset
Returns:
A new dataset reader.

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