34 #include <mime_util.h>
35 #include <D4BaseTypeFactory.h>
72 bool NCMLRequestHandler::_global_attributes_container_name_set =
false;
73 string NCMLRequestHandler::_global_attributes_container_name =
"";
75 NCMLRequestHandler::NCMLRequestHandler(
const string &name) :
88 if (NCMLRequestHandler::_global_attributes_container_name_set ==
false) {
89 bool key_found =
false;
94 NCMLRequestHandler::_global_attributes_container_name_set =
true;
96 NCMLRequestHandler::_global_attributes_container_name = value;
126 throw BESInternalError(
"couldn't find the catalog storage", __FILE__, __LINE__);
131 string new_sym = sym_name +
"_location1";
136 throw BESInternalError(
"couldn't find the container" + sym_name, __FILE__, __LINE__);
164 auto_ptr<BESDapResponse> loaded_bdds = parser.
parse(filename, DDSLoader::eRT_RequestDDX);
166 if (!(loaded_bdds.get())) {
167 throw BESInternalError(
"Null BESDDSResponse in ncml DAS handler.", __FILE__, __LINE__);
179 BESDEBUG(
"ncml",
"Creating DAS response from the DDS/X..." << endl);
181 if (dds->get_dap_major() < 4)
197 auto_ptr<BESDapResponse> loaded_bdds(0);
201 loaded_bdds = parser.
parse(filename, DDSLoader::eRT_RequestDDX);
203 if (!loaded_bdds.get()) {
204 throw BESInternalError(
"Null BESDDSResonse in ncml DDS handler.", __FILE__, __LINE__);
213 DDS *dds_out = bdds_out->
get_dds();
216 if (dds->get_dap_major() < 4)
232 dds_out->filename(name_path(filename));
233 dds_out->set_dataset_name(name_path(filename));
245 "NCMLRequestHandler::ncml_build_data(): expected BESDataDDSResponse* but didn't get it!!");
251 parser.
parseInto(filename, DDSLoader::eRT_RequestDataDDS, dataResponse);
265 dds->filename(name_path(filename));
266 dds->set_dataset_name(name_path(filename));
278 auto_ptr<BESDapResponse> loaded_bdds(0);
282 loaded_bdds = parser.
parse(data_path, DDSLoader::eRT_RequestDDX);
283 if (!loaded_bdds.get())
throw BESInternalError(
"Null BESDDSResonse in ncml DDS handler.", __FILE__, __LINE__);
286 dds->filename(data_path);
287 dds->set_dataset_name(data_path);
289 catch (InternalErr &e) {
290 throw BESDapError(e.get_error_message(),
true, e.get_error_code(), __FILE__, __LINE__);
293 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
296 throw BESDapError(
"Caught unknown error build ** DMR response",
true, unknown_error, __FILE__, __LINE__);
308 dmr->set_factory(
new D4BaseTypeFactory);
309 dmr->build_using_dds(*dds);
325 if (!info)
throw InternalErr(__FILE__, __LINE__,
"Expected a BESVersionInfo instance");
329 info->
add_module(MODULE_NAME, MODULE_VERSION);
336 if (!info)
throw InternalErr(__FILE__, __LINE__,
"Expected a BESVersionInfo instance");
340 map<string, string> attrs;
341 attrs[
"name"] = MODULE_NAME ;
342 attrs[
"version"] = MODULE_VERSION ;
347 list<string> services;
349 if (services.size() > 0) {
351 attrs[
"handles"] = handles;
363 strm <<
BESIndent::LMarg <<
"NCMLRequestHandler::dump - (" << (
void *)
this <<
")" << endl;
brief represents simple text information in a response object, such as version and help inforamtion...
virtual void dump(ostream &strm) const
dumps information about this object
string get_constraint() const
retrieve the constraint expression for this container
static void copyVariablesAndAttributesInto(libdap::DDS *dds_out, const libdap::DDS &dds_in)
Make a deep copy of the global attributes and variables within dds_in into *dds_out.
provides persistent storage for data storage information represented by a container.
#define DAP4DATA_RESPONSE
exception thrown if inernal error encountered
static const std::string DOC_WIKI_URL
URL with the location of the documentation Wiki.
virtual BESContainerStorage * find_persistence(const string &persist_name)
find the persistence store with the given name
string get_symbolic_name() const
retrieve the symbolic name for this container
Represents an OPeNDAP DDS DAP2 data object within the BES.
virtual BESContainer * look_for(const string &sym_name)=0
looks for a container in this persistent store
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
static string get_global_attributes_container_name()
static bool ncml_build_vers(BESDataHandlerInterface &dhi)
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
virtual void set_dap4_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
static libdap::DDS * getDDSFromEitherResponse(BESDapResponse *response)
Return the DDS* for the given response object.
#define NCML_ASSERT_MSG(cond, msg)
virtual string access()=0
returns the true name of this container
virtual void set_dap4_function(BESDataHandlerInterface &dhi)
set the constraint depending on the context
informational response object
static string implode(const list< string > &values, char delim)
implode a list of values into a single string delimited by delim
virtual BESResponseObject * get_response_object()
return the current response object
static BESServiceRegistry * TheRegistry()
BESResponseHandler * response_handler
Provides a mechanism for accessing container information from different container stores registered w...
static bool ncml_build_dds(BESDataHandlerInterface &dhi)
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
static ostream & LMarg(ostream &strm)
Represents an OPeNDAP DMR DAP4 data object within the BES.
error object created from libdap error objects and can handle those errors
static bool ncml_build_das(BESDataHandlerInterface &dhi)
virtual void add_container(const string &sym_name, const string &real_name, const string &type)=0
adds a container with the provided information
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
virtual ~NCMLRequestHandler(void)
static bool ncml_build_data(BESDataHandlerInterface &dhi)
void parseInto(const string &ncmlFilename, agg_util::DDSLoader::ResponseType responseType, BESDapResponse *response)
Same as parse, but the response object to parse into is passed down by the caller rather than created...
Represents a specific data type request handler.
static void populateDASFromDDS(libdap::DAS *das, const libdap::DDS &dds_const)
Given we have a valid attribute tree inside of the DDS, recreate it in the DAS.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
static BESRequestHandlerList * TheList()
Structure storing information used by the BES to handle the request.
static BESContainerStorageList * TheList()
map< string, string > data
the map of string data that will be required for the current request.
virtual void execute_current(BESDataHandlerInterface &dhi)
Execute a single method for the current container that will fill in the response object rather than i...
static void hackGlobalAttributesForDAP2(libdap::AttrTable &global_attributes, const std::string &global_container_name)
virtual void add_data(const string &s)
add data to this informational object.
virtual bool add_handler(const string &handler_name, p_request_handler handler_method)
add a handler method to the request handler that knows how to fill in a specific response object ...
Represents an OPeNDAP DAS DAP2 data object within the BES.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
virtual bool del_container(const string &s_name)=0
removes a container with the given symbolic name
A container is something that holds data.
static bool ncml_build_help(BESDataHandlerInterface &dhi)
static BESKeys * TheKeys()
virtual void dump(ostream &strm) const
dumps information about this object
virtual void add_module(const string &n, const string &v)
Abstract base class representing a specific set of information in response to a request to the BES...
static const std::string NCML_NAME
The name used to specify an ncml file.
static bool ncml_build_dmr(BESDataHandlerInterface &dhi)
auto_ptr< BESDapResponse > parse(const string &ncmlFilename, agg_util::DDSLoader::ResponseType type)
Parse the NcML filename, returning a newly allocated DDS response containing the underlying dataset t...
BESContainer * container
pointer to current container in this interface
virtual void end_tag(const string &tag_name)
virtual void services_handled(const string &handler, list< string > &services)
returns the list of servies provided by the handler in question