Entry point into OPeNDAP using apache modules. More...
#include <BESApacheInterface.h>
Public Member Functions | |
BESApacheInterface (const BESDataRequestInterface &dri) | |
Instantiate a BESApacheInterface object. | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual int | execute_request (const string &from) |
Override execute_request in order to register memory pool. | |
virtual int | execute_request () |
Override execute_request in order to register memory pool. | |
virtual int | finish_with_error (int status) |
virtual | ~BESApacheInterface () |
Static Public Member Functions | |
static void | add_end_callback (p_bes_end end) |
static void | add_init_callback (p_bes_init init) |
Protected Member Functions | |
virtual void | build_data_request_plan () |
Build the data request plan using the BESCmdParser. | |
virtual void | clean () |
Clean up after the request is completed. | |
virtual void | end_request () |
End the BES request. | |
virtual int | exception_manager (BESError &e) |
Handle any exceptions generated from the request. | |
virtual void | execute_data_request_plan () |
Execute the data request plan. | |
virtual int | finish (int status) |
virtual void | initialize () |
Initialize the BES object from the apache environment. | |
virtual void | invoke_aggregation () |
Invoke the aggregation server, if there is one. | |
virtual void | log_status () |
Log the status of the request to the BESLog file. | |
virtual void | report_request () |
Report the request and status of the request to BESReporterList::TheList(). | |
virtual void | transmit_data () |
Transmit the response object. | |
virtual void | validate_data_request () |
Validate the information in the BESDataRequestInterface. | |
Protected Attributes | |
BESDataHandlerInterface * | _dhi |
BESTransmitter * | _transmitter |
Entry point into OPeNDAP using apache modules.
The BESApacheInterface class is the entry point for accessing information using OPeNDAP through apache modules.
The format of the request looks somethink like:
get das for sym1,sym2 with sym1.constraint="constraint",sym2.constraint="constraint";
In this example a DAS object response is being requested. The DAS object is to be built from the two symbolic names where each symbolic name has a constraint associated with it. The symbolic names are resoleved to be real files for a given server type. For example, sym1 could resolve to a file accessed through cedar and sym2 could resolve to a file accessed through netcdf.
BESApacheInterface uses BESParser in order to build the list of containers (symbolic containers resolving to real file and server type). Because the request is being made from a browser, a BESBasicHttpTransmitter object is used to transmit the response object back to the requesting browser.
Definition at line 75 of file BESApacheInterface.h.
BESApacheInterface::BESApacheInterface | ( | const BESDataRequestInterface & | dri | ) |
Instantiate a BESApacheInterface object.
dri | BESDataRequestInterface built using information from the apache module including the request and constraint passed as part of the URL. |
Definition at line 63 of file BESApacheInterface.cc.
BESApacheInterface::~BESApacheInterface | ( | ) | [virtual] |
Definition at line 69 of file BESApacheInterface.cc.
References BESBasicInterface::clean().
void BESInterface::add_end_callback | ( | p_bes_end | end | ) | [static, inherited] |
Definition at line 464 of file BESInterface.cc.
void BESInterface::add_init_callback | ( | p_bes_init | init | ) | [static, inherited] |
Definition at line 282 of file BESInterface.cc.
void BESCmdInterface::build_data_request_plan | ( | ) | [protected, virtual, inherited] |
Build the data request plan using the BESCmdParser.
Reimplemented from BESBasicInterface.
Definition at line 75 of file BESCmdInterface.cc.
References BESInterface::_dhi, BESDEBUG, BESDataHandlerInterface::data, DATA_REQUEST, BESCmdParser::parse(), REQUEST_FROM, SERVER_PID, BESLog::TheLog(), and BESUtil::www2id().
void BESBasicInterface::clean | ( | ) | [protected, virtual, inherited] |
Clean up after the request is completed.
Calls the parent method clean and then logs to the BESLog file saying that we are done and exiting the process. The exit actually takes place in the module code.
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 289 of file BESBasicInterface.cc.
References BESInterface::_dhi, BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
Referenced by ~BESApacheInterface(), and BESCmdInterface::~BESCmdInterface().
void BESCmdInterface::dump | ( | ostream & | strm | ) | const [virtual, inherited] |
dumps information about this object
Displays the pointer value of this instance
strm | C++ i/o stream to dump the information to |
Reimplemented from BESBasicInterface.
Definition at line 108 of file BESCmdInterface.cc.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
void BESInterface::end_request | ( | ) | [protected, virtual, inherited] |
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 475 of file BESInterface.cc.
References BESInterface::_dhi, BESDEBUG, BESDataHandlerInterface::container, BESDataHandlerInterface::data, DATA_REQUEST, BESDataHandlerInterface::first_container(), BESDataHandlerInterface::next_container(), and BESContainer::release().
Referenced by BESInterface::finish().
int BESApacheInterface::exception_manager | ( | BESError & | e | ) | [protected, virtual] |
Handle any exceptions generated from the request.
Captures if there is an error in the request format and builds a web page to allow the user to buid a request. If the request did not come from IE or Netscape then generate an error to the user. If the request contains a bad format, but a request is made, then generate an error message. Otherwise, if the request is empty, then generate a FORM to allow the user to enter a request string.
All other exceptions are passed off to the parent exception manager to handle.
e | BESError to be handled. If this method does not handle the exception then it is passed to the parent class exception_manager method to be handled. |
Reimplemented from BESInterface.
Definition at line 270 of file BESApacheInterface.cc.
References BESInterface::_dhi, BES_INTERNAL_ERROR, BESError::get_error_type(), BESError::get_message(), INCORRECT_REQUEST, INCORRECT_REQUEST_MSG, and BESDataHandlerInterface::transmit_protocol.
void BESBasicInterface::execute_data_request_plan | ( | ) | [protected, virtual, inherited] |
Execute the data request plan.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 180 of file BESBasicInterface.cc.
References BESInterface::_dhi, BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
int BESBasicInterface::execute_request | ( | const string & | from | ) | [virtual, inherited] |
Override execute_request in order to register memory pool.
Once the memory pool is initialized hand over control to parent class to execute the request. Once completed, unregister the memory pool.
This needs to be done here instead of the initialization method because???
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 76 of file BESBasicInterface.cc.
int BESApacheInterface::execute_request | ( | ) | [virtual] |
Override execute_request in order to register memory pool.
Once the memory pool is initialized hand over control to parent class to execute the request. Once completed, unregister the memory pool.
This needs to be done here instead of the initialization method because???
Definition at line 85 of file BESApacheInterface.cc.
References BES_INTERNAL_FATAL_ERROR, BESMemoryManager::register_global_pool(), and BESMemoryManager::unregister_global_pool().
Referenced by BESApacheWrapper::call_BES().
int BESInterface::finish | ( | int | status | ) | [protected, virtual, inherited] |
Definition at line 177 of file BESInterface.cc.
References BESInterface::_dhi, BESInterface::end_request(), BESDataHandlerInterface::error_info, BESInterface::exception_manager(), BESError::get_message(), BESInterface::log_status(), BESInfo::print(), BESInterface::report_request(), BESLog::TheLog(), and BESInterface::transmit_data().
Referenced by BESInterface::execute_request(), and BESInterface::finish_with_error().
int BESInterface::finish_with_error | ( | int | status | ) | [virtual, inherited] |
Definition at line 268 of file BESInterface.cc.
References BESInterface::_dhi, BESDataHandlerInterface::error_info, BESInterface::exception_manager(), and BESInterface::finish().
Referenced by BESApacheWrapper::call_BES().
void BESApacheInterface::initialize | ( | ) | [protected, virtual] |
Initialize the BES object from the apache environment.
First calls the parent initialization method in order to initialize all global variables.
Once this is completed the BESDataHandlerInterface is initialized given the BESDataRequestInterface constructed within the module code.
This includes retreiving the user information from the cookie created on the client side in the browser. The cookie name is defined in OPENDAP_USER_COOKIE above.
Also creates the BESBasicHttpTransmitter object in order to transmit the response object via http, setting the mime type and other header information for the response.
Reimplemented from BESBasicInterface.
Definition at line 148 of file BESApacheInterface.cc.
References BESInterface::_dhi, BESDEBUG, _BESDataRequestInterface::cookie, BESDataHandlerInterface::data, DATA_REQUEST, find_user_from_cookie(), BESMemoryManager::initialize_memory_pool(), _BESDataRequestInterface::request, _BESDataRequestInterface::script_name, _BESDataRequestInterface::server_address, _BESDataRequestInterface::server_name, _BESDataRequestInterface::server_port, _BESDataRequestInterface::server_protocol, BESLog::TheLog(), _BESDataRequestInterface::token, BESDataHandlerInterface::transmit_protocol, _BESDataRequestInterface::user_address, USER_ADDRESS, _BESDataRequestInterface::user_agent, USER_NAME, and USER_TOKEN.
void BESBasicInterface::invoke_aggregation | ( | ) | [protected, virtual, inherited] |
Invoke the aggregation server, if there is one.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 200 of file BESBasicInterface.cc.
References BESInterface::_dhi, AGG_CMD, AGG_HANDLER, BESDataHandlerInterface::data, DATA_REQUEST, BESAggFactory::find_handler(), BESLog::is_verbose(), REQUEST_FROM, SERVER_PID, BESAggFactory::TheFactory(), and BESLog::TheLog().
void BESBasicInterface::log_status | ( | ) | [protected, virtual, inherited] |
Log the status of the request to the BESLog file.
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 266 of file BESBasicInterface.cc.
References BESInterface::_dhi, BESDataHandlerInterface::data, DATA_REQUEST, BESDataHandlerInterface::error_info, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
void BESInterface::report_request | ( | ) | [protected, virtual, inherited] |
Report the request and status of the request to BESReporterList::TheList().
If interested in reporting the request and status of the request then one must register a BESReporter with BESReporterList::TheList().
If no BESReporter objects are registered then nothing happens.
Reimplemented in BESXMLInterface.
Definition at line 453 of file BESInterface.cc.
References BESInterface::_dhi, BESDEBUG, BESDataHandlerInterface::data, DATA_REQUEST, BESReporterList::report(), and BESReporterList::TheList().
Referenced by BESInterface::finish().
void BESBasicInterface::transmit_data | ( | ) | [protected, virtual, inherited] |
Transmit the response object.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
Reimplemented in BESXMLInterface.
Definition at line 249 of file BESBasicInterface.cc.
References BESInterface::_dhi, BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
void BESApacheInterface::validate_data_request | ( | ) | [protected, virtual] |
Validate the information in the BESDataRequestInterface.
Reimplemented from BESBasicInterface.
Definition at line 200 of file BESApacheInterface.cc.
References INCORRECT_REQUEST, INCORRECT_REQUEST_MSG, _BESDataRequestInterface::request, _BESDataRequestInterface::script_name, _BESDataRequestInterface::server_address, _BESDataRequestInterface::server_name, _BESDataRequestInterface::server_port, _BESDataRequestInterface::server_protocol, BESError::set_error_type(), _BESDataRequestInterface::user_address, and _BESDataRequestInterface::user_agent.
BESDataHandlerInterface* BESInterface::_dhi [protected, inherited] |
Definition at line 136 of file BESInterface.h.
Referenced by BESCgiInterface::BESCgiInterface(), BESCmdInterface::BESCmdInterface(), BESXMLInterface::BESXMLInterface(), BESXMLInterface::build_data_request_plan(), BESCmdInterface::build_data_request_plan(), BESCgiInterface::build_data_request_plan(), BESBasicInterface::build_data_request_plan(), BESXMLInterface::clean(), BESInterface::clean(), BESBasicInterface::clean(), BESInterface::dump(), BESInterface::end_request(), BESInterface::exception_manager(), exception_manager(), BESXMLInterface::execute_data_request_plan(), BESInterface::execute_data_request_plan(), BESBasicInterface::execute_data_request_plan(), BESInterface::execute_request(), BESInterface::finish(), BESInterface::finish_with_error(), BESInterface::initialize(), BESBasicInterface::initialize(), initialize(), BESInterface::invoke_aggregation(), BESBasicInterface::invoke_aggregation(), BESXMLInterface::log_status(), BESBasicInterface::log_status(), BESXMLInterface::report_request(), BESInterface::report_request(), BESXMLInterface::transmit_data(), BESInterface::transmit_data(), and BESBasicInterface::transmit_data().
BESTransmitter* BESInterface::_transmitter [protected, inherited] |
Definition at line 137 of file BESInterface.h.
Referenced by BESCgiInterface::BESCgiInterface(), BESBasicInterface::build_data_request_plan(), BESInterface::dump(), BESBasicInterface::initialize(), BESXMLInterface::transmit_data(), BESInterface::transmit_data(), and BESCgiInterface::~BESCgiInterface().