com.cri.xcat.api.helpers
Class BasicRequest

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

public class BasicRequest
extends Request

BasicRequest extends the base Request class and represents a basic xCAT request to the xCAT daemon. A request is also commonly referred to as a command. A basic xCAT request (or command) consists of four parts:

Not all requests must use all four parts. For a BasicRequest, only the commandName must be explicitly set by the user. For the node range and argument list, only if values are set will the resulting XML contain these fields, otherwise no node range or argument list is sent to the xCAT daemon.

The current working directory is also always sent to the xCAT daemon, but this information can be found by using the System's user directory if the user does not explicitly set this value. The user cannot however set the current working directory to null as the xCAT daemon is expecting this information.

For example, if a user creates a BasicRequest but only sets the node range value to "n01", the following information will be sent to the xCAT daemon:

Author:
Scott Brown

Constructor Summary
BasicRequest(java.lang.String commandName)
          Default Constructor that creates a Basic Request with the command name equal to the input parameter.
 
Method Summary
 void buildXmlOutputStream(java.io.OutputStream stream)
          Creates the XML and sends it to the xCAT server.
 java.lang.String[] getArgs()
          Gets the list of arguments that will be sent to the xCAT deamon with the command.
 java.lang.String getCommandName()
          Gets the name of the command that will be sent to the xCAT deamon.
 java.lang.String getCurrentWorkingDirectory()
          Gets the current working directory.
 java.lang.String getNodeRange()
          Get the node range for the command.
 void setArgs(java.lang.String[] args)
          Sets the list of arguments that will be sent to the xCAT deamon with the command.
 void setCommandName(java.lang.String name)
          Sets the name of the command that will be sent to the xCAT deamon.
 void setCurrentWorkingDirectory(java.lang.String currentWorkingDirectory)
          Set the current working directory for the xCAT request.
 void setNodeRange(java.lang.String nodeRange)
          Set the node range for the request.
 
Methods inherited from class com.cri.xcat.api.Request
getConnection, getHandler, getSocketTimeOut, setSocketTimeOut, submitRequest, submitRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicRequest

public BasicRequest(java.lang.String commandName)
Default Constructor that creates a Basic Request with the command name equal to the input parameter.

Parameters:
commandName - the name of the command which will be sent to the xCAT daemon.
Method Detail

buildXmlOutputStream

public void buildXmlOutputStream(java.io.OutputStream stream)
                          throws XcatCommunicationException
Description copied from class: Request
Creates the XML and sends it to the xCAT server. The XML root tag should be xcatrequest.

Specified by:
buildXmlOutputStream in class Request
Parameters:
stream - The OutputStream from the SSL socket to the xCAT server. The XML created should be sent to this output stream.
Throws:
XcatCommunicationException

getArgs

public java.lang.String[] getArgs()
Gets the list of arguments that will be sent to the xCAT deamon with the command.

May return null if the argument list was never set or was set to null.

Returns:
a list of arguments that will be sent to the xCAT deamon with the command

getCommandName

public java.lang.String getCommandName()
Gets the name of the command that will be sent to the xCAT deamon.

Returns:
the name of the command that will be sent to the xCAT deamon

getCurrentWorkingDirectory

public java.lang.String getCurrentWorkingDirectory()
Gets the current working directory.

May return null if the directory was never set or was set to null.

Returns:
the user-specified current working directory

getNodeRange

public java.lang.String getNodeRange()
Get the node range for the command.

May return null if the range was never set or was set to null.

Returns:
the node range

setArgs

public void setArgs(java.lang.String[] args)
Sets the list of arguments that will be sent to the xCAT deamon with the command.

Parameters:
args - the list of arguments that will be sent to the xCAT deamon with the command

setCommandName

public void setCommandName(java.lang.String name)
Sets the name of the command that will be sent to the xCAT deamon. The commandName is the only part of a BasicRequest which must be explicitly specified by the user.

Cannot be empty or null.

Parameters:
name - the name of the command that will be sent to the xCAT deamon

setCurrentWorkingDirectory

public void setCurrentWorkingDirectory(java.lang.String currentWorkingDirectory)
Set the current working directory for the xCAT request. The xCAT deamon requires a current directory for most commands, and if this value is never set (or set to null), the System's user directory is used.

Parameters:
currentWorkingDirectory - the current working directory for the xCAT request

setNodeRange

public void setNodeRange(java.lang.String nodeRange)
Set the node range for the request.

Parameters:
nodeRange - node range for the request