34 #include <BESCatalogDirectory.h> 35 #include <BESCatalogList.h> 36 #include <BESContainerStorageList.h> 37 #include <BESFileContainerStorage.h> 38 #include <BESDapService.h> 40 #include <BESRequestHandlerList.h> 41 #include <BESResponseHandlerList.h> 42 #include <BESResponseNames.h> 43 #include <BESXMLCommand.h> 44 #include <BESContainerStorageList.h> 45 #include <TheBESKeys.h> 46 #include <BESInternalError.h> 48 #include "NCMLModule.h" 49 #include "NCMLRequestHandler.h" 50 #include "NCMLResponseNames.h" 54 #include "NCMLCacheAggXMLCommand.h" 55 #include "NCMLContainerStorage.h" 61 static const char*
const NCML_CATALOG =
"catalog";
63 void NCMLModule::initialize(
const string &modname)
65 BESDEBUG(modname,
"Initializing NCML Module " << modname << endl);
73 addCommandAndResponseHandlers(modname);
82 if (!BESContainerStorageList::TheList()->ref_persistence(NCML_CATALOG)) {
89 BESContainerStorageList::TheList()->
add_persistence(
new NCMLContainerStorage(modname));
91 const string key =
"NCML.TempDirectory";
95 if (!found || val.empty() || val ==
"/") {
96 string err = (string)
"The parameter " + key +
" must be set to use the NCML module";
100 NCMLContainerStorage::NCML_TempDir = val;
105 BESDEBUG(modname,
"Done Initializing NCML Module " << modname << endl);
108 void NCMLModule::terminate(
const string &modname)
110 BESDEBUG(modname,
"Cleaning NCML module " << modname << endl);
118 removeCommandAndResponseHandlers();
130 BESDEBUG(modname,
"Done Cleaning NCML module " << modname << endl);
142 strm << BESIndent::LMarg <<
"NCMLModule::dump - (" << (
void *)
this <<
")" << endl;
147 void NCMLModule::addCommandAndResponseHandlers(
const string& modname)
149 BESDEBUG(modname,
"Adding module extensions..." << endl);
150 addCacheAggCommandAndResponseHandlers(modname);
151 BESDEBUG(modname,
"... done adding module extensions." << endl);
154 void NCMLModule::addCacheAggCommandAndResponseHandlers(
const string& modname)
158 BESDEBUG( modname,
" adding " 160 <<
" response handler" << endl );
161 BESResponseHandlerList::TheList()->
add_handler(cmdName, NCMLCacheAggResponseHandler::makeInstance);
163 BESDEBUG(modname,
" adding " << cmdName <<
" command" << endl );
167 void NCMLModule::removeCommandAndResponseHandlers()
170 removeCacheAggCommandAndResponseHandlers();
174 void NCMLModule::removeCacheAggCommandAndResponseHandlers()
179 <<
" response handler" << endl );
exception thrown if inernal error encountered
static void Register(const std::string &flagName)
register the specified debug flag
virtual void dump(ostream &strm) const
dump the contents of this object to the specified ostream
virtual bool deref_persistence(const std::string &persist_name)
dereference a persistent store in the list.
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...
virtual bool add_catalog(BESCatalog *catalog)
adds the specified catalog to the list
virtual bool add_handler(const std::string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
static const std::string CACHE_AGG_RESPONSE
static TheBESKeys * TheKeys()
Catalogs from a directory structure.
virtual bool add_handler(const string &handler, p_response_handler handler_method)
add a response handler to the list
Represents a specific data type request handler.
static void del_command(const std::string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const std::string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.
virtual bool remove_handler(const string &handler)
removes a response handler from the list
implementation of BESContainerStorage that represents a data within a catalog repository
static BESCatalogList * TheCatalogList()
Get the singleton BESCatalogList instance.
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
static const std::string NCML_NAME
static void handle_dap_service(const string &handler)
static function to register a handler to handle the dap services