base.connection
Class ResponseHandler

java.lang.Object
  extended by base.connection.ResponseHandler
Direct Known Subclasses:
EC2Handler, IBMHandler, NirvanixHandler, RackspaceHandler, S3Handler

public class ResponseHandler
extends java.lang.Object

Default handler for request responses. Subclasses should override these methods for custom handling.


Field Summary
protected  java.lang.Object object
           
protected  IResponse response
           
 
Constructor Summary
ResponseHandler(IResponse response)
          Constructs the handler with the given response.
 
Method Summary
 java.lang.Object getParsedObject()
          Returns the response's processed representation.
 IResponse getResponse()
          Returns the original response.
protected  void parseBody()
          Parses the response's body.
protected  java.lang.String parseError()
          Returns a String expressing the error that occurred.
protected  boolean success()
          Indicates if the request was successful or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

response

protected IResponse response

object

protected java.lang.Object object
Constructor Detail

ResponseHandler

public ResponseHandler(IResponse response)
Constructs the handler with the given response.

Parameters:
response - is the request's response
Method Detail

getParsedObject

public java.lang.Object getParsedObject()
Returns the response's processed representation.

Returns:
Object is the response's parsed object for additional processing

getResponse

public IResponse getResponse()
Returns the original response.

Returns:
IResponse is the request's original response

parseBody

protected void parseBody()
Parses the response's body. The parsed response is stored in 'object'. This object is then used within the Driver to custom parse the response. Subclasses should override for custom processing.

See Also:
IBMHandler, IBMDriver

parseError

protected java.lang.String parseError()
Returns a String expressing the error that occurred. Subclasses should override for custom processing.

Returns:
String represents the error that occurred if !success()

success

protected boolean success()
Indicates if the request was successful or not. Subclasses should override for custom processing.

Returns:
true if the request was successful, false otherwise