CSVModule.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <iostream>
00036
00037 using std::endl ;
00038
00039 #include "CSVModule.h"
00040 #include "BESRequestHandlerList.h"
00041 #include "CSVRequestHandler.h"
00042 #include "BESLog.h"
00043 #include "BESResponseHandlerList.h"
00044 #include "BESResponseNames.h"
00045 #include "CSVResponseNames.h"
00046
00047 #include "BESContainerStorageList.h"
00048 #include "BESContainerStorageCatalog.h"
00049 #include "BESCatalogDirectory.h"
00050 #include "BESCatalogList.h"
00051
00052 #include "BESDebug.h"
00053
00054 void
00055 CSVModule::initialize( const string &modname )
00056 {
00057 BESDEBUG( "csv", "Initializing CSV Module " << modname << endl )
00058
00059 BESDEBUG( "csv", " adding " << modname << " request handler" << endl )
00060 BESRequestHandlerList::TheList()->
00061 add_handler( modname, new CSVRequestHandler( modname ) ) ;
00062
00063 BESDEBUG( "csv", " adding " << CSV_CATALOG << " catalog" << endl )
00064 if( !BESCatalogList::TheCatalogList()->find_catalog( CSV_CATALOG ) )
00065 {
00066 BESCatalogList::TheCatalogList()->
00067 add_catalog(new BESCatalogDirectory( CSV_CATALOG ) ) ;
00068 }
00069 else
00070 {
00071 BESDEBUG( "csv", " catalog already exists, skipping" << endl )
00072 }
00073
00074 BESDEBUG( "csv", " adding Catalog Container Storage" << endl )
00075 if( !BESContainerStorageList::TheList()->find_persistence( CSV_CATALOG ) )
00076 {
00077 BESContainerStorageList::TheList()->
00078 add_persistence( new BESContainerStorageCatalog( CSV_CATALOG ) ) ;
00079 }
00080 else
00081 {
00082 BESDEBUG( "csv", " storage already exists, skipping" << endl )
00083 }
00084
00085 BESDEBUG( "csv", " adding csv debug context" << endl )
00086 BESDebug::Register( "csv" ) ;
00087
00088 BESDEBUG( "csv", "Done Initializing CSV Handler " << modname << endl )
00089 }
00090
00091 void
00092 CSVModule::terminate( const string &modname )
00093 {
00094 BESDEBUG( "csv", "Cleaning CSV Module" << modname << endl )
00095
00096 BESDEBUG( "csv", " removing " << modname << " request handler" << endl )
00097 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler( modname ) ;
00098 if( rh ) delete rh ;
00099
00100 BESDEBUG( "csv", " removing catalog container storage" << CSV_CATALOG << endl )
00101 BESContainerStorageList::TheList()->del_persistence( CSV_CATALOG ) ;
00102
00103 BESDEBUG( "csv", " removing " << CSV_CATALOG << " catalog" << endl )
00104 BESCatalogList::TheCatalogList()->del_catalog( CSV_CATALOG ) ;
00105
00106 BESDEBUG( "csv", "Done Cleaning CSV Module" << modname << endl )
00107 }
00108
00109 extern "C"
00110 {
00111 BESAbstractModule *maker()
00112 {
00113 return new CSVModule ;
00114 }
00115 }
00116
00117 void
00118 CSVModule::dump( ostream &strm ) const
00119 {
00120 strm << BESIndent::LMarg << "CSVModule::dump - ("
00121 << (void *)this << ")" << endl ;
00122 }
00123