CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/EventFilter/StorageManager/src/StorageManager.cc

Go to the documentation of this file.
00001 // $Id: StorageManager.cc,v 1.135 2011/03/07 15:31:32 mommsen Exp $
00003 
00004 #include "EventFilter/StorageManager/interface/DiskWriter.h"
00005 #include "EventFilter/StorageManager/interface/DiskWriterResources.h"
00006 #include "EventFilter/StorageManager/interface/DQMEventProcessor.h"
00007 #include "EventFilter/StorageManager/interface/DQMEventProcessorResources.h"
00008 #include "EventFilter/StorageManager/interface/DiscardManager.h"
00009 #include "EventFilter/StorageManager/interface/Exception.h"
00010 #include "EventFilter/StorageManager/interface/FragmentMonitorCollection.h"
00011 #include "EventFilter/StorageManager/interface/FragmentProcessor.h"
00012 #include "EventFilter/StorageManager/interface/SoapUtils.h"
00013 #include "EventFilter/StorageManager/interface/StorageManager.h"
00014 #include "EventFilter/StorageManager/interface/StateMachine.h"
00015 #include "EventFilter/StorageManager/src/ConsumerUtils.icc"
00016 
00017 #include "EventFilter/Utilities/interface/i2oEvfMsgs.h"
00018 
00019 #include "FWCore/Utilities/interface/EDMException.h"
00020 
00021 #include "i2o/Method.h"
00022 #include "interface/shared/version.h"
00023 #include "interface/shared/i2oXFunctionCodes.h"
00024 #include "xcept/tools.h"
00025 #include "xdaq/NamespaceURI.h"
00026 #include "xdata/InfoSpaceFactory.h"
00027 #include "xgi/Method.h"
00028 #include "xoap/Method.h"
00029 
00030 #include <boost/lexical_cast.hpp>
00031 #include <boost/shared_ptr.hpp>
00032 
00033 #include <cstdlib>
00034 
00035 using namespace std;
00036 using namespace stor;
00037 
00038 
00039 StorageManager::StorageManager(xdaq::ApplicationStub * s) :
00040   xdaq::Application(s)
00041 {  
00042   LOG4CPLUS_INFO(this->getApplicationLogger(),"Making StorageManager");
00043 
00044   // bind all callback functions
00045   bindI2OCallbacks();
00046   bindStateMachineCallbacks();
00047   bindWebInterfaceCallbacks();
00048   bindConsumerCallbacks();
00049 
00050   std::string errorMsg = "Exception in StorageManager constructor: ";
00051   try
00052   {
00053     initializeSharedResources();
00054   }
00055   catch(std::exception &e)
00056   {
00057     errorMsg += e.what();
00058     LOG4CPLUS_FATAL( getApplicationLogger(), e.what() );
00059     XCEPT_RAISE( stor::exception::Exception, e.what() );
00060   }
00061   catch(...)
00062   {
00063     errorMsg += "unknown exception";
00064     LOG4CPLUS_FATAL( getApplicationLogger(), errorMsg );
00065     XCEPT_RAISE( stor::exception::Exception, errorMsg );
00066   }
00067 
00068   startWorkerThreads();
00069 }
00070 
00071 
00072 void StorageManager::bindI2OCallbacks()
00073 {
00074   i2o::bind(this,
00075             &StorageManager::receiveRegistryMessage,
00076             I2O_SM_PREAMBLE,
00077             XDAQ_ORGANIZATION_ID);
00078   i2o::bind(this,
00079             &StorageManager::receiveDataMessage,
00080             I2O_SM_DATA,
00081             XDAQ_ORGANIZATION_ID);
00082   i2o::bind(this,
00083             &StorageManager::receiveErrorDataMessage,
00084             I2O_SM_ERROR,
00085             XDAQ_ORGANIZATION_ID);
00086   i2o::bind(this,
00087             &StorageManager::receiveDQMMessage,
00088             I2O_SM_DQM,
00089             XDAQ_ORGANIZATION_ID);
00090   i2o::bind(this,
00091             &StorageManager::receiveEndOfLumiSectionMessage,
00092             I2O_EVM_LUMISECTION,
00093             XDAQ_ORGANIZATION_ID);
00094 }
00095 
00096 
00097 void StorageManager::bindStateMachineCallbacks()
00098 {
00099   xoap::bind( this,
00100               &StorageManager::handleFSMSoapMessage,
00101               "Configure",
00102               XDAQ_NS_URI );
00103   xoap::bind( this,
00104               &StorageManager::handleFSMSoapMessage,
00105               "Enable",
00106               XDAQ_NS_URI );
00107   xoap::bind( this,
00108               &StorageManager::handleFSMSoapMessage,
00109               "Stop",
00110               XDAQ_NS_URI );
00111   xoap::bind( this,
00112               &StorageManager::handleFSMSoapMessage,
00113               "Halt",
00114               XDAQ_NS_URI );
00115   xoap::bind( this,
00116               &StorageManager::handleFSMSoapMessage,
00117               "EmergencyStop",
00118               XDAQ_NS_URI );
00119 }
00120 
00121 
00122 void StorageManager::bindWebInterfaceCallbacks()
00123 {
00124   xgi::bind(this,&StorageManager::css,                      "styles.css");
00125   xgi::bind(this,&StorageManager::defaultWebPage,           "Default");
00126   xgi::bind(this,&StorageManager::storedDataWebPage,        "storedData");
00127   xgi::bind(this,&StorageManager::rbsenderWebPage,          "rbsenderlist");
00128   xgi::bind(this,&StorageManager::rbsenderDetailWebPage,    "rbsenderdetail");
00129   xgi::bind(this,&StorageManager::fileStatisticsWebPage,    "fileStatistics");
00130   xgi::bind(this,&StorageManager::dqmEventStatisticsWebPage,"dqmEventStatistics");
00131   xgi::bind(this,&StorageManager::consumerStatisticsPage,   "consumerStatistics" );
00132   xgi::bind(this,&StorageManager::consumerListWebPage,      "consumerList");
00133   xgi::bind(this,&StorageManager::throughputWebPage,        "throughputStatistics");
00134 }
00135 
00136 
00137 void StorageManager::bindConsumerCallbacks()
00138 {
00139   // event consumers
00140   xgi::bind( this, &StorageManager::processConsumerRegistrationRequest, "registerConsumer" );
00141   xgi::bind( this, &StorageManager::processConsumerHeaderRequest, "getregdata" );
00142   xgi::bind( this, &StorageManager::processConsumerEventRequest, "geteventdata" );
00143 
00144   // dqm event consumers
00145   xgi::bind(this,&StorageManager::processDQMConsumerRegistrationRequest, "registerDQMConsumer");
00146   xgi::bind(this,&StorageManager::processDQMConsumerEventRequest, "getDQMeventdata");
00147 }
00148 
00149 
00150 void StorageManager::initializeSharedResources()
00151 {
00152   sharedResources_.reset(new SharedResources());
00153 
00154   xdata::InfoSpace *ispace = getApplicationInfoSpace();
00155   unsigned long instance = getApplicationDescriptor()->getInstance();
00156   sharedResources_->configuration_.reset(new Configuration(ispace, instance));
00157 
00158   QueueConfigurationParams queueParams =
00159     sharedResources_->configuration_->getQueueConfigurationParams();
00160   sharedResources_->commandQueue_.
00161     reset(new CommandQueue(queueParams.commandQueueSize_));
00162   sharedResources_->fragmentQueue_.
00163     reset(new FragmentQueue(queueParams.fragmentQueueSize_, queueParams.fragmentQueueMemoryLimitMB_ * 1024*1024));
00164   sharedResources_->registrationQueue_.
00165     reset(new RegistrationQueue(queueParams.registrationQueueSize_));
00166   sharedResources_->streamQueue_.
00167     reset(new StreamQueue(queueParams.streamQueueSize_, queueParams.streamQueueMemoryLimitMB_ * 1024*1024));
00168   sharedResources_->dqmEventQueue_.
00169     reset(new DQMEventQueue(queueParams.dqmEventQueueSize_, queueParams.dqmEventQueueMemoryLimitMB_ * 1024*1024));
00170 
00171   sharedResources_->statisticsReporter_.reset(
00172     new StatisticsReporter(this, sharedResources_)
00173   );
00174   sharedResources_->initMsgCollection_.reset(new InitMsgCollection());
00175   sharedResources_->diskWriterResources_.reset(new DiskWriterResources());
00176   sharedResources_->dqmEventProcessorResources_.reset(new DQMEventProcessorResources());
00177 
00178   sharedResources_->statisticsReporter_->getThroughputMonitorCollection().setFragmentQueue(sharedResources_->fragmentQueue_);
00179   sharedResources_->statisticsReporter_->getThroughputMonitorCollection().setStreamQueue(sharedResources_->streamQueue_);
00180   sharedResources_->statisticsReporter_->getThroughputMonitorCollection().setDQMEventQueue(sharedResources_->dqmEventQueue_);
00181 
00182   sharedResources_->
00183     discardManager_.reset(new DiscardManager(getApplicationContext(),
00184                                              getApplicationDescriptor(),
00185                                              sharedResources_->statisticsReporter_->
00186                                              getDataSenderMonitorCollection()));
00187 
00188   sharedResources_->registrationCollection_.reset( new RegistrationCollection() );
00189   EventConsumerMonitorCollection& ecmc = 
00190     sharedResources_->statisticsReporter_->getEventConsumerMonitorCollection();
00191   sharedResources_->eventQueueCollection_.reset( new EventQueueCollection( ecmc ) );
00192 
00193   DQMConsumerMonitorCollection& dcmc = 
00194     sharedResources_->statisticsReporter_->getDQMConsumerMonitorCollection();
00195   sharedResources_->dqmEventQueueCollection_.reset( new DQMEventQueueCollection( dcmc ) );
00196 
00197   consumerUtils_.reset( new ConsumerUtils_t(
00198       sharedResources_->configuration_,
00199       sharedResources_->registrationCollection_,
00200       sharedResources_->registrationQueue_,
00201       sharedResources_->initMsgCollection_,
00202       sharedResources_->eventQueueCollection_,
00203       sharedResources_->dqmEventQueueCollection_,
00204       sharedResources_->statisticsReporter_->alarmHandler()
00205     ) );
00206 
00207   smWebPageHelper_.reset( new SMWebPageHelper(
00208       getApplicationDescriptor(), sharedResources_));
00209 
00210 }
00211 
00212 
00213 void StorageManager::startWorkerThreads()
00214 {
00215 
00216   // Start the workloops
00217   try
00218   {
00219     fragmentProcessor_.reset( new FragmentProcessor( this, sharedResources_ ) );
00220     diskWriter_.reset( new DiskWriter(this, sharedResources_) );
00221     dqmEventProcessor_.reset( new DQMEventProcessor(this, sharedResources_) );
00222     sharedResources_->statisticsReporter_->startWorkLoop("theStatisticsReporter");
00223     fragmentProcessor_->startWorkLoop("theFragmentProcessor");
00224     diskWriter_->startWorkLoop("theDiskWriter");
00225     dqmEventProcessor_->startWorkLoop("theDQMEventProcessor");
00226   }
00227   catch(xcept::Exception &e)
00228   {
00229     sharedResources_->moveToFailedState( e );
00230   }
00231   catch(std::exception &e)
00232   {
00233     XCEPT_DECLARE(stor::exception::Exception,
00234       sentinelException, e.what());
00235     sharedResources_->moveToFailedState( sentinelException );
00236   }
00237   catch(...)
00238   {
00239     std::string errorMsg = "Unknown exception when starting the workloops";
00240     XCEPT_DECLARE(stor::exception::Exception,
00241       sentinelException, errorMsg);
00242     sharedResources_->moveToFailedState( sentinelException );
00243   }
00244 }
00245 
00246 
00248 // I2O call back functions //
00250 
00251 void StorageManager::receiveRegistryMessage(toolbox::mem::Reference *ref)
00252 {
00253   I2OChain i2oChain(ref);
00254 
00255   // Set the I2O message pool pointer. Only done for init messages.
00256   ThroughputMonitorCollection& throughputMonCollection =
00257     sharedResources_->statisticsReporter_->getThroughputMonitorCollection();
00258   throughputMonCollection.setMemoryPoolPointer( ref->getBuffer()->getPool() );
00259 
00260   FragmentMonitorCollection& fragMonCollection =
00261     sharedResources_->statisticsReporter_->getFragmentMonitorCollection();
00262   fragMonCollection.getAllFragmentSizeMQ().addSample( 
00263     static_cast<double>( i2oChain.totalDataSize() ) / 0x100000
00264   );
00265 
00266   sharedResources_->fragmentQueue_->enqWait(i2oChain);
00267 }
00268 
00269 
00270 void StorageManager::receiveDataMessage(toolbox::mem::Reference *ref)
00271 {
00272   I2OChain i2oChain(ref);
00273 
00274   FragmentMonitorCollection& fragMonCollection =
00275     sharedResources_->statisticsReporter_->getFragmentMonitorCollection();
00276   fragMonCollection.addEventFragmentSample( i2oChain.totalDataSize() );
00277 
00278   sharedResources_->fragmentQueue_->enqWait(i2oChain);
00279 
00280 #ifdef STOR_DEBUG_DUPLICATE_MESSAGES
00281   double r = rand()/static_cast<double>(RAND_MAX);
00282   if (r < 0.001)
00283   {
00284     LOG4CPLUS_INFO(this->getApplicationLogger(), "Simulating duplicated data message");
00285     receiveDataMessage(ref->duplicate());
00286   }
00287 #endif
00288 }
00289 
00290 
00291 void StorageManager::receiveErrorDataMessage(toolbox::mem::Reference *ref)
00292 {
00293   I2OChain i2oChain(ref);
00294 
00295   FragmentMonitorCollection& fragMonCollection =
00296     sharedResources_->statisticsReporter_->getFragmentMonitorCollection();
00297   fragMonCollection.addEventFragmentSample( i2oChain.totalDataSize() );
00298 
00299   sharedResources_->fragmentQueue_->enqWait(i2oChain);
00300 }
00301 
00302 
00303 void StorageManager::receiveDQMMessage(toolbox::mem::Reference *ref)
00304 {
00305   I2OChain i2oChain(ref);
00306 
00307   FragmentMonitorCollection& fragMonCollection =
00308     sharedResources_->statisticsReporter_->getFragmentMonitorCollection();
00309   fragMonCollection.addDQMEventFragmentSample( i2oChain.totalDataSize() );
00310 
00311   sharedResources_->fragmentQueue_->enqWait(i2oChain);
00312 }
00313 
00314 
00315 void StorageManager::receiveEndOfLumiSectionMessage(toolbox::mem::Reference *ref)
00316 {
00317   I2OChain i2oChain( ref );
00318 
00319   FragmentMonitorCollection& fragMonCollection =
00320     sharedResources_->statisticsReporter_->getFragmentMonitorCollection();
00321   fragMonCollection.addFragmentSample( i2oChain.totalDataSize() );
00322 
00323   RunMonitorCollection& runMonCollection =
00324     sharedResources_->statisticsReporter_->getRunMonitorCollection();
00325   runMonCollection.getEoLSSeenMQ().addSample( i2oChain.lumiSection() );
00326 
00327   sharedResources_->streamQueue_->enqWait( i2oChain );
00328 }
00329 
00330 
00332 // Web interface call back functions //
00334 
00335 void StorageManager::css(xgi::Input *in, xgi::Output *out)
00336 throw (xgi::exception::Exception)
00337 {
00338   smWebPageHelper_->css(in,out);
00339 }
00340 
00341 
00342 void StorageManager::defaultWebPage(xgi::Input *in, xgi::Output *out)
00343 throw (xgi::exception::Exception)
00344 {
00345   std::string errorMsg = "Failed to create the default webpage";
00346   
00347   try
00348   {
00349     smWebPageHelper_->defaultWebPage(out);
00350   }
00351   catch(std::exception &e)
00352   {
00353     errorMsg += ": ";
00354     errorMsg += e.what();
00355     
00356     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00357     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00358   }
00359   catch(...)
00360   {
00361     errorMsg += ": Unknown exception";
00362     
00363     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00364     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00365   }
00366 }
00367 
00368 
00369 void StorageManager::storedDataWebPage(xgi::Input *in, xgi::Output *out)
00370   throw (xgi::exception::Exception)
00371 {
00372   std::string errorMsg = "Failed to create the stored data webpage";
00373 
00374   try
00375   {
00376     smWebPageHelper_->storedDataWebPage(out);
00377   }
00378   catch(std::exception &e)
00379   {
00380     errorMsg += ": ";
00381     errorMsg += e.what();
00382     
00383     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00384     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00385   }
00386   catch(...)
00387   {
00388     errorMsg += ": Unknown exception";
00389     
00390     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00391     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00392   }
00393 }
00394 
00395 
00396 void StorageManager::consumerStatisticsPage( xgi::Input* in,
00397                                              xgi::Output* out )
00398   throw( xgi::exception::Exception )
00399 {
00400 
00401   std::string err_msg =
00402     "Failed to create consumer statistics page";
00403 
00404   try
00405   {
00406     smWebPageHelper_->consumerStatistics(out);
00407   }
00408   catch( std::exception &e )
00409   {
00410     err_msg += ": ";
00411     err_msg += e.what();
00412     LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
00413     XCEPT_RAISE( xgi::exception::Exception, err_msg );
00414   }
00415   catch(...)
00416   {
00417     err_msg += ": Unknown exception";
00418     LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
00419     XCEPT_RAISE( xgi::exception::Exception, err_msg );
00420   }
00421 
00422 }
00423 
00424 
00425 void StorageManager::rbsenderWebPage(xgi::Input *in, xgi::Output *out)
00426   throw (xgi::exception::Exception)
00427 {
00428   std::string errorMsg = "Failed to create the data sender webpage";
00429 
00430   try
00431   {
00432     smWebPageHelper_->resourceBrokerOverview(out);
00433   }
00434   catch(std::exception &e)
00435   {
00436     errorMsg += ": ";
00437     errorMsg += e.what();
00438     
00439     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00440     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00441   }
00442   catch(...)
00443   {
00444     errorMsg += ": Unknown exception";
00445     
00446     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00447     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00448   }
00449 
00450 }
00451 
00452 
00453 void StorageManager::rbsenderDetailWebPage(xgi::Input *in, xgi::Output *out)
00454   throw (xgi::exception::Exception)
00455 {
00456   std::string errorMsg = "Failed to create the data sender webpage";
00457 
00458   try
00459   {
00460     long long localRBID = 0;
00461     cgicc::Cgicc cgiWrapper(in);
00462     cgicc::const_form_iterator updateRef = cgiWrapper.getElement("id");
00463     if (updateRef != cgiWrapper.getElements().end())
00464     {
00465       std::string idString = updateRef->getValue();
00466       localRBID = boost::lexical_cast<long long>(idString);
00467     }
00468 
00469     smWebPageHelper_->resourceBrokerDetail(out, localRBID);
00470   }
00471   catch(std::exception &e)
00472   {
00473     errorMsg += ": ";
00474     errorMsg += e.what();
00475     
00476     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00477     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00478   }
00479   catch(...)
00480   {
00481     errorMsg += ": Unknown exception";
00482     
00483     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00484     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00485   }
00486 
00487 }
00488 
00489 
00490 void StorageManager::fileStatisticsWebPage(xgi::Input *in, xgi::Output *out)
00491   throw (xgi::exception::Exception)
00492 {
00493   std::string errorMsg = "Failed to create the file statistics webpage";
00494 
00495   try
00496   {
00497     smWebPageHelper_->filesWebPage(out);
00498   }
00499   catch(std::exception &e)
00500   {
00501     errorMsg += ": ";
00502     errorMsg += e.what();
00503     
00504     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00505     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00506   }
00507   catch(...)
00508   {
00509     errorMsg += ": Unknown exception";
00510     
00511     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00512     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00513   }
00514 
00515 }
00516 
00517 
00518 void StorageManager::dqmEventStatisticsWebPage(xgi::Input *in, xgi::Output *out)
00519   throw (xgi::exception::Exception)
00520 {
00521   std::string errorMsg = "Failed to create the DQM event statistics webpage";
00522 
00523   try
00524   {
00525     smWebPageHelper_->dqmEventWebPage(out);
00526   }
00527   catch(std::exception &e)
00528   {
00529     errorMsg += ": ";
00530     errorMsg += e.what();
00531     
00532     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00533     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00534   }
00535   catch(...)
00536   {
00537     errorMsg += ": Unknown exception";
00538     
00539     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00540     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00541   }
00542 }
00543 
00544 
00545 void StorageManager::throughputWebPage(xgi::Input *in, xgi::Output *out)
00546   throw (xgi::exception::Exception)
00547 {
00548   std::string errorMsg = "Failed to create the throughput statistics webpage";
00549 
00550   try
00551   {
00552     smWebPageHelper_->throughputWebPage(out);
00553   }
00554   catch(std::exception &e)
00555   {
00556     errorMsg += ": ";
00557     errorMsg += e.what();
00558     
00559     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00560     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00561   }
00562   catch(...)
00563   {
00564     errorMsg += ": Unknown exception";
00565     
00566     LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
00567     XCEPT_RAISE(xgi::exception::Exception, errorMsg);
00568   }
00569 
00570 }
00571 
00572 
00573 // Leaving in for now but making it return an empty buffer:
00574 void StorageManager::consumerListWebPage(xgi::Input *in, xgi::Output *out)
00575   throw (xgi::exception::Exception)
00576 {
00577   out->getHTTPResponseHeader().addHeader( "Content-Type",
00578                                           "application/octet-stream" );
00579   out->getHTTPResponseHeader().addHeader( "Content-Transfer-Encoding",
00580                                           "binary" );
00581   char buff;
00582   out->write( &buff, 0 );
00583 }
00584 
00585 
00587 // State Machine call back functions //
00589 
00590 xoap::MessageReference StorageManager::handleFSMSoapMessage( xoap::MessageReference msg )
00591   throw( xoap::exception::Exception )
00592 {
00593   std::string errorMsg;
00594   xoap::MessageReference returnMsg;
00595 
00596   try {
00597     errorMsg = "Failed to extract FSM event and parameters from SOAP message: ";
00598     std::string command = soaputils::extractParameters(msg, this);
00599 
00600     errorMsg = "Failed to put a '" + command + "' state machine event into command queue: ";
00601     if (command == "Configure")
00602     {
00603       sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::Configure() ) );
00604     }
00605     else if (command == "Enable")
00606     {
00607       if (sharedResources_->configuration_->streamConfigurationHasChanged())
00608       {
00609         sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::Reconfigure() ) );
00610       }
00611       sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::Enable() ) );
00612     }
00613     else if (command == "Stop")
00614     {
00615       sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::Stop() ) );
00616     }
00617     else if (command == "Halt")
00618     {
00619       sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::Halt() ) );
00620     }
00621     else if (command == "EmergencyStop")
00622     {
00623       sharedResources_->commandQueue_->enqWait( stor::EventPtr_t( new stor::EmergencyStop() ) );
00624     }
00625     else
00626     {
00627       XCEPT_RAISE(stor::exception::StateMachine,
00628         "Received an unknown state machine event '" + command + "'.");
00629     }
00630 
00631     errorMsg = "Failed to create FSM SOAP reply message: ";
00632     returnMsg = soaputils::createFsmSoapResponseMsg(command,
00633       sharedResources_->statisticsReporter_->
00634       getStateMachineMonitorCollection().externallyVisibleState());
00635   }
00636   catch (cms::Exception& e) {
00637     errorMsg += e.explainSelf();
00638     XCEPT_DECLARE(xoap::exception::Exception,
00639       sentinelException, errorMsg);
00640     sharedResources_->moveToFailedState( sentinelException );
00641     throw sentinelException;
00642   }
00643   catch (xcept::Exception &e) {
00644     XCEPT_DECLARE_NESTED(xoap::exception::Exception,
00645       sentinelException, errorMsg, e);
00646     sharedResources_->moveToFailedState( sentinelException );
00647     throw sentinelException;
00648   }
00649   catch (std::exception& e) {
00650     errorMsg += e.what();
00651     XCEPT_DECLARE(xoap::exception::Exception,
00652       sentinelException, errorMsg);
00653     sharedResources_->moveToFailedState( sentinelException );
00654     throw sentinelException;
00655   }
00656   catch (...) {
00657     errorMsg += "Unknown exception";
00658     XCEPT_DECLARE(xoap::exception::Exception,
00659       sentinelException, errorMsg);
00660     sharedResources_->moveToFailedState( sentinelException );
00661     throw sentinelException;
00662   }
00663 
00664   return returnMsg;
00665 }
00666 
00667 
00671 
00672 void
00673 StorageManager::processConsumerRegistrationRequest( xgi::Input* in, xgi::Output* out )
00674   throw( xgi::exception::Exception )
00675 {
00676   consumerUtils_->processConsumerRegistrationRequest(in,out);
00677 }
00678 
00679 
00680 void
00681 StorageManager::processConsumerHeaderRequest( xgi::Input* in, xgi::Output* out )
00682   throw( xgi::exception::Exception )
00683 {
00684   consumerUtils_->processConsumerHeaderRequest(in,out);
00685 }
00686 
00687 
00688 void
00689 StorageManager::processConsumerEventRequest( xgi::Input* in, xgi::Output* out )
00690   throw( xgi::exception::Exception )
00691 {
00692   consumerUtils_->processConsumerEventRequest(in,out);
00693 }
00694 
00695 
00696 void
00697 StorageManager::processDQMConsumerRegistrationRequest( xgi::Input* in, xgi::Output* out )
00698   throw( xgi::exception::Exception )
00699 {
00700   consumerUtils_->processDQMConsumerRegistrationRequest(in,out);
00701 }
00702 
00703 
00704 void
00705 StorageManager::processDQMConsumerEventRequest( xgi::Input* in, xgi::Output* out )
00706   throw( xgi::exception::Exception )
00707 {
00708   consumerUtils_->processDQMConsumerEventRequest(in,out);
00709 }
00710 
00711 
00713 // *** Provides factory method for the instantiation of SM applications //
00715 // This macro is depreciated:
00716 XDAQ_INSTANTIATE(StorageManager)
00717 
00718 // One should use the XDAQ_INSTANTIATOR() in the header file
00719 // and this one here. But this breaks the backward compatibility,
00720 // as all xml configuration files would have to be changed to use
00721 // 'stor::StorageManager' instead of 'StorageManager'.
00722 // XDAQ_INSTANTIATOR_IMPL(stor::StorageManager)
00723 
00724 
00725 
00726 
00727 
00728 
00729 
00730