com.ibm.wbi
Class ServiceResult

java.lang.Object
  |
  +--com.ibm.wbi.ServiceResult
All Implemented Interfaces:
ResponseToRequest

public class ServiceResult
extends java.lang.Object
implements ResponseToRequest

This gets returned by the service calls and transform calls as well as by FetchUrl.fecth(...) --- it encapsulates a Transaction, MegInputStream (to read data from), and a RequestInfo (structured data about this request/response).


Field Summary
protected static com.ibm.wbi.RASTraceLogger tracer
           
 
Constructor Summary
ServiceResult(Transaction t)
          Create a serviceResult object.
 
Method Summary
 MegInputStream getMegInputStream()
          Get the input stream to read the response from.
 MegInputStream getMegInputStream(long timeout)
          Get the input stream to read the response from.
 MegReader getMegReader()
          Get the character stream to read the response from.
 MegReader getMegReader(java.lang.String encoding)
          Get the character stream to read the response from.
 RequestInfo getRequestInfo()
          Gets the RequestInfo.
 RequestInfo getRequestInfo(long timeout)
          Gets the RequestInfo.
 Transaction getTransaction()
          Gets the Transaction object.
 void setMegInputStream(MegInputStream s)
          Sets meg input stream this transaction.
 void setRequestInfo(RequestInfo requestInfo)
          Sets RequestInfo for this transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tracer

protected static com.ibm.wbi.RASTraceLogger tracer
Constructor Detail

ServiceResult

public ServiceResult(Transaction t)
Create a serviceResult object.
Parameters:
t - Transaction object associated with this result.
Method Detail

getMegInputStream

public MegInputStream getMegInputStream()
Get the input stream to read the response from.
Specified by:
getMegInputStream in interface ResponseToRequest
Returns:
The input stream to read the response from.

getMegInputStream

public MegInputStream getMegInputStream(long timeout)
Get the input stream to read the response from.
Parameters:
timeout - a long representing the amount of time to wait to get this stream before returning. If the timeout happens before the stream is available, this returns null.
Returns:
The input stream to read the response from, or null if timeout reached before data is available.

getMegReader

public MegReader getMegReader()
                       throws java.io.UnsupportedEncodingException,
                              com.ibm.wbi.NotCharDataException
Get the character stream to read the response from.
Specified by:
getMegReader in interface ResponseToRequest
Returns:
The character stream (Reader) to read the response from.

getMegReader

public MegReader getMegReader(java.lang.String encoding)
                       throws java.io.UnsupportedEncodingException,
                              com.ibm.wbi.NotCharDataException
Get the character stream to read the response from.
Parameters:
encoding - The encoding to use.
Returns:
The character stream (Reader) to read the response from.

setMegInputStream

public void setMegInputStream(MegInputStream s)
Sets meg input stream this transaction.
Parameters:
s - MegInputStream resulting from this transaction.

setRequestInfo

public void setRequestInfo(RequestInfo requestInfo)
Sets RequestInfo for this transaction.
Parameters:
requestInfo - The RequestInfo for this transaction.

getTransaction

public Transaction getTransaction()
Gets the Transaction object.
Specified by:
getTransaction in interface ResponseToRequest
Returns:
Transaction objects assciated with this result.

getRequestInfo

public RequestInfo getRequestInfo()
Gets the RequestInfo.
Specified by:
getRequestInfo in interface ResponseToRequest
Returns:
RequestInfo associated with this result.

getRequestInfo

public RequestInfo getRequestInfo(long timeout)
Gets the RequestInfo.
Parameters:
timeout - a long representing the amount of time to wait to get this stream before returning. If the timeout happens before the stream is available, this returns null.
Returns:
RequestInfo associated with this result, or null if timeout reached before data is available.