com.cri.xcat.api
Class Request

java.lang.Object
  extended by com.cri.xcat.api.Request
Direct Known Subclasses:
BasicRequest

public abstract class Request
extends java.lang.Object

A request (also referred to as a command) is the basic information that is sent to the xCAT daemon. This class is responsible for creating the appropriate XML to send to xcatd as well as submitting this request to the server. The communication to the server is done via a xCAT connection object.

Author:
Scott Brown

Constructor Summary
Request()
           
 
Method Summary
abstract  void buildXmlOutputStream(java.io.OutputStream stream)
          Creates the XML and sends it to the xCAT server.
 Connection getConnection()
          Gets the connection used to create the socket.
 IResponseHandler getHandler()
          Gets the handler used to handle XML responses and any errors that might have occurred.
 int getSocketTimeOut()
          Gets the timeout used to read data from the socket to xCAT (in milliseconds).
 void setSocketTimeOut(int socketTimeOut)
          Sets the timeout used to read data from the socket to xCAT (in milliseconds).
 void submitRequest(Connection connection)
          Submits a request to the xCAT daemon using the connection passed in and a new DefaultResponseHandler as the handler.
 void submitRequest(Connection connection, IResponseHandler handler)
          Submits a request to the xCAT daemon using the connection and handler passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Request

public Request()
Method Detail

buildXmlOutputStream

public abstract void buildXmlOutputStream(java.io.OutputStream stream)
                                   throws XcatCommunicationException
Creates the XML and sends it to the xCAT server. The XML root tag should be xcatrequest.

Parameters:
stream - The OutputStream from the SSL socket to the xCAT server. The XML created should be sent to this output stream.
Throws:
XcatCommunicationException

getConnection

public Connection getConnection()
Gets the connection used to create the socket.

Returns:
the connection used to create the socket

getHandler

public IResponseHandler getHandler()
Gets the handler used to handle XML responses and any errors that might have occurred.

Returns:
the handler used to handle XML responses and any errors that might have occurred

getSocketTimeOut

public int getSocketTimeOut()
Gets the timeout used to read data from the socket to xCAT (in milliseconds). NOTE: this is not used if the implementer overrides the submitRequest method.

A value of 0 represents an infinite timeout (or no timeout).

Default value set to 8000.

Returns:
The timeout used to read data from the socket to xCAT (in milliseconds).

setSocketTimeOut

public void setSocketTimeOut(int socketTimeOut)
Sets the timeout used to read data from the socket to xCAT (in milliseconds). NOTE: this is not used if the implementer overrides the submitRequest method.

Setting the value to 0 represents an infinite timeout (or no timeout)

Default value set to 8000.

Parameters:
socketTimeOut - The timeout used to read data from the socket to xCAT (in milliseconds).

submitRequest

public void submitRequest(Connection connection)
Submits a request to the xCAT daemon using the connection passed in and a new DefaultResponseHandler as the handler.

Parameters:
connection - the connection used to create a socket connection to xcatd

submitRequest

public void submitRequest(Connection connection,
                          IResponseHandler handler)
Submits a request to the xCAT daemon using the connection and handler passed in.

Parameters:
connection - the connection used to create a socket connection to xcatd
handler - the handler used to handle the XML response or any errors that occurred.