org.akubraproject.txn
Class SQLTransactionalConnection.RSBlobIdIterator

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<URI>
          extended by org.akubraproject.txn.SQLTransactionalConnection.RSBlobIdIterator
All Implemented Interfaces:
com.google.common.collect.PeekingIterator<URI>, Iterator<URI>
Enclosing class:
SQLTransactionalConnection

protected static class SQLTransactionalConnection.RSBlobIdIterator
extends com.google.common.collect.AbstractIterator<URI>
implements com.google.common.collect.PeekingIterator<URI>

A ResultSet based Iterator of blob-id's. Useful for listBlobIds.

Author:
Ronald Tschalär

Field Summary
protected  ResultSet rs
           
 
Constructor Summary
SQLTransactionalConnection.RSBlobIdIterator(ResultSet rs, boolean closeStmt)
          Create a new iterator.
 
Method Summary
protected  void close()
          Close the underlying result-set and statement (if closeStmt is true).
protected  URI computeNext()
           
protected  URI getNextId()
          Get the next id.
 
Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.collect.PeekingIterator
next, peek, remove
 
Methods inherited from interface java.util.Iterator
hasNext
 

Field Detail

rs

protected final ResultSet rs
Constructor Detail

SQLTransactionalConnection.RSBlobIdIterator

public SQLTransactionalConnection.RSBlobIdIterator(ResultSet rs,
                                                   boolean closeStmt)
                                            throws SQLException
Create a new iterator.

Parameters:
rs - the underlying result-set to use; the result-set must either have at least one column such that rs.getString(1) returns a URI, or you must override getNextId().
closeStmt - whether to close the associated statement when closing the result-set at the end of the iteration.
Throws:
SQLException - if thrown while attempting to advance to the first row
Method Detail

computeNext

protected URI computeNext()
Specified by:
computeNext in class com.google.common.collect.AbstractIterator<URI>

getNextId

protected URI getNextId()
                 throws SQLException
Get the next id.

Returns:
the next id, or null if there are none left
Throws:
SQLException

close

protected void close()
Close the underlying result-set and statement (if closeStmt is true).



Copyright © 2009-2012 DuraSpace. All Rights Reserved.