BESCatalogResponseHandler.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 #include "BESCatalogResponseHandler.h"
00034 #include "BESInfoList.h"
00035 #include "BESInfo.h"
00036 #include "BESRequestHandlerList.h"
00037 #include "BESRequestHandler.h"
00038 #include "BESDataNames.h"
00039 #include "BESResponseNames.h"
00040 #include "BESCatalogList.h"
00041
00042 BESCatalogResponseHandler::BESCatalogResponseHandler( const string &name )
00043 : BESResponseHandler( name )
00044 {
00045 }
00046
00047 BESCatalogResponseHandler::~BESCatalogResponseHandler( )
00048 {
00049 }
00050
00061 void
00062 BESCatalogResponseHandler::execute( BESDataHandlerInterface &dhi )
00063 {
00064 BESInfo *info = BESInfoList::TheList()->build_info() ;
00065 _response = info ;
00066
00067 string container = dhi.data[CONTAINER] ;
00068 string coi = dhi.data[CATALOG_OR_INFO] ;
00069 if( coi == CATALOG_RESPONSE )
00070 {
00071 info->begin_response( CATALOG_RESPONSE_STR, dhi ) ;
00072 dhi.action_name = CATALOG_RESPONSE_STR ;
00073 }
00074 else
00075 {
00076 info->begin_response( SHOW_INFO_RESPONSE_STR, dhi ) ;
00077 dhi.action_name = SHOW_INFO_RESPONSE_STR ;
00078 }
00079 BESCatalogList::TheCatalogList()->show_catalog( container, coi, info ) ;
00080
00081 info->end_response() ;
00082 }
00083
00095 void
00096 BESCatalogResponseHandler::transmit( BESTransmitter *transmitter,
00097 BESDataHandlerInterface &dhi )
00098 {
00099 if( _response )
00100 {
00101 BESInfo *info = dynamic_cast<BESInfo *>(_response) ;
00102 if( !info )
00103 throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
00104 info->transmit( transmitter, dhi ) ;
00105 }
00106 }
00107
00114 void
00115 BESCatalogResponseHandler::dump( ostream &strm ) const
00116 {
00117 strm << BESIndent::LMarg << "BESCatalogResponseHandler::dump - ("
00118 << (void *)this << ")" << endl ;
00119 BESIndent::Indent() ;
00120 BESResponseHandler::dump( strm ) ;
00121 BESIndent::UnIndent() ;
00122 }
00123
00124 BESResponseHandler *
00125 BESCatalogResponseHandler::CatalogResponseBuilder( const string &name )
00126 {
00127 return new BESCatalogResponseHandler( name ) ;
00128 }
00129