bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESXMLInterface Class Reference

Entry point into BES using xml document requests. More...

#include <BESXMLInterface.h>

Inheritance diagram for BESXMLInterface:
Inheritance graph
Collaboration diagram for BESXMLInterface:
Collaboration graph

Public Member Functions

 BESXMLInterface (const std::string &cmd, std::ostream *strm)
 
void dump (std::ostream &strm) const override
 dumps information about this object
 
virtual int execute_request (const std::string &from)
 The entry point for command execution; called by BESServerHandler::execute()
 
virtual int finish (int status)
 

Protected Member Functions

void build_data_request_plan () override
 Build the data request plan using the BESCmdParser.
 
void clean () override
 Clean up after the request is completed.
 
void clear_bes_timeout ()
 Clear the bes timeout.
 
virtual void end_request ()
 End the BES request.
 
void execute_data_request_plan () override
 Execute the data request plan.
 
void log_status () override
 Log the status of the request to the BESLog file.
 
void log_the_command ()
 Log information about the command.
 
void set_bes_timeout ()
 Set the int 'd_bes_timeout' Use either the value of a 'bes_timeout' context or the value set in the BES keys to set the global volatile int 'bes_timeout'.
 
void transmit_data () override
 Transmit the response object.
 

Static Protected Member Functions

static int handleException (const BESError &e, BESDataHandlerInterface &dhi)
 Make a BESXMLInfo object to hold the error information.
 

Protected Attributes

BESDataHandlerInterfaced_dhi_ptr {nullptr}
 Allocated by the child class.
 
BESTransmitterd_transmitter {nullptr}
 The Transmitter to use for the result.
 

Friends

class XmlInterfaceTest
 

Detailed Description

Entry point into BES using xml document requests.

See also
BESInterface

Definition at line 47 of file BESXMLInterface.h.

Constructor & Destructor Documentation

◆ BESXMLInterface()

BESXMLInterface::BESXMLInterface ( const std::string & cmd,
std::ostream * strm )

Definition at line 63 of file BESXMLInterface.cc.

◆ ~BESXMLInterface()

BESXMLInterface::~BESXMLInterface ( )
override

Definition at line 71 of file BESXMLInterface.cc.

Member Function Documentation

◆ build_data_request_plan()

void BESXMLInterface::build_data_request_plan ( )
overrideprotectedvirtual

Build the data request plan using the BESCmdParser.

Implements BESInterface.

Definition at line 78 of file BESXMLInterface.cc.

◆ clean()

void BESXMLInterface::clean ( )
overrideprotectedvirtual

Clean up after the request is completed.

Implements BESInterface.

Definition at line 450 of file BESXMLInterface.cc.

◆ clear_bes_timeout()

void BESInterface::clear_bes_timeout ( )
protectedinherited

Clear the bes timeout.

Definition at line 308 of file BESInterface.cc.

◆ dump()

void BESXMLInterface::dump ( std::ostream & strm) const
overridevirtual

dumps information about this object

Displays the pointer value of this instance

Parameters
strmC++ i/o stream to dump the information to

Reimplemented from BESInterface.

Definition at line 472 of file BESXMLInterface.cc.

◆ end_request()

void BESInterface::end_request ( )
protectedvirtualinherited

End the BES request.

This method allows developers to add callbacks at the end of a request, to do any cleanup or do any extra work at the end of a request

Definition at line 485 of file BESInterface.cc.

◆ execute_data_request_plan()

void BESXMLInterface::execute_data_request_plan ( )
overrideprotectedvirtual

Execute the data request plan.

Implements BESInterface.

Definition at line 351 of file BESXMLInterface.cc.

◆ execute_request()

int BESInterface::execute_request ( const std::string & from)
virtualinherited

The entry point for command execution; called by BESServerHandler::execute()

Execute the request by:

  1. initializing BES
  2. build the request plan (i.e., filling in the BESDataHandlerInterface)
  3. execute the request plan using the BESDataHandlerInterface
  4. transmit the resulting response object
  5. log the status of the execution
  6. end the request, which allows developers to add callbacks to notify them of the end of the request

If an exception is thrown in any of these steps the exception is handed over to the exception manager in order to generate the proper response. Control is returned back to the calling method if an exception is thrown and it is the responsibility of the calling method to call finish_with_error in order to transmit the error message back to the client.

Parameters
fromA string that tells where this request came from. Literally, the IP and port number or the string 'standalone'. See void BESServerHandler::execute(Connection *c) or void StandAloneClient::executeCommand(const string & cmd, int repeat)
Returns
status of the execution of the request, 0 if okay, !0 otherwise
See also
initialize()
build_data_request_plan()
execute_data_request_plan()
finish()
finish_with_error()
transmit_data()
log_status()
end_request()
exception_manager()

Definition at line 354 of file BESInterface.cc.

◆ finish()

int BESInterface::finish ( int status)
virtualinherited

Call this once execute_request() has completed.

Parameters
status
Returns
The status value.

Definition at line 455 of file BESInterface.cc.

◆ handleException()

int BESInterface::handleException ( const BESError & e,
BESDataHandlerInterface & dhi )
staticprotectedinherited

Make a BESXMLInfo object to hold the error information.

Get the admin email address and form an error response to pass back to the OLFS. The response is an XML document.

Parameters
eThe BESError object
dhiThe BESDataHandlerInterface object
Returns

Definition at line 242 of file BESInterface.cc.

◆ log_status()

void BESXMLInterface::log_status ( )
overrideprotectedvirtual

Log the status of the request to the BESLog file.

This will only log information in the verbose mode.

See also
BESLog

Implements BESInterface.

Definition at line 434 of file BESXMLInterface.cc.

◆ log_the_command()

void BESXMLInterface::log_the_command ( )
protected

Log information about the command.

Definition at line 288 of file BESXMLInterface.cc.

◆ set_bes_timeout()

void BESInterface::set_bes_timeout ( )
protectedinherited

Set the int 'd_bes_timeout' Use either the value of a 'bes_timeout' context or the value set in the BES keys to set the global volatile int 'bes_timeout'.

Definition at line 280 of file BESInterface.cc.

◆ transmit_data()

void BESXMLInterface::transmit_data ( )
overrideprotectedvirtual

Transmit the response object.

This is only called from BESXMLInterface::execute_data_request_plan().

Note
The idea here is that the execute() and transmit() parts are separate to increase the chance of catching errors before transmission starts. Once we call d_dhi_ptr->response_handler->transmit(d_transmitter, *d_dhi_ptr) it's really hard to tell the client about a problem.

Only transmit if there is an error or if there is a ResponseHandler. For any XML document with one or more commands, there should only be one ResponseHandler.

Implements BESInterface.

Definition at line 396 of file BESXMLInterface.cc.

Friends And Related Symbol Documentation

◆ XmlInterfaceTest

friend class XmlInterfaceTest
friend

Definition at line 50 of file BESXMLInterface.h.

Member Data Documentation

◆ d_dhi_ptr

BESDataHandlerInterface* BESInterface::d_dhi_ptr {nullptr}
protectedinherited

Allocated by the child class.

Definition at line 124 of file BESInterface.h.

◆ d_transmitter

BESTransmitter* BESInterface::d_transmitter {nullptr}
protectedinherited

The Transmitter to use for the result.

Definition at line 125 of file BESInterface.h.


The documentation for this class was generated from the following files: