|
OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
This class is used to build responses for/by the BES. More...
#include <BESDapResponseBuilder.h>

Public Member Functions | |
| BESDapResponseBuilder () | |
| Make an empty instance. More... | |
| virtual void | establish_timeout (std::ostream &stream) const |
| Use values of this instance to establish a timeout alarm for the server. More... | |
| virtual std::string | get_async_accepted () const |
| virtual std::string | get_btp_func_ce () const |
| virtual std::string | get_ce () const |
| Return the entire DAP2 constraint expression in a string. More... | |
| virtual std::string | get_dap4ce () const |
| Return the entire DAP4 constraint expression in a string. More... | |
| virtual std::string | get_dap4function () const |
| Return the entire DAP4 server side function expression in a string. More... | |
| virtual std::string | get_dataset_name () const |
| The ``dataset name'' is the filename or other string that the filter program will use to access the data. More... | |
| virtual std::string | get_store_result () const |
| int | get_timeout () const |
| Get the server's timeout value. More... | |
| virtual void | remove_timeout () const |
| virtual BESDapResponseCache * | responseCache () |
| Lazy getter for the ResponseCache. More... | |
| virtual void | send_dap2_data (std::ostream &data_stream, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool with_mime_headers=true) |
| Send the data in the DDS object back to the client program. More... | |
| virtual void | send_dap4_data (std::ostream &out, libdap::DMR &dmr, bool with_mime_headers=true) |
| virtual void | send_das (std::ostream &out, libdap::DAS &das, bool with_mime_headers=true) const |
| virtual void | send_das (std::ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool constrained=false, bool with_mime_headers=true) |
| virtual void | send_dds (std::ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool constrained=false, bool with_mime_headers=true) |
| This function formats and prints an ASCII representation of a DDS on stdout. More... | |
| virtual void | send_ddx (std::ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool with_mime_headers=true) |
| Send the DDX response. More... | |
| virtual void | send_dmr (std::ostream &out, libdap::DMR &dmr, bool with_mime_headers=true) |
| virtual void | serialize_dap2_data_dds (std::ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool ce_eval=true) |
| Build/return the BLOB part of the DAP2 data response. More... | |
| virtual void | serialize_dap2_data_ddx (std::ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, const std::string &boundary, const std::string &start, bool ce_eval=true) |
| Serialize a DAP3.2 DataDDX to the stream "out". More... | |
| virtual void | serialize_dap4_data (std::ostream &out, libdap::DMR &dmr, bool with_mime_headers=true) |
| Serialize the DAP4 data response to the passed stream. More... | |
| virtual void | set_async_accepted (std::string _aa) |
| virtual void | set_btp_func_ce (std::string _ce) |
| virtual void | set_ce (std::string _ce) |
| Set the DAP2 constraint expression. More... | |
| virtual void | set_dap4ce (std::string _ce) |
| Set the DAP4 constraint expression. More... | |
| virtual void | set_dap4function (std::string _func) |
| Set the DAP4 Server Side Fucntion expression. More... | |
| virtual void | set_dataset_name (const std::string _dataset) |
| Set the dataset name, which is a string used to access the dataset on the machine running the server. More... | |
| virtual void | set_store_result (std::string _sr) |
| void | set_timeout (int timeout=0) |
| Set the server's timeout value. More... | |
| virtual void | split_ce (libdap::ConstraintEvaluator &eval, const std::string &expr="") |
| Split the CE so that the server functions that compute new values are separated into their own string and can be evaluated separately from the rest of the CE (which can contain simple and slicing projection as well as other types of function calls). More... | |
| virtual bool | store_dap4_result (ostream &out, libdap::DMR &dmr) |
| Should this DAP4 result be stored and the client sent an Asynchronous response? This code looks at the 'store_result' property to determine if the response should be asynchronous and then, if so, churns through the options, sorting out if the client sent the correct information indicating it knows how to process them. More... | |
| virtual | ~BESDapResponseBuilder () |
Protected Member Functions | |
| void | initialize () |
| Called when initializing a ResponseBuilder that's not going to be passed command line arguments. More... | |
| void | send_dap4_data_using_ce (std::ostream &out, libdap::DMR &dmr, bool with_mime_headersr) |
| bool | store_dap2_result (ostream &out, libdap::DDS &dds, libdap::ConstraintEvaluator &eval) |
| Should this result be returned using the asynchronous response mechanism? Look at the 'store_result' property and see if the code should return this using the asynchronous mechanism. More... | |
Protected Attributes | |
| std::string | d_async_accepted |
| Version std::string for the library's default protocol version. More... | |
| std::string | d_btp_func_ce |
| DAP4 Server Side Function expression. More... | |
| std::string | d_dap2ce |
| Name of the dataset/database. More... | |
| std::string | d_dap4ce |
| DAP2 Constraint expression. More... | |
| std::string | d_dap4function |
| DAP4 Constraint expression. More... | |
| std::string | d_dataset |
| std::string | d_default_protocol |
| Response timeout after N seconds. More... | |
| BESDapResponseCache * | d_response_cache |
| std::string | d_store_result |
| If set (i.e. More... | |
| int | d_timeout |
| The BTP functions, extracted from the CE. More... | |
Friends | |
| class | ResponseBuilderTest |
This class is used to build responses for/by the BES.
This class replaces DODSFilter (although DODSFilter is still included in the library, its use is deprecated). and it does not have a provision for command line arguments.
Definition at line 45 of file BESDapResponseBuilder.h.
|
inline |
Make an empty instance.
Use the set_*() methods to load with needed values. You must call at least set_dataset_name() or be requesting version information.
Definition at line 85 of file BESDapResponseBuilder.h.
References initialize().

|
virtual |
Definition at line 125 of file BESDapResponseBuilder.cc.
|
virtual |
Use values of this instance to establish a timeout alarm for the server.
If the timeout value is zero, do nothing.
Definition at line 277 of file BESDapResponseBuilder.cc.
|
virtual |
Definition at line 219 of file BESDapResponseBuilder.cc.
|
inlinevirtual |
Definition at line 107 of file BESDapResponseBuilder.h.
References d_btp_func_ce.
Referenced by BESAsciiTransmit::send_basic_ascii().
|
virtual |
Return the entire DAP2 constraint expression in a string.
This includes both the projection and selection clauses, but not the question mark.
Get the constraint expression.
Definition at line 141 of file BESDapResponseBuilder.cc.
Referenced by BESAsciiTransmit::send_basic_ascii().
|
virtual |
Return the entire DAP4 constraint expression in a string.
Get the DAP4 constraint expression.
Definition at line 164 of file BESDapResponseBuilder.cc.
|
virtual |
Return the entire DAP4 server side function expression in a string.
Get the DAP4 server side function expression.
Definition at line 187 of file BESDapResponseBuilder.cc.
|
virtual |
The ``dataset name'' is the filename or other string that the filter program will use to access the data.
In some cases this will indicate a disk file containing the data. In others, it may represent a database query or some other exotic data access method.
Get the dataset name.
Definition at line 238 of file BESDapResponseBuilder.cc.
Referenced by BESDapResponseCache::cache_dataset(), and BESStoredDapResultCache::store_dap2_result().
|
virtual |
Definition at line 208 of file BESDapResponseBuilder.cc.
| int BESDapResponseBuilder::get_timeout | ( | ) | const |
Get the server's timeout value.
Definition at line 269 of file BESDapResponseBuilder.cc.
|
protected |
Called when initializing a ResponseBuilder that's not going to be passed command line arguments.
Definition at line 97 of file BESDapResponseBuilder.cc.
References DAP_PROTOCOL_VERSION.
Referenced by BESDapResponseBuilder().
|
virtual |
Definition at line 289 of file BESDapResponseBuilder.cc.
|
virtual |
Lazy getter for the ResponseCache.
Definition at line 118 of file BESDapResponseBuilder.cc.
References BESDapResponseCache::get_instance().
Referenced by BESAsciiTransmit::send_basic_ascii().

|
virtual |
Send the data in the DDS object back to the client program.
The data is encoded using a Marshaller, and enclosed in a MIME document which is all sent to data_stream.
Transmit data.
| dds | A DDS object containing the data to be sent. |
| eval | A reference to the ConstraintEvaluator to use. |
| data_stream | Write the response to this stream. |
| anc_location | A directory to search for ancillary files (in addition to the CWD). This is used in a call to get_data_last_modified_time(). |
| with_mime_headers | If true, include the MIME headers in the response. Defaults to true. |
Definition at line 795 of file BESDapResponseBuilder.cc.
References BESDEBUG.
|
virtual |
Definition at line 1020 of file BESDapResponseBuilder.cc.
|
protected |
Definition at line 994 of file BESDapResponseBuilder.cc.
|
virtual |
|
virtual |
|
virtual |
This function formats and prints an ASCII representation of a DDS on stdout.
Either an entire DDS or a constrained DDS may be sent. This function looks in the local cache and uses a DDS object there if it's valid. Otherwise, if the request CE contains server functions that build data for the response, the resulting DDS will be cached.
Transmit a DDS.
| out | The output stream to which the DAS is to be sent. |
| dds | The DDS to send back to a client. |
| eval | A reference to the ConstraintEvaluator to use. |
| constrained | If this argument is true, evaluate the current constraint expression and send the `constrained DDS' back to the client. |
| constrained | If true, apply the constraint bound to this instance of ResponseBuilder |
| with_mime_headers | If true (default) send MIME headers. |
Definition at line 480 of file BESDapResponseBuilder.cc.
|
virtual |
Send the DDX response.
The DDX never contains data, instead it holds a reference to a Blob response which is used to get the data values. The DDS and DAS objects are built using code that already exists in the servers.
| dds | The dataset's DDS with attributes in the variables. |
| eval | A reference to the ConstraintEvaluator to use. |
| out | Destination |
| with_mime_headers | If true, include the MIME headers in the response. Defaults to true. |
Definition at line 899 of file BESDapResponseBuilder.cc.
|
virtual |
Definition at line 965 of file BESDapResponseBuilder.cc.
References BESDEBUG.
|
virtual |
Build/return the BLOB part of the DAP2 data response.
Definition at line 718 of file BESDapResponseBuilder.cc.
References BESDEBUG.
|
virtual |
Serialize a DAP3.2 DataDDX to the stream "out".
This was originally intended to be used for DAP4.
Definition at line 742 of file BESDapResponseBuilder.cc.
References BESDEBUG.
Referenced by BESDapResponseCache::cache_dataset(), and BESStoredDapResultCache::store_dap2_result().
|
virtual |
Serialize the DAP4 data response to the passed stream.
Definition at line 1062 of file BESDapResponseBuilder.cc.
References BESDEBUG, CRLF, and max.
Referenced by BESStoredDapResultCache::store_dap4_result().
|
virtual |
Definition at line 224 of file BESDapResponseBuilder.cc.
References BESDEBUG.
|
inlinevirtual |
Definition at line 111 of file BESDapResponseBuilder.h.
|
virtual |
Set the DAP2 constraint expression.
This will filter the CE text removing any 'WWW' escape characters except space. Spaces are left in the CE because the CE parser uses whitespace to delimit tokens while some datasets have identifiers that contain spaces. It's possible to use double quotes around identifiers too, but most client software doesn't know about that.
@brief Set the CE
| _ce | The constraint expression |
Definition at line 156 of file BESDapResponseBuilder.cc.
|
virtual |
Set the DAP4 constraint expression.
This will filter the DAP4 CE text removing any 'WWW' escape characters except space. Spaces are left in the CE because the CE parser uses whitespace to delimit tokens while some datasets have identifiers that contain spaces. It's possible to use double quotes around identifiers too, but most client software doesn't know about that.
@brief Set the CE
| _ce | The constraint expression |
Definition at line 179 of file BESDapResponseBuilder.cc.
|
virtual |
Set the DAP4 Server Side Fucntion expression.
This will filter the function expression text removing any 'WWW' escape characters except space. Spaces are left in the CE because the CE parser uses whitespace to delimit tokens while some datasets have identifiers that contain spaces. It's possible to use double quotes around identifiers too, but most client software doesn't know about that.
@brief Set the CE
| _ce | The constraint expression |
Definition at line 203 of file BESDapResponseBuilder.cc.
|
virtual |
Set the dataset name, which is a string used to access the dataset on the machine running the server.
That is, this is typically a pathname to a data file, although it doesn't have to be. This is not echoed in error messages (because that would reveal server storage patterns that data providers might want to hide). All WWW-style escapes are replaced except for spaces.
Set the dataset pathname.
| ds | The pathname (or equivalent) to the dataset. |
Definition at line 253 of file BESDapResponseBuilder.cc.
|
virtual |
Definition at line 213 of file BESDapResponseBuilder.cc.
References BESDEBUG.
| void BESDapResponseBuilder::set_timeout | ( | int | t = 0 | ) |
Set the server's timeout value.
A value of zero (the default) means no timeout.
| t | Server timeout in seconds. Default is zero (no timeout). |
Definition at line 263 of file BESDapResponseBuilder.cc.
|
virtual |
Split the CE so that the server functions that compute new values are separated into their own string and can be evaluated separately from the rest of the CE (which can contain simple and slicing projection as well as other types of function calls).
Definition at line 320 of file BESDapResponseBuilder.cc.
References BESDEBUG.
Referenced by BESAsciiTransmit::send_basic_ascii().
|
protected |
Should this result be returned using the asynchronous response mechanism? Look at the 'store_result' property and see if the code should return this using the asynchronous mechanism.
If yes, it will try and return the correct response or an error if the server is not configured or the client has not included the correct information in the request.
| out | Write information to the client using this stream |
| dds | The DDS that hold information used to build the response. The response won't be built until some time in the future |
| eval | Use this to evaluate the CE associated with the response. |
OOPS. Looks like the BES is not configured to use a Stored Result Cache. Looks like need to reject the request and move on.
Client accepts async responses so, woot! lets store this thing and tell them where to find it.
Client didn't indicate a willingness to accept an async response So - we tell them that async is required.
Definition at line 559 of file BESDapResponseBuilder.cc.
References BESStoredDapResultCache::assemblePath(), BESDEBUG, BESStoredDapResultCache::get_instance(), BESKeys::get_value(), NULL, BESStoredDapResultCache::store_dap2_result(), and TheBESKeys::TheKeys().

|
virtual |
Should this DAP4 result be stored and the client sent an Asynchronous response? This code looks at the 'store_result' property to determine if the response should be asynchronous and then, if so, churns through the options, sorting out if the client sent the correct information indicating it knows how to process them.
If the 'store_result' property is not set, then this method simply returns false, indicating that the response should be returned using the normal synchronous response pattern.
| out | Write information about the response here |
| dmr | This DMR will be serialized to build the response, at some point in time |
OOPS. Looks like the BES is not configured to use a Stored Result Cache. Looks like need to reject the request and move on.
Client accepts async responses so, woot! lets store this thing and tell them where to find it.
Client didn't indicate a willingness to accept an async response So - we tell them that async is required.
Definition at line 1103 of file BESDapResponseBuilder.cc.
References BESStoredDapResultCache::assemblePath(), BESDEBUG, BESStoredDapResultCache::get_instance(), BESKeys::get_value(), NULL, BESStoredDapResultCache::store_dap4_result(), and TheBESKeys::TheKeys().

|
friend |
Definition at line 47 of file BESDapResponseBuilder.h.
|
protected |
Version std::string for the library's default protocol version.
Time, if any, that the client will wait for an async response. An empty string (length=0) means the client didn't supply an async parameter
Definition at line 62 of file BESDapResponseBuilder.h.
|
protected |
DAP4 Server Side Function expression.
Definition at line 54 of file BESDapResponseBuilder.h.
Referenced by get_btp_func_ce().
|
protected |
Name of the dataset/database.
Definition at line 51 of file BESDapResponseBuilder.h.
|
protected |
DAP2 Constraint expression.
Definition at line 52 of file BESDapResponseBuilder.h.
|
protected |
DAP4 Constraint expression.
Definition at line 53 of file BESDapResponseBuilder.h.
|
protected |
Definition at line 50 of file BESDapResponseBuilder.h.
|
protected |
Response timeout after N seconds.
Definition at line 56 of file BESDapResponseBuilder.h.
|
protected |
Definition at line 73 of file BESDapResponseBuilder.h.
|
protected |
If set (i.e.
non-null) then the client has asked for the result to be stored for later retrieval. The value is the service URL used to construct the stored result access URL to be returned to the client. An empty string (length=0) means the client didn't supply a store_result async parameter
Definition at line 70 of file BESDapResponseBuilder.h.
|
protected |
The BTP functions, extracted from the CE.
Definition at line 55 of file BESDapResponseBuilder.h.