com.softwareag.tamino.db.api.response
Class TXMLObjectFetchingIterator

java.lang.Object
  extended by com.softwareag.tamino.db.api.response.TXMLObjectIteratorImpl
      extended by com.softwareag.tamino.db.api.response.TXMLObjectFetchingIterator
All Implemented Interfaces:
TXMLObjectIterator
Direct Known Subclasses:
TXMLObjectFetchingIteratorTimeLoggingImpl

public class TXMLObjectFetchingIterator
extends TXMLObjectIteratorImpl

TXMLObjectFetchingIterator is the implementation class for the Tamino cursoring of the TXMLObjectIterator interface.

Version:
$Revision: 1.49 $
Author:
Stefan Liebig

Field Summary
 
Fields inherited from class com.softwareag.tamino.db.api.response.TXMLObjectIteratorImpl
START_AT_BEGIN, START_AT_END
 
Constructor Summary
TXMLObjectFetchingIterator(TInputStreamInterpreter inputStreamInterpreter, TAbstractAccessor abstractAccessor)
          Constructor.
 
Method Summary
 boolean canMoveBy(int offset)
          Indicates if this iterator can be moved by the given offset.
 void close()
          Invalidate this iterator.
 int getCount()
          Gets the query count as an int.
 boolean hasCount()
          Indicates if the response of Tamino contained the query count.
 boolean hasNext()
          Indicates if iterator has next XmlObject instance.
protected  boolean hasNextCursorObject()
          Indicates if iterator has next cursored XmlObject instance within Tamino
 boolean hasPrevious()
          Indicates if this iterator has a previous TXMLObject instance.
protected  boolean hasPreviousCursorObject()
          Indicates if iterator has previous cursored XmlObject instance within Tamino
 void moveBy(int offset)
          Moves the iterator by the given offset.
 TXMLObject next()
          Returns the next element in the list.
 TXMLObject previous()
          Returns the previous TXMLObject in the list.
 void reset()
          Resets the iterator to its initial state as it has been constructed.
 
Methods inherited from class com.softwareag.tamino.db.api.response.TXMLObjectIteratorImpl
getCurrentIndex, getLocale, getResponseQueryContent, initIndex, setCurrentIndex, setLocale, setResponseQueryContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TXMLObjectFetchingIterator

public TXMLObjectFetchingIterator(TInputStreamInterpreter inputStreamInterpreter,
                                  TAbstractAccessor abstractAccessor)
Constructor. The TXMLObjectFetchingIterator performs its tasks by using the specified response interpreter as well as the invocation component.

Parameters:
inputStreamInterpreter - is responsible for the interpreting of low level Tamino results.
abstractAccessor - is needed to invoke generic commands on an underlying Tamino database.
Method Detail

hasNext

public boolean hasNext()
Indicates if iterator has next XmlObject instance.

Specified by:
hasNext in interface TXMLObjectIterator
Overrides:
hasNext in class TXMLObjectIteratorImpl
Returns:
true if next element is given, false otherwise.

hasNextCursorObject

protected boolean hasNextCursorObject()
Indicates if iterator has next cursored XmlObject instance within Tamino

Returns:
true if next object is given, false otherwise.

next

public TXMLObject next()
                throws TNoSuchXMLObjectException,
                       TIteratorException
Returns the next element in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Specified by:
next in interface TXMLObjectIterator
Overrides:
next in class TXMLObjectIteratorImpl
Returns:
The next XmlObject.
Throws:
NoSuchElementException - if iteration has no more elements.
TIteratorException - if iteration failed because of an underlying Tamino problem.
TNoSuchXMLObjectException - the if iteration has no next TXMLObject instance.

hasPrevious

public boolean hasPrevious()
Indicates if this iterator has a previous TXMLObject instance.

Specified by:
hasPrevious in interface TXMLObjectIterator
Overrides:
hasPrevious in class TXMLObjectIteratorImpl
Returns:
true if previous TXMLObject is given, false otherwise.

hasPreviousCursorObject

protected boolean hasPreviousCursorObject()
Indicates if iterator has previous cursored XmlObject instance within Tamino

Returns:
true if previous object is given, false otherwise.

previous

public TXMLObject previous()
                    throws TNoSuchXMLObjectException,
                           TIteratorException
Returns the previous TXMLObject in the list. This method may be called repeatedly to iterate backwards through the list of given TXMLObject instances.

Specified by:
previous in interface TXMLObjectIterator
Overrides:
previous in class TXMLObjectIteratorImpl
Returns:
The previous TXMLObject.
Throws:
NoSuchElementException - if iteration has no more elements.
TIteratorException - if iteration failed because of an underlying Tamino problem.
TNoSuchXMLObjectException - if the iteration has no previous TXMLObject instance.

hasCount

public boolean hasCount()
Indicates if the response of Tamino contained the query count.

Specified by:
hasCount in interface TXMLObjectIterator
Overrides:
hasCount in class TXMLObjectIteratorImpl
Returns:
true if the response of Tamino contained the query count, false otherwise.

getCount

public int getCount()
Gets the query count as an int. The query count is the total number of resulting objects for a query issued against Tamino. This value is independent from the quantity specified in the query method. The query count is only available for queries that have been issued using the query method specifying a quantity (i.e. when the Tamino cursoring mechanism is being used). Furthermore it is not available for xqueries. Tamino only returns a query count in case its calculation does not require the creation of the result set as a whole. In other words, Tamino only returns a query count if it is not expensive to calculate.

Specified by:
getCount in interface TXMLObjectIterator
Overrides:
getCount in class TXMLObjectIteratorImpl
Returns:
the query count as an int, if available. Otherwise, -1 is returned.

canMoveBy

public boolean canMoveBy(int offset)
                  throws TIteratorException
Indicates if this iterator can be moved by the given offset.

Specified by:
canMoveBy in interface TXMLObjectIterator
Overrides:
canMoveBy in class TXMLObjectIteratorImpl
Parameters:
offset - the positive or negative amount to move the iterator
Returns:
true if move is possible, false otherwise.
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.

moveBy

public void moveBy(int offset)
            throws TNoSuchXMLObjectException,
                   TIteratorException
Moves the iterator by the given offset.

Specified by:
moveBy in interface TXMLObjectIterator
Overrides:
moveBy in class TXMLObjectIteratorImpl
Parameters:
offset - the positive or negative amount to move the iterator
Throws:
TNoSuchXMLObjectException - if the new position is out of bounds.
TIteratorException - if iteration failed because of an underlying Tamino problem.

reset

public void reset()
           throws TIteratorException
Resets the iterator to its initial state as it has been constructed.

Specified by:
reset in interface TXMLObjectIterator
Overrides:
reset in class TXMLObjectIteratorImpl
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.

close

public void close()
           throws TIteratorException
Invalidate this iterator. Closing the iterator releases any resources which a iterator may hold. After closing a iterator it is no longer usable.

Specified by:
close in interface TXMLObjectIterator
Overrides:
close in class TXMLObjectIteratorImpl
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.


Copyright (c) 2013 Software AG. All Rights Reserved.