CmdClient Class Reference

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. More...

#include <CmdClient.h>

Inheritance diagram for CmdClient:
Inheritance graph
[legend]
Collaboration diagram for CmdClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void brokenPipe ()
 inform the server that there has been a borken pipe
 CmdClient ()
virtual void dump (ostream &strm) const
 dumps information about this object
bool executeClientCommand (const string &cmd)
 Executes a client side command.
bool executeCommands (ifstream &inputFile, int repeat)
 Sends the xml request document from the specified file to the server.
bool executeCommands (const string &cmd, int repeat)
 Send the command(s) specified to the BES server after wrapping in request document.
bool interact ()
 An interactive BES client that takes BES requests on the command line.
bool isConnected ()
 return whether the client is connected to the BES
void setOutput (ostream *strm, bool created)
 Set the output stream for responses from the BES server.
void shutdownClient ()
 Closes the connection to the OpeNDAP server and closes the output stream.
void startClient (const string &unixSocket, int timeout)
 Connect the BES client to the BES server using the unix socket.
void startClient (const string &host, int portVal, int timeout)
 Connect the BES client to the BES server.
 ~CmdClient ()

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 88 of file CmdClient.h.

CmdClient::~CmdClient (  ) 

Definition at line 91 of file CmdClient.cc.


Member Function Documentation

void CmdClient::brokenPipe (  ) 

inform the server that there has been a borken pipe

Definition at line 645 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 658 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:

bool CmdClient::executeClientCommand ( const string &  cmd  ) 

Executes a client side command.

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

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

Definition at line 206 of file CmdClient.cc.

References executeCommands(), and setOutput().

Here is the call graph for this function:

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

Sends the xml request document from the specified file to the server.

The file can contain only one xml request document and must be well formatted. If not, the server will respond with an exception

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

Parameters:
istrm The file holding the xml request document
repeat Number of times to repeat the series of commands from the file.
Exceptions:
BESError Thrown if there is a problem opening the file to read, reading the request document from the file, sending the request document to the server or a problem receiving any of the responses from the server.
See also:
File
BESError

Definition at line 451 of file CmdClient.cc.

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

Send the command(s) specified to the BES server after wrapping in request document.

This takes a string command or set of string commands from the command line, builds an xml document with the commands, and sends it to the server.

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

Parameters:
cmd_list The BES commands to send to the BES server
repeat Number of times to repeat the command
Exceptions:
BESError 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:
BESError

Definition at line 406 of file CmdClient.cc.

References CmdTranslation::set_show(), and CmdTranslation::translate().

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

Here is the call graph for this function:

bool CmdClient::interact (  ) 

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

The commands specified interactively are the old style command syntax, not xml documents.

There can be more than one command per line, but commands cannot 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:
BESError 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:
BESError

Definition at line 493 of file CmdClient.cc.

References CmdTranslation::set_show(), and CmdTranslation::translate().

Referenced by CmdApp::run().

Here is the call graph for this function:

bool CmdClient::isConnected (  ) 

return whether the client is connected to the BES

Returns:
whether the client is connected (true) or not (false)

Definition at line 635 of file CmdClient.cc.

References Connection::isConnected().

Referenced by CmdApp::signalCannotConnect().

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.
created true of the passed stream was created and can be deleted either by being replaced ro in the destructor
Exceptions:
BESError catches any problems with opening or writing to the output stream and creates a BESError
See also:
OutputStream
BESError

Definition at line 179 of file CmdClient.cc.

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

void CmdClient::shutdownClient (  ) 

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

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

Definition at line 156 of file CmdClient.cc.

References PPTClient::closeConnection().

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

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
timeout Number of times to try an un-blocked read
Exceptions:
BESError Thrown if unable to connect to the BES server
See also:
BESError

Definition at line 141 of file CmdClient.cc.

References PPTClient::initConnection().

Here is the call graph for this function:

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:
host 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.
timeout Number of times to try an un-blocked read
Exceptions:
BESError Thrown if unable to connect to the specified host machine given the specified port.
See also:
BESError

Definition at line 125 of file CmdClient.cc.

References PPTClient::initConnection().

Referenced by CmdApp::run().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208