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

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

public abstract class TAbstractResponse
extends java.lang.Object
implements TResponseHandle

TAbstractResponse is the basis for response implementations. A complete response implementation needs to overload all methods, a partial implementation needs only to overload the required methods.

Version:
$Revision: 1.5 $
Author:
Stefan Liebig

Constructor Summary
TAbstractResponse()
           
 
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.util.Locale getLocale()
          Gets the locale.
 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.
 TInputStream getQueryContentAsStream()
          Gets the result of a query as a InputStream.
 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.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 java.lang.String toString()
          Shows a text representation of the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TAbstractResponse

public TAbstractResponse()
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
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

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

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

getInfoContent

public TResponseInfoContent getInfoContent()
Gets the result state.

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

getXMLObjectIterator

public TXMLObjectIterator getXMLObjectIterator()
Gets the XML object iterator.

Specified by:
getXMLObjectIterator in interface TResponse
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
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
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
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
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
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
Returns:
true if the underlying response document contains a xql:result subtree with valuable content, false otherwise.

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
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.

getQueryContentAsStream

public TInputStream getQueryContentAsStream()
Gets the result of a query as a InputStream.

Specified by:
getQueryContentAsStream in interface TResponse
Returns:
the result of a query as a Stream, if available. Otherwise, an empty stream is returned.

hasWarnings

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

Specified by:
hasWarnings in interface TResponse
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
Returns:
an iterator over the TWarning instances.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.


getLocale

public java.util.Locale getLocale()
Gets the locale.

Returns:
the locale.

toString

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

Overrides:
toString in class java.lang.Object


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