56 GatewayContainer::GatewayContainer(
const string &sym_name,
57 const string &real_name,
const string &type) :
58 BESContainer(sym_name, real_name, type), _remoteResource(0) {
71 for (; i != e && !done; i++) {
72 if ((*i).length() <= use_real_name.length()) {
73 if (use_real_name.substr(0, (*i).length()) == (*i)) {
79 string err = (string)
"The specified URL " + real_name
80 +
" does not match any of the accessible services in"
87 BESContainer(copy_from), _remoteResource(copy_from._remoteResource) {
90 if (_remoteResource) {
91 string err = (string)
"The Container has already been accessed, "
92 +
"can not create a copy of this container.";
98 if (copy_to._remoteResource) {
99 string err = (string)
"The Container has already been accessed, "
100 +
"can not duplicate this resource.";
103 copy_to._remoteResource = _remoteResource;
115 if (_remoteResource) {
127 BESDEBUG(
"gateway",
"GatewayContainer::access() - BEGIN" << endl);
135 (
string)
"BES.CachePrefix", (
string)
"BES.CacheSize");
137 BESDEBUG(
"gateway",
"GatewayContainer::access() - Accessing " << url << endl);
140 if (type ==
"gateway")
143 if(!_remoteResource) {
144 BESDEBUG(
"gateway",
"GatewayContainer::access() - Building new RemoteResource." << endl );
148 BESDEBUG(
"gateway",
"GatewayContainer::access() - Located remote resource." << endl );
152 BESDEBUG(
"gateway",
"GatewayContainer::access() - Using local cache file: " << cachedResource << endl );
154 type = _remoteResource->
getType();
156 BESDEBUG(
"gateway",
"GatewayContainer::access() - Type: " << type << endl );
159 BESDEBUG(
"gateway",
"GatewayContainer::access() - Done accessing " <<
get_real_name() <<
" returning cached file " << cachedResource << endl);
160 BESDEBUG(
"gateway",
"GatewayContainer::access() - Done accessing " << *
this << endl);
161 BESDEBUG(
"gateway",
"GatewayContainer::access() - END" << endl);
163 return cachedResource;
175 if (_remoteResource) {
176 BESDEBUG(
"gateway",
"GatewayContainer::release() - Releasing RemoteResource" << endl);
177 delete _remoteResource;
181 BESDEBUG(
"gateway",
"done releasing gateway response" << endl);
197 if (_remoteResource) {
205 vector<string>::const_iterator i = hdrs->begin();
206 vector<string>::const_iterator e = hdrs->end();
207 for (; i != e; i++) {
208 string hdr_line = (*i);
209 strm << BESIndent::LMarg << hdr_line << endl;
213 strm <<
"none" << endl;
vector< string > * getResponseHeaders()
Returns a vector of HTTP headers received along with the response from the request for the remote res...
exception thrown if inernal error encountered
void _duplicate(GatewayContainer ©_to)
static vector< string > WhiteList
string get_container_type() const
retrieve the type of data this container holds, such as cedar or netcdf.
virtual void dump(ostream &strm) const
dumps information about this object
error thrown if there is a user syntax error in the request or any other user error ...
void set_container_type(const string &type)
set the type of data that this container represents, such as cedar or netcdf.
virtual string access()
access the remote target response by making the remote request
Implementation of a caching mechanism for compressed data.
static ostream & LMarg(ostream &strm)
string getCacheFileName()
Returns the (read-locked) cache file name on the local system in which the content of the remote reso...
This class encapsulates a remote resource available via HTTP GET.
static void url_explode(const string &url_str, BESUtil::url &url_parts)
Given a url, break the url into its different parts.
string get_real_name() const
retrieve the real name for this container, such as a file name.
string getType()
Returns the DAP type string of the RemoteHttpResource.
void _duplicate(BESContainer ©_to)
duplicate this instance into the passed container
virtual bool release()
release the resources
static string url_create(BESUtil::url &url_parts)
virtual void dump(ostream &strm) const
dumps information about this object
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
A container is something that holds data.
void retrieveResource()
This method will check the cache for the resource.
virtual ~GatewayContainer()
Container representing a remote request.
virtual BESContainer * ptr_duplicate()
pure abstract method to duplicate this instances of BESContainer
static BESKeys * TheKeys()
static BESCache3 * get_instance()
Get an instance of the BESCache3 object.