33#include <libdap/DMR.h>
34#include <libdap/XMLWriter.h>
38#include "BESInternalFatalError.h"
40#include "DmrppParserSax2.h"
41#include "DmrppTypeFactory.h"
42#include "DmrppMetadataStore.h"
46#define DEBUG_KEY "dmrpp_store"
47#define MAINTAIN_STORE_SIZE_EVEN_WHEN_UNLIMITED 0
50#define AT_EXIT(x) atexit((x))
64#undef SYMETRIC_ADD_RESPONSES
73bool DmrppMetadataStore::d_enabled =
true;
110 if (d_enabled && d_instance == 0) {
111 d_instance =
new DmrppMetadataStore(cache_dir, prefix, size);
112 d_enabled = d_instance->cache_enabled();
117 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::"<<__func__ <<
"() - " <<
"Cache is DISABLED"<< endl);
120 AT_EXIT(delete_instance);
122 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::"<<__func__ <<
"() - " <<
"Cache is ENABLED"<< endl);
126 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::get_instance(dir,prefix,size) - d_instance: " << d_instance << endl);
140 if (d_enabled && d_instance == 0) {
141 d_instance =
new DmrppMetadataStore();
142 d_enabled = d_instance->cache_enabled();
146 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::"<<__func__ <<
"() - " <<
"Cache is DISABLED"<< endl);
149 AT_EXIT(delete_instance);
151 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::"<<__func__ <<
"() - " <<
"Cache is ENABLED"<< endl);
155 BESDEBUG(DEBUG_KEY,
"DmrppMetadataStore::get_instance() - d_instance: " << (
void *) d_instance << endl);
161void DmrppMetadataStore::StreamDMRpp::operator()(ostream &os)
169 dmrpp->set_print_chunks(
true);
171 dmrpp->print_dap4(xml);
176 throw BESInternalFatalError(
"StreamDMRpp output operator call with non-DMRpp instance.", __FILE__, __LINE__);
196 bool stored_dmrpp =
false;
198 d_ledger_entry = string(
"add DMR++ ").append(name);
209 return(stored_dmr && stored_dmrpp);
213DmrppMetadataStore::add_dmrpp_response(libdap::DMR *dmrpp,
const std::string &name)
215 bool stored_dmrpp =
false;
217 d_ledger_entry = string(
"add DMR++ ").append(name);
219 StreamDMRpp write_the_dmrpp_response(dmrpp);
228 return(stored_dmrpp);
247 unique_ptr<DMRpp> dmrpp(
new DMRpp(&dmrpp_btf,
"mds"));
250 parser.
intern(oss.str(), dmrpp.get());
252 dmrpp->set_factory(0);
254 return dmrpp.release();
276 unique_ptr<DMRpp> dmrpp(
new DMRpp(&dmrpp_btf,
"mds"));
279 parser.
intern(oss.str(), dmrpp.get());
281 dmrpp->set_factory(0);
283 return dmrpp.release();
exception thrown if an internal error is found and is fatal to the BES
Provide a way to print the DMR++ response.
void intern(std::istream &f, libdap::DMR *dest_dmr)