38 #include <BESResponseHandler.h>
39 #include <BESResponseNames.h>
40 #include <BESVersionInfo.h>
41 #include <BESDataNames.h>
42 #include <BESDataNames.h>
43 #include <TheBESKeys.h>
47 #include "FONcRequestHandler.h"
49 #define FONC_TEMP_DIR "/tmp"
50 #define FONC_TEMP_DIR_KEY "FONc.Tempdir"
55 #define FONC_BYTE_TO_SHORT true
56 #define FONC_BYTE_TO_SHORT_KEY "FONc.ByteToShort"
58 #define FONC_USE_COMP true
59 #define FONC_USE_COMP_KEY "FONc.UseCompression"
61 #define FONC_CHUNK_SIZE 4096
62 #define FONC_CHUNK_SIZE_KEY "FONc.ChunkSize"
64 #define FONC_CLASSIC_MODEL true
65 #define FONC_CLASSIC_MODEL_KEY "FONc.ClassicModel"
67 std::string FONcRequestHandler::temp_dir;
68 bool FONcRequestHandler::byte_to_short;
69 bool FONcRequestHandler::use_compression;
70 int FONcRequestHandler::chunk_size;
71 bool FONcRequestHandler::classic_model;
84 static void read_key_value(
const string &key_name,
bool &key,
const bool default_value)
86 bool key_found =
false;
92 key = (value ==
"true" || value ==
"yes");
99 static void read_key_value(
const string &key_name,
string &key,
const string &default_value)
101 bool key_found =
false;
105 if (key[key.length() - 1] ==
'/') key.erase(key.length() - 1);
112 static void read_key_value(
const string &key_name,
int &key,
const int default_value)
114 bool key_found =
false;
119 istringstream iss(value);
121 if (iss.eof() || iss.bad() || iss.fail()) key = default_value;
143 if (FONcRequestHandler::temp_dir.empty()) {
144 read_key_value(FONC_TEMP_DIR_KEY, FONcRequestHandler::temp_dir, FONC_TEMP_DIR);
148 read_key_value(FONC_BYTE_TO_SHORT_KEY, FONcRequestHandler::byte_to_short, FONC_BYTE_TO_SHORT);
150 read_key_value(FONC_USE_COMP_KEY, FONcRequestHandler::use_compression, FONC_USE_COMP);
152 read_key_value(FONC_CHUNK_SIZE_KEY, FONcRequestHandler::chunk_size, FONC_CHUNK_SIZE);
154 read_key_value(FONC_CLASSIC_MODEL_KEY, FONcRequestHandler::classic_model, FONC_CLASSIC_MODEL);
156 BESDEBUG(
"fonc",
"FONcRequestHandler::temp_dir: " << FONcRequestHandler::temp_dir << endl);
157 BESDEBUG(
"fonc",
"FONcRequestHandler::byte_to_short: " << FONcRequestHandler::byte_to_short << endl);
158 BESDEBUG(
"fonc",
"FONcRequestHandler::use_compression: " << FONcRequestHandler::use_compression << endl);
159 BESDEBUG(
"fonc",
"FONcRequestHandler::chunk_size: " << FONcRequestHandler::chunk_size << endl);
160 BESDEBUG(
"fonc",
"FONcRequestHandler::classic_model: " << FONcRequestHandler::classic_model << endl);
187 string key =
"FONc.Reference";
190 if (ref.empty()) ref =
"http://docs.opendap.org/index.php/BES_-_Modules_-_FileOut_Netcdf";
191 map<string, string> attrs;
192 attrs[
"name"] = MODULE_NAME;
193 attrs[
"version"] = MODULE_VERSION;
194 attrs[
"reference"] = ref;
195 info->begin_tag(
"module", &attrs);
196 info->end_tag(
"module");
214 info->add_module(MODULE_NAME, MODULE_VERSION);
228 strm << BESIndent::LMarg <<
"FONcRequestHandler::dump - ("
229 << (
void *)
this <<
")" << endl ;
230 BESIndent::Indent() ;
232 BESIndent::UnIndent() ;