libdap++
Updated for version 3.11.7
|
Holds information about the link from a DAP2 client to a dataset. More...
#include <Connect.h>
Public Member Functions | |
virtual string | CE () |
Get the Connect's constraint expression. More... | |
Connect (const string &name, string uname="", string password="") throw (Error, InternalErr) | |
Create an instance of Connect. More... | |
string | get_protocol () |
string | get_version () |
bool | is_cache_enabled () |
bool | is_local () |
virtual void | read_data (DataDDS &data, Response *rs) |
Read data which is preceded by MIME headers. This method works for both data dds and data ddx responses. More... | |
virtual void | read_data (DDS &data, Response *rs) |
virtual void | read_data_no_mime (DataDDS &data, Response *rs) |
Read data from a file which does not have response MIME headers. This method is a companion to read_data(). While read_data() assumes that the response has MIME headers, this method does not. If you call this with a Response that does contain headers, it will throw an Error (and the message is likely to be inscrutable). More... | |
virtual void | read_data_no_mime (DDS &data, Response *rs) |
virtual void | request_das (DAS &das) |
Get the DAS from a server. More... | |
virtual void | request_das_url (DAS &das) |
Get the DAS from a server. More... | |
virtual void | request_data (DataDDS &data, string expr="") |
Get the DAS from a server. More... | |
virtual void | request_data_ddx (DataDDS &data, string expr="") |
virtual void | request_data_ddx_url (DataDDS &data) |
virtual void | request_data_url (DataDDS &data) |
Get the DAS from a server. More... | |
virtual void | request_dds (DDS &dds, string expr="") |
Get the DDS from a server. More... | |
virtual void | request_dds_url (DDS &dds) |
Get the DDS from a server. More... | |
virtual void | request_ddx (DDS &dds, string expr="") |
Get the DDX from a server. More... | |
virtual void | request_ddx_url (DDS &dds) |
The 'url' version of request_ddx. More... | |
virtual string | request_protocol () |
virtual string | request_version () |
void | set_accept_deflate (bool deflate) |
void | set_cache_enabled (bool enabled) |
void | set_credentials (string u, string p) |
Set the credentials for responding to challenges while dereferencing URLs. More... | |
void | set_xdap_accept (int major, int minor) |
void | set_xdap_protocol (int major, int minor) |
virtual string | URL (bool CE=true) |
Get the object's URL. More... | |
virtual | ~Connect () |
Protected Member Functions | |
Suppress the C++ defaults for these. | |
Connect () | |
Connect (const Connect &) | |
Connect & | operator= (const Connect &) |
Connect objects are used as containers for information pertaining to the connection a user program makes to a dataset. The dataset may be either local (for example, a file on the user's own computer) or a remote dataset. In the latter case a DAP2 URL will be used to reference the dataset, instead of a filename.
Connect contains methods which can be used to read the DAP2 DAS and DDS objects from the remote dataset as well as reading data. The class understands in a rudimentary way how DAP2 constraint expressions are formed and how to manage them.
Connect also provides additional services such as automatic decompression of compressed data and and error processing.
|
inlineprotected |
libdap::Connect::Connect | ( | const string & | n, |
string | uname = "" , |
||
string | password = "" |
||
) | |||
throw | ( | Error, | |
InternalErr | |||
) |
The Connect constructor requires a name
, which is the URL to which the connection is to be made.
n | The URL for the virtual connection. |
uname | Use this username for authentication. Null by default. |
password | Password to use for authentication. Null by default. |
Definition at line 348 of file Connect.cc.
References DBG, libdap::RCReader::instance(), and libdap::prune_spaces().
|
virtual |
Definition at line 395 of file Connect.cc.
References DBG2.
|
virtual |
Return the constraint expression (CE) part of the Connect URL. Note that this CE is supplied as part of the URL passed to the Connect's constructor. It is not the CE passed to the request_data()
function.
Definition at line 1186 of file Connect.cc.
|
inline |
|
inline |
Return the protocol/implementation version of the most recent response. This is a poorly designed method, but it returns information that is useful when used correctly. Before a response is made, this contains the string "unknown." This should ultimately hold the protocol version; it currently holds the implementation version.
@see get_protocol()
Definition at line 191 of file Connect.h.
Referenced by main().
bool libdap::Connect::is_cache_enabled | ( | ) |
Definition at line 1240 of file Connect.cc.
References DBG, DBGN, and libdap::HTTPConnect::is_cache_enabled().
bool libdap::Connect::is_local | ( | ) |
Definition at line 1143 of file Connect.cc.
Referenced by main().
data | Result. |
rs | Read from this Response object. |
Definition at line 1032 of file Connect.cc.
References read_data_no_mime().
Referenced by libdap::ResponseBuilder::get_cached_data_ddx(), main(), and libdap::ResponseBuilder::send_data().
Definition at line 1043 of file Connect.cc.
References read_data_no_mime().
data | Result. |
rs | Read from this Response object. |
Definition at line 1099 of file Connect.cc.
References libdap::dap4_data_ddx, libdap::dods_data, libdap::Response::get_protocol(), libdap::DataDDS::get_protocol(), libdap::Response::get_type(), libdap::Response::get_version(), and libdap::unknown_type.
Referenced by main(), and read_data().
Definition at line 1119 of file Connect.cc.
References libdap::dap4_data_ddx, libdap::dods_data, libdap::DDS::get_dap_version(), libdap::Response::get_protocol(), libdap::Response::get_type(), libdap::Response::get_version(), and libdap::unknown_type.
|
virtual |
Reads the DAS corresponding to the dataset in the Connect object's URL. Although DAP does not support using CEs with DAS requests, if present in the Connect object's instance, they will be escaped and passed as the query string of the request.
das | Result. |
Definition at line 479 of file Connect.cc.
References libdap::dods_das, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::id2www_ce(), libdap::Error::parse(), libdap::DAS::parse(), and libdap::web_error.
Referenced by main().
|
virtual |
Reads the DAS corresponding to the dataset in the Connect object's URL. Although DAP does not support using CEs with DAS requests, if present in the Connect object's instance, they will be escaped and passed as the query string of the request.
Different from request_das method in that this method uses the URL as given without attaching .das or projections or selections.
das | Result. |
Definition at line 542 of file Connect.cc.
References libdap::dods_das, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::Error::parse(), libdap::DAS::parse(), and libdap::web_error.
|
virtual |
Reads the DataDDS object corresponding to the dataset in the Connect object's URL. If present in the Connect object's instance, a CE will be escaped, combined with expr
and passed as the query string of the request. The result is a DataDDS which contains the data values bound to variables.
data | Result. |
expr | Send this constraint expression to the server. |
Definition at line 892 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_version(), and libdap::id2www_ce().
Referenced by main().
|
virtual |
Definition at line 964 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_version(), and libdap::id2www_ce().
Referenced by main().
|
virtual |
Definition at line 998 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), and libdap::Response::get_version().
|
virtual |
Reads the DataDDS object corresponding to the dataset in the Connect object's URL. If present in the Connect object's instance, a CE will be escaped, combined with expr
and passed as the query string of the request. The result is a DataDDS which contains the data values bound to variables.
Different from request_data in that this method uses the syntax of the new OPeNDAP server commands using dispatch
data | Result. |
Definition at line 943 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), and libdap::Response::get_version().
|
virtual |
Reads the DDS corresponding to the dataset in the Connect object's URL. If present in the Connect object's instance, a CE will be escaped, combined with expr
and passed as the query string of the request.
dds | Result. |
expr | Send this constraint expression to the server. |
Definition at line 605 of file Connect.cc.
References libdap::dods_dds, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::id2www_ce(), libdap::Error::parse(), libdap::DDS::parse(), and libdap::web_error.
Referenced by main().
|
virtual |
Reads the DDS corresponding to the dataset in the Connect object's URL. If present in the Connect object's instance, a CE will be escaped, combined with expr
and passed as the query string of the request.
Different from request_dds method above in that this method assumes URL is complete and does not add anything to the command, such as .dds or projections or selections.
dds | Result. |
Definition at line 683 of file Connect.cc.
References libdap::dods_dds, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::Error::parse(), libdap::DDS::parse(), and libdap::web_error.
|
virtual |
Reads the DDX corresponding to the dataset in the Connect object's URL. If present in the Connect object's instance, a CE will be escaped, combined with expr
and passed as the query string of the request.
dds | Result. |
expr | Send this constraint expression to the server. |
Definition at line 743 of file Connect.cc.
References libdap::dap4_ddx, libdap::dods_ddx, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::DDS::get_factory(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::id2www_ce(), libdap::DDXParser::intern_stream(), libdap::long_to_string(), libdap::Error::parse(), and libdap::web_error.
Referenced by main().
|
virtual |
Definition at line 817 of file Connect.cc.
References libdap::dap4_ddx, libdap::dods_ddx, libdap::dods_error, libdap::HTTPConnect::fetch_url(), libdap::DDS::get_factory(), libdap::Response::get_protocol(), libdap::Response::get_stream(), libdap::Response::get_type(), libdap::Response::get_version(), libdap::DDXParser::intern_stream(), libdap::long_to_string(), libdap::Error::parse(), and libdap::web_error.
|
virtual |
Get protocol version information from the server. This is a new method which will ease the transition to DAP 4. Note that this method returns the version of the DAP protocol implemented by the server. The request_version() method returns the server's version number, not the DAP protocol version.
Definition at line 448 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_version(), and libdap::id2www_ce().
Referenced by main().
|
virtual |
Get version information from the server. This is a new method which will ease the transition to DAP 4.
Definition at line 413 of file Connect.cc.
References libdap::HTTPConnect::fetch_url(), libdap::Response::get_protocol(), libdap::Response::get_version(), and libdap::id2www_ce().
void libdap::Connect::set_accept_deflate | ( | bool | deflate | ) |
Set the accept deflate property.
deflate | True if the client can accept compressed responses, False otherwise. |
Definition at line 1211 of file Connect.cc.
References libdap::HTTPConnect::set_accept_deflate().
Referenced by main().
void libdap::Connect::set_cache_enabled | ( | bool | cache | ) |
Disable any further use of the client-side cache. In a future version of this software, this should be handled so that the www library is not initialized with the cache running by default.
Definition at line 1233 of file Connect.cc.
References libdap::HTTPConnect::set_cache_enabled().
void libdap::Connect::set_credentials | ( | string | u, |
string | p | ||
) |
u | The username. |
p | The password. |
Definition at line 1201 of file Connect.cc.
References libdap::HTTPConnect::set_credentials().
void libdap::Connect::set_xdap_accept | ( | int | major, |
int | minor | ||
) |
void libdap::Connect::set_xdap_protocol | ( | int | major, |
int | minor | ||
) |
Set the XDAP-Accept property/header. This is used to send to a server the (highest) DAP protocol version number that this client understands.
major | The client dap protocol major version |
minor | The client dap protocol minor version |
Definition at line 1223 of file Connect.cc.
References libdap::HTTPConnect::set_xdap_protocol().
Referenced by main().
|
virtual |
Return the Connect object's URL in a string. The URL was set by the class constructor, and may not be reset. If you want to open another URL, you must create another Connect object. There is a Connections class created to handle the management of multiple Connect objects.
ce | If TRUE, the returned URL will include any constraint expression enclosed with the Connect object's URL (including the ? ). If FALSE, any constraint expression will be removed from the URL. The default is TRUE. |
Definition at line 1165 of file Connect.cc.
Referenced by main().