org.openstreetmap.osmosis.core.pgsql.v0_6.impl
Class EntityTableReader<T extends Entity>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.pgsql.common.BaseTableReader<T>
      extended by org.openstreetmap.osmosis.core.pgsql.v0_6.impl.EntityTableReader<T>
Type Parameters:
T - The entity type to be supported.
All Implemented Interfaces:
java.util.Iterator<T>, Releasable, ReleasableIterator<T>

public class EntityTableReader<T extends Entity>
extends BaseTableReader<T>

Reads entities from a database ordered by their identifier. These entities won't be populated with tags.

Author:
Brett Henderson

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openstreetmap.osmosis.core.pgsql.common.BaseTableReader
BaseTableReader.ReadResult<T>
 
Constructor Summary
EntityTableReader(DatabaseContext dbCtx, EntityMapper<T> entityBuilder)
          Creates a new instance.
EntityTableReader(DatabaseContext dbCtx, EntityMapper<T> entityBuilder, java.lang.String constraintTable)
          Creates a new instance with a constrained search.
 
Method Summary
protected  BaseTableReader.ReadResult<T> createNextValue(java.sql.ResultSet resultSet)
          Builds an entity object from the current recordset row.
protected  java.sql.ResultSet createResultSet(DatabaseContext queryDbCtx)
          Builds the result set that the reader will iterate over.
 
Methods inherited from class org.openstreetmap.osmosis.core.pgsql.common.BaseTableReader
createLastValue, hasNext, next, release, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityTableReader

public EntityTableReader(DatabaseContext dbCtx,
                         EntityMapper<T> entityBuilder)
Creates a new instance.

Parameters:
dbCtx - The active connection to use for reading from the database.
entityBuilder - The entity builder implementation to utilise.

EntityTableReader

public EntityTableReader(DatabaseContext dbCtx,
                         EntityMapper<T> entityBuilder,
                         java.lang.String constraintTable)
Creates a new instance with a constrained search.

Parameters:
dbCtx - The active connection to use for reading from the database.
entityBuilder - The entity builder implementation to utilise.
constraintTable - The table containing a column named id defining the list of entities to be returned.
Method Detail

createResultSet

protected java.sql.ResultSet createResultSet(DatabaseContext queryDbCtx)
Builds the result set that the reader will iterate over.

Specified by:
createResultSet in class BaseTableReader<T extends Entity>
Parameters:
queryDbCtx - The database context to query against.
Returns:
A result set positioned before the first record.

createNextValue

protected BaseTableReader.ReadResult<T> createNextValue(java.sql.ResultSet resultSet)
Builds an entity object from the current recordset row.

Specified by:
createNextValue in class BaseTableReader<T extends Entity>
Parameters:
resultSet - The record set to retrieve the data from.
Returns:
The result of the read.