CmdClient Class Reference

#include <CmdClient.h>

Inheritance diagram for CmdClient:

Inheritance graph
[legend]
Collaboration diagram for CmdClient:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CmdClient ()
 ~CmdClient ()
void startClient (const string &host, int portVal, int timeout)
void startClient (const string &unixSocket, int timeout)
void shutdownClient ()
void setOutput (ostream *strm, bool created)
void executeClientCommand (const string &cmd)
 Executes a client side command.
void executeCommand (const string &cmd, int repeat)
void executeCommands (const string &cmd_list, int repeat)
void executeCommands (ifstream &inputFile, int repeat)
void interact ()
bool isConnected ()
void brokenPipe ()
virtual void dump (ostream &strm) const
 dumps information about this object

Detailed Description

CmdClient is an object that handles the connection to, sending requests to, and receiving response from a specified OpenDAP server running either on this machine or another machine.

Requests to the OpenDAP server can be taken in different ways by the CmdClient object.

Response from the requests can sent to any File or OutputStream as specified by using the setOutput methods. If no output is specified using the setOutput methods thent he output is ignored.

Thread safety of this object has not yet been determined.

Author:
Patrick West <A * HREF="mailto:pwest@hao.ucar.edu">pwest@hao.ucar.edu

Definition at line 75 of file CmdClient.h.


Constructor & Destructor Documentation

CmdClient::CmdClient (  )  [inline]

Definition at line 85 of file CmdClient.h.

CmdClient::~CmdClient (  ) 

Definition at line 76 of file CmdClient.cc.


Member Function Documentation

void CmdClient::startClient ( const string &  host,
int  portVal,
int  timeout 
)

Connect the BES client to the BES server.

Connects to the BES server on the specified machine listening on the specified port.

Parameters:
hostStr The name of the host machine where the server is running.
portVal The port on which the server on the host hostStr is listening for requests.
Exceptions:
PPTException Thrown if unable to connect to the specified host machine given the specified port.
See also:
PPTException

Definition at line 106 of file CmdClient.cc.

References PPTClient::initConnection().

Referenced by CmdApp::run().

Here is the call graph for this function:

void CmdClient::startClient ( const string &  unixStr,
int  timeout 
)

Connect the BES client to the BES server using the unix socket

Connects to the BES server using the specified unix socket

Parameters:
unixStr Full path to the unix socket
Exceptions:
PPTException Thrown if unable to connect to the BES server
See also:
PPTException

Definition at line 121 of file CmdClient.cc.

References PPTClient::initConnection().

Here is the call graph for this function:

void CmdClient::shutdownClient (  ) 

Closes the connection to the OpeNDAP server and closes the output stream.

Exceptions:
PPTException Thrown if unable to close the connection or close the output stream. machine given the specified port.
See also:
OutputStream

PPTException

Definition at line 136 of file CmdClient.cc.

References PPTClient::closeConnection().

Referenced by CmdApp::run(), and CmdApp::signalBrokenPipe().

Here is the call graph for this function:

void CmdClient::setOutput ( ostream *  strm,
bool  created 
)

Set the output stream for responses from the BES server.

Specify where the response output from your BES request will be sent. Set to null if you wish to ignore the response from the BES server.

Parameters:
strm an OutputStream specifying where to send responses from the BES server. If null then the output will not be output but will be thrown away.
Exceptions:
PPTException catches any problems with opening or writing to the output stream and creates a PPTException
See also:
OutputStream

PPTException

Definition at line 157 of file CmdClient.cc.

Referenced by executeClientCommand(), and CmdApp::run().

void CmdClient::executeClientCommand ( const string &  cmd  ) 

Executes a client side command.

Client side commands include client suppress; client output to screen; client output to <filename>;

Parameters:
cmd The BES client side command to execute
See also:
PPTException

Definition at line 180 of file CmdClient.cc.

References setOutput().

Referenced by executeCommand().

Here is the call graph for this function:

void CmdClient::executeCommand ( const string &  cmd,
int  repeat 
)

Sends a single OpeNDAP request ending in a semicolon (;) to the OpeNDAP server.

The response is written to the output stream if one is specified, otherwise the output is ignored.

Parameters:
cmd The BES request, ending in a semicolon, that is sent to the BES server to handle.
Exceptions:
PPTException Thrown if there is a problem sending the request to the server or a problem receiving the response from the server.
See also:
PPTException

Definition at line 223 of file CmdClient.cc.

References executeClientCommand(), PPTConnection::receive(), and PPTConnection::send().

Referenced by executeCommands().

Here is the call graph for this function:

void CmdClient::executeCommands ( const string &  cmd_list,
int  repeat 
)

Execute each of the commands in the cmd_list, separated by a * semicolon.

The response is written to the output stream if one is specified, otherwise the output is ignored.

Parameters:
cmd_list The list of BES requests, separated by semicolons and ending in a semicolon, that will be sent to the BES server to handle, one at a time.
Exceptions:
PPTException Thrown if there is a problem sending any of the request to the server or a problem receiving any of the responses from the server.
See also:
PPTException

Definition at line 253 of file CmdClient.cc.

References executeCommand().

Referenced by executeCommands(), interact(), and CmdApp::run().

Here is the call graph for this function:

void CmdClient::executeCommands ( ifstream &  istrm,
int  repeat 
)

Sends the requests listed in the specified file to the BES server, each command ending with a semicolon.

The requests do not have to be one per line but can span multiple lines and there can be more than one command per line.

The response is written to the output stream if one is specified, otherwise the output is ignored.

Parameters:
inputFile The file holding the list of BES requests, each ending with a semicolon, that will be sent to the BES server to handle.
Exceptions:
PPTException Thrown if there is a problem opening the file to read, reading the requests from the file, sending any of the requests to the server or a problem receiving any of the responses from the server.
See also:
File

PPTException

Definition at line 288 of file CmdClient.cc.

References executeCommands().

Here is the call graph for this function:

void CmdClient::interact (  ) 

An interactive BES client that takes BES requests on the command line.

There can be more than one command per line, but commands can NOT span multiple lines. The user will be prompted to enter a new BES request.

OpenDAPClient:

The response is written to the output stream if one is specified, otherwise the output is ignored.

Exceptions:
PPTException Thrown if there is a problem sending any of the requests to the server or a problem receiving any of the responses from the server.
See also:
PPTException

Definition at line 351 of file CmdClient.cc.

References executeCommands().

Referenced by CmdApp::run().

Here is the call graph for this function:

bool CmdClient::isConnected (  ) 

Definition at line 446 of file CmdClient.cc.

References Connection::isConnected().

Referenced by CmdApp::signalCannotConnect().

Here is the call graph for this function:

void CmdClient::brokenPipe (  ) 

Definition at line 453 of file CmdClient.cc.

References Connection::brokenPipe().

Referenced by CmdApp::signalBrokenPipe().

Here is the call graph for this function:

void CmdClient::dump ( ostream &  strm  )  const [virtual]

dumps information about this object

Displays the pointer value of this instance

Parameters:
strm C++ i/o stream to dump the information to

Implements BESObj.

Definition at line 465 of file CmdClient.cc.

References PPTClient::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Referenced by CmdApp::dump().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Aug 29 03:24:45 2007 for OPeNDAP Back End Server (BES) by  doxygen 1.5.2