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

java.lang.Object
  extended by com.softwareag.tamino.db.api.response.TAbstractResponse
      extended by com.softwareag.tamino.db.api.response.TResponseHandleImpl
All Implemented Interfaces:
TResponse, TResponseContent, TResponseHandle

public class TResponseHandleImpl
extends TAbstractResponse

TResponseBody is the implementation of the �protected� TResponseHandle. It implements all operations needed to represent a high level Tamino response object. This comprises the access to general response message information, the result state and for query operations the access to the result set iterator. The result state encapsulates the entire set of information that is contained within a Tamino XML response document except for the querried XML documents. These can be accessed by the result set iterator which provides a way to automatically iterate over the querried set of XML documents.

Version:
$Revision: 1.6 $
Author:
Marcus Schreyer

Constructor Summary
TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter)
           
TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter, TNonXMLObjectIterator nonXMLObjectIterator)
           
TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter, TXMLObjectIterator xmlObjectIterator)
           
 
Method Summary
 TNonXMLObject getFirstNonXMLObject()
          Gets the first non xml object given for the non xml object iterator.
 TXMLObject getFirstXMLObject()
          Gets the first xml object given for the xml object iterator.
 TResponseInfoContent getInfoContent()
          Gets the result state.
 java.lang.String getMessageCode()
          Gets the code attribute for the first message block with a return value not equals 0 or the empty string.
 java.lang.String getMessageLine()
          Gets the first message line for the first message block with a return value not equals 0 or the message line of the last message block.
 java.lang.String getMessageText()
          Gets the message text for the first message block with a return value not equals 0 or the empty string.
 TNonXMLObjectIterator getNonXMLObjectIterator()
          Gets the non XML object iterator.
 java.lang.String getQueryContentAsString()
          Gets the content for a query related response as a String.
 java.lang.String getReturnValue()
          Gets the return value the first message block with a return value not equals 0 or the return value of the last message block which then would be 0.
 java.util.Iterator getWarnings()
          Gets an iterator for the list of TWarning instances containing the Tamino warnings.
 TXMLObjectIterator getXMLObjectIterator()
          Gets the XML object iterator.
 boolean hasFirstNonXMLObject()
          Indicates if the response provides a first TNonXMLObject instance.
 boolean hasFirstXMLObject()
          Indicates if the response provides a first TXMLObject instance.
 boolean hasQueryContent()
          Indicates if the response provides content that is referred to a previously invoked query.
 boolean hasWarnings()
          Indicates if the response of Tamino contained any warning information.
 java.lang.String toString()
          Shows a text representation of the response.
 
Methods inherited from class com.softwareag.tamino.db.api.response.TAbstractResponse
getLocale, getQueryContentAsStream, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TResponseHandleImpl

public TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter)
                    throws TResponseBuildException
Throws:
TResponseBuildException

TResponseHandleImpl

public TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter,
                           TXMLObjectIterator xmlObjectIterator)
                    throws TResponseBuildException
Throws:
TResponseBuildException

TResponseHandleImpl

public TResponseHandleImpl(TInputStreamInterpreter inputStreamInterpreter,
                           TNonXMLObjectIterator nonXMLObjectIterator)
                    throws TResponseBuildException
Throws:
TResponseBuildException
Method Detail

getReturnValue

public java.lang.String getReturnValue()
Gets the return value the first message block with a return value not equals 0 or the return value of the last message block which then would be 0.

Specified by:
getReturnValue in interface TResponse
Overrides:
getReturnValue in class TAbstractResponse
Returns:
The Tamino return code.

getMessageLine

public java.lang.String getMessageLine()
Gets the first message line for the first message block with a return value not equals 0 or the message line of the last message block.

Specified by:
getMessageLine in interface TResponseHandle
Overrides:
getMessageLine in class TAbstractResponse

getMessageText

public java.lang.String getMessageText()
Gets the message text for the first message block with a return value not equals 0 or the empty string.

Specified by:
getMessageText in interface TResponseHandle
Overrides:
getMessageText in class TAbstractResponse

getMessageCode

public java.lang.String getMessageCode()
Gets the code attribute for the first message block with a return value not equals 0 or the empty string.

Specified by:
getMessageCode in interface TResponseHandle
Overrides:
getMessageCode in class TAbstractResponse

getInfoContent

public TResponseInfoContent getInfoContent()
Gets the result state.

Specified by:
getInfoContent in interface TResponseHandle
Overrides:
getInfoContent in class TAbstractResponse
Returns:
The result state.

getXMLObjectIterator

public TXMLObjectIterator getXMLObjectIterator()
Gets the XML object iterator.

Specified by:
getXMLObjectIterator in interface TResponse
Overrides:
getXMLObjectIterator in class TAbstractResponse
Returns:
The TXMLObjectIterator instance. This is only available if this response relates to a query response. Otherwise null is handed back.

getFirstXMLObject

public TXMLObject getFirstXMLObject()
Gets the first xml object given for the xml object iterator.

Specified by:
getFirstXMLObject in interface TResponse
Overrides:
getFirstXMLObject in class TAbstractResponse
Returns:
the first TXMLObject if given, null otherwise.

hasFirstXMLObject

public boolean hasFirstXMLObject()
Indicates if the response provides a first TXMLObject instance. Should be used to check whether the response provides XML documents.

Specified by:
hasFirstXMLObject in interface TResponse
Overrides:
hasFirstXMLObject in class TAbstractResponse
Returns:
true if the response contains at least one TXMLObject that can be accessed, false otherwise.

getNonXMLObjectIterator

public TNonXMLObjectIterator getNonXMLObjectIterator()
Gets the non XML object iterator.

Specified by:
getNonXMLObjectIterator in interface TResponse
Overrides:
getNonXMLObjectIterator in class TAbstractResponse
Returns:
The TNonXMLObjectIterator instance. This is only available if this response relates to a query response. Otherwise null is handed back.

getFirstNonXMLObject

public TNonXMLObject getFirstNonXMLObject()
Gets the first non xml object given for the non xml object iterator.

Specified by:
getFirstNonXMLObject in interface TResponse
Overrides:
getFirstNonXMLObject in class TAbstractResponse
Returns:
the first TNonXMLObject if given, null otherwise.

hasFirstNonXMLObject

public boolean hasFirstNonXMLObject()
Indicates if the response provides a first TNonXMLObject instance. Should be used to check whether the response provides Non-XML documents.

Specified by:
hasFirstNonXMLObject in interface TResponse
Overrides:
hasFirstNonXMLObject in class TAbstractResponse
Returns:
true if the response contains at least one TNonXMLObject that can be accessed, false otherwise.

hasQueryContent

public boolean hasQueryContent()
Indicates if the response provides content that is referred to a previously invoked query. Always returns true if the underlying response document contains a xql:result subtree with valuable content.

Specified by:
hasQueryContent in interface TResponse
Overrides:
hasQueryContent in class TAbstractResponse
Returns:
true if the underlying response document contains a xql:result subtree with valuable content, false otherwise.

hasWarnings

public boolean hasWarnings()
Indicates if the response of Tamino contained any warning information.

Specified by:
hasWarnings in interface TResponse
Overrides:
hasWarnings in class TAbstractResponse
Returns:
true if the response of Tamino contained any warning information, false otherwise.

getWarnings

public java.util.Iterator getWarnings()
Gets an iterator for the list of TWarning instances containing the Tamino warnings.

Specified by:
getWarnings in interface TResponse
Overrides:
getWarnings in class TAbstractResponse
Returns:
an iterator over the TWarning instances.

toString

public java.lang.String toString()
Shows a text representation of the response.

Overrides:
toString in class TAbstractResponse

getQueryContentAsString

public java.lang.String getQueryContentAsString()
Gets the content for a query related response as a String. Here only the content that is delivered under the xql:result tag is provided. If this is given as a result set of XML documents these are serialzed into the resulting string only with their root elements but without deeper content. The result for a xpath function call such as count(xpath) is delivered as a pure string.

Specified by:
getQueryContentAsString in interface TResponse
Overrides:
getQueryContentAsString in class TAbstractResponse
Returns:
the String that reflects the text content given for a xql:result element within a Tamino response document. If none is given because the response is not related to a query operation an empty string is provided.


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