Connect Class Reference

Holds information about the link from a DAP2 client to a dataset. More...

#include <Connect.h>

Inheritance diagram for Connect:

Inheritance graph
[legend]
Collaboration diagram for Connect:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual string CE ()
 Get the Connect's constraint expression.
 Connect (const string &name, string uname="", string password="") throw (Error, InternalErr)
 Create an instance of Connect.
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.
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).
virtual void request_das (DAS &das)
 Get the DAS from a server.
virtual void request_das_url (DAS &das)
 Get the DAS from a server.
virtual void request_data (DataDDS &data, string expr="")
 Get the DAS from a server.
virtual void request_data_url (DataDDS &data)
 Get the DAS from a server.
virtual void request_dds (DDS &dds, string expr="")
 Get the DDS from a server.
virtual void request_dds_url (DDS &dds)
 Get the DDS from a server.
virtual void request_ddx (DDS &dds, string expr="")
 Get the DDX from a server.
virtual void request_ddx_url (DDS &dds)
 The 'url' version of request_ddx.
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.
virtual string URL (bool CE=true)
 Get the object's URL.
virtual ~Connect ()

Protected Member Functions

Suppress the C++ defaults for these.
 Connect (const Connect &)
 Connect ()
Connectoperator= (const Connect &)

Detailed Description

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, transmission progress reports and error processing. Refer to the GUI and Error classes for more information about these features. See the DODSFilter class for information on servers that compress data.

Note:
Update: I removed the DEFAULT_BASETYPE_FACTORY switch because it caused more confusion than it avoided. See Trac #130.

The compile-time symbol DEFAULT_BASETYPE_FACTORY controls whether the old (3.4 and earlier) DDS and DataDDS constructors are supported. These constructors now use a default factory class (BaseTypeFactory, implemented by this library) to instantiate Byte, ..., Grid variables. To use the default ctor in your code you must also define this symbol. If you do choose to define this and fail to provide a specialization of BaseTypeFactory when your software needs one, you code may not link or may fail at run time. In addition to the older ctors for DDS and DataDDS, defining the symbol also makes some of the older methods in Connect available (because those methods require the older DDS and DataDDS ctors.

See also:
DDS

DAS

DODSFilter

Error

Author:
jhrg

Definition at line 132 of file Connect.h.


Constructor & Destructor Documentation

Connect::Connect (  )  [inline, protected]

Definition at line 153 of file Connect.h.

Connect::Connect ( const Connect  )  [inline, protected]

Definition at line 155 of file Connect.h.

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.

Parameters:
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 233 of file Connect.cc.

References DBG, RCReader::instance(), and prune_spaces().

Here is the call graph for this function:

Connect::~Connect (  )  [virtual]

Definition at line 280 of file Connect.cc.

References DBG2.


Member Function Documentation

string Connect::CE (  )  [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.

Returns:
A string containing the constraint expression (if any) submitted to the Connect object's constructor.

Definition at line 939 of file Connect.cc.

string Connect::get_protocol (  )  [inline]

Return the DAP protocol version of the most recent response. Before a response is made, this contains the string "2.0."

Definition at line 198 of file Connect.h.

Referenced by main().

string Connect::get_version (  )  [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 also:
get_protocol()
Deprecated:

Definition at line 190 of file Connect.h.

Referenced by main().

bool Connect::is_cache_enabled (  ) 

Definition at line 981 of file Connect.cc.

References DBG, DBGN, and HTTPConnect::is_cache_enabled().

Here is the call graph for this function:

bool Connect::is_local (  ) 

Definition at line 896 of file Connect.cc.

Referenced by main().

Connect& Connect::operator= ( const Connect  )  [inline, protected]

Definition at line 157 of file Connect.h.

void Connect::read_data ( DataDDS data,
Response rs 
) [virtual]

This is a place holder. A better implementation for reading objects from the local file store is to write FileConnect and have it support the same interface as HTTPConnect.

Note:
If you need the DataDDS to hold specializations of the type classes, be sure to include the factory class which will instantiate those specializations in the DataDDS. Either pass a pointer to the factory to DataDDS constructor or use the DDS::set_factory() method after the object is built.
See also:
read_data_no_mime()
Parameters:
data Result.
rs Read from this Response object.

Definition at line 867 of file Connect.cc.

References read_data_no_mime().

Referenced by main().

Here is the call graph for this function:

void Connect::read_data_no_mime ( DataDDS data,
Response rs 
) [virtual]

Parameters:
data Result.
rs Read from this Response object.

Definition at line 887 of file Connect.cc.

References Response::get_protocol(), and Response::get_version().

Referenced by main(), and read_data().

Here is the call graph for this function:

void Connect::request_das ( DAS das  )  [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.

Parameters:
das Result.

Reimplemented in AISConnect.

Definition at line 358 of file Connect.cc.

References dods_das, dods_error, HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), id2www_ce(), DAS::parse(), Error::parse(), and web_error.

Referenced by main(), and AISConnect::request_das().

Here is the call graph for this function:

void Connect::request_das_url ( DAS das  )  [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.

Parameters:
das Result.

Definition at line 427 of file Connect.cc.

References dods_das, dods_error, HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), DAS::parse(), Error::parse(), and web_error.

Here is the call graph for this function:

void Connect::request_data ( DataDDS data,
string  expr = "" 
) [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.

Note:
If you need the DataDDS to hold specializations of the type classes, be sure to include the factory class which will instantiate those specializations in the DataDDS. Either pass a pointer to the factory to DataDDS constructor or use the DDS::set_factory() method after the object is built.
Parameters:
data Result.
expr Send this constraint expression to the server.

Definition at line 780 of file Connect.cc.

References HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_version(), and id2www_ce().

Referenced by main().

Here is the call graph for this function:

void Connect::request_data_url ( DataDDS data  )  [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

Note:
If you need the DataDDS to hold specializations of the type classes, be sure to include the factory class which will instantiate those specializations in the DataDDS. Either pass a pointer to the factory to DataDDS constructor or use the DDS::set_factory() method after the object is built.
Parameters:
data Result.

Definition at line 830 of file Connect.cc.

References HTTPConnect::fetch_url(), Response::get_protocol(), and Response::get_version().

Here is the call graph for this function:

void Connect::request_dds ( DDS dds,
string  expr = "" 
) [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.

Note:
If you need the DDS to hold specializations of the type classes, be sure to include the factory class which will instantiate those specializations in the DDS. Either pass a pointer to the factory to DDS constructor or use the DDS::set_factory() method after the object is built.
Parameters:
dds Result.
expr Send this constraint expression to the server.

Definition at line 490 of file Connect.cc.

References dods_dds, dods_error, HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), id2www_ce(), DDS::parse(), Error::parse(), and web_error.

Referenced by main().

Here is the call graph for this function:

void Connect::request_dds_url ( DDS dds  )  [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.

Note:
If you need the DDS to hold specializations of the type classes, be sure to include the factory class which will instantiate those specializations in the DDS. Either pass a pointer to the factory to DDS constructor or use the DDS::set_factory() method after the object is built.
Parameters:
dds Result.

Definition at line 574 of file Connect.cc.

References dods_dds, dods_error, HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), DDS::parse(), Error::parse(), and web_error.

Here is the call graph for this function:

void Connect::request_ddx ( DDS dds,
string  expr = "" 
) [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.

Note:
A DDX is represented as XML on the wire but in memory libdap uses a DDS object with variables that hold their own attributes (the DDS itself holds the global attributes).
Parameters:
dds Result.
expr Send this constraint expression to the server.

Definition at line 634 of file Connect.cc.

References dap4_ddx, dods_error, HTTPConnect::fetch_url(), DDS::get_factory(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), id2www_ce(), DDS::parse(), Error::parse(), and web_error.

Referenced by main().

Here is the call graph for this function:

void Connect::request_ddx_url ( DDS dds  )  [virtual]

See also:
Connect::request_ddx.

Definition at line 709 of file Connect.cc.

References dap4_ddx, dods_error, HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_stream(), Response::get_type(), Response::get_version(), DDS::parse(), Error::parse(), and web_error.

Here is the call graph for this function:

string Connect::request_protocol (  )  [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.

Returns:
The DAP protocol version string.

Definition at line 328 of file Connect.cc.

References HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_version(), and id2www_ce().

Referenced by main().

Here is the call graph for this function:

string Connect::request_version (  )  [virtual]

Get version information from the server. This is a new method which will ease the transition to DAP 4.

Note:
Use request_protocol() to get the DAP protocol version.
Returns:
The DAP version string.
See also:
request_protocol()

Definition at line 298 of file Connect.cc.

References HTTPConnect::fetch_url(), Response::get_protocol(), Response::get_version(), and id2www_ce().

Here is the call graph for this function:

void Connect::set_accept_deflate ( bool  deflate  ) 

Set the accept deflate property.

Parameters:
deflate True if the client can accept compressed responses, False otherwise.

Definition at line 964 of file Connect.cc.

References HTTPConnect::set_accept_deflate().

Referenced by main().

Here is the call graph for this function:

void 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 974 of file Connect.cc.

References HTTPConnect::set_cache_enabled().

Here is the call graph for this function:

void Connect::set_credentials ( string  u,
string  p 
)

Parameters:
u The username.
p The password.
See also:
extract_auth_info()

Definition at line 954 of file Connect.cc.

References HTTPConnect::set_credentials().

Here is the call graph for this function:

string Connect::URL ( bool  ce = true  )  [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.

See also:
Connections
Returns:
A string containing the URL of the data to which the Connect object refers. If the object refers to local data, the function returns the null string.
Parameters:
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 918 of file Connect.cc.

Referenced by main(), and AISConnect::request_das().


The documentation for this class was generated from the following files:
Generated on Wed Jun 27 12:57:37 2007 for libdap++ by  doxygen 1.4.7