8 #include "EventFilter/StorageManager/src/ConsumerUtils.icc"
12 #include "xcept/tools.h"
13 #include "xdaq/NamespaceURI.h"
14 #include "xdata/InfoSpaceFactory.h"
15 #include "xgi/Method.h"
16 #include "xoap/Method.h"
21 using namespace smproxy;
24 SMProxyServer::SMProxyServer(xdaq::ApplicationStub *
s) :
27 LOG4CPLUS_INFO(this->getApplicationLogger(),
"Making SMProxyServer");
34 std::string errorMsg =
"Exception in SMProxyServer constructor: ";
42 LOG4CPLUS_FATAL( getApplicationLogger(), e.what() );
47 errorMsg +=
"unknown exception";
48 LOG4CPLUS_FATAL( getApplicationLogger(), errorMsg );
124 stateMachine_->getStatisticsReporter()->startWorkLoop(
"theStatisticsReporter");
133 sentinelException, e.what());
138 std::string errorMsg =
"Unknown exception when starting the workloops";
140 sentinelException, errorMsg);
153 smpsWebPageHelper_->css(
in,
out);
160 std::string errorMsg =
"Failed to create the default webpage";
164 smpsWebPageHelper_->defaultWebPage(
out);
169 errorMsg += e.what();
171 LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
176 errorMsg +=
": Unknown exception";
178 LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
189 "Failed to create data retriever web page";
193 smpsWebPageHelper_->dataRetrieverWebPage(
out);
199 LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
204 err_msg +=
": Unknown exception";
205 LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
216 "Failed to create consumer web page";
220 smpsWebPageHelper_->consumerStatisticsWebPage(
out);
226 LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
231 err_msg +=
": Unknown exception";
232 LOG4CPLUS_ERROR( getApplicationLogger(), err_msg );
241 std::string errorMsg =
"Failed to create the DQM event statistics webpage";
245 smpsWebPageHelper_->dqmEventStatisticsWebPage(
out);
250 errorMsg += e.what();
252 LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
257 errorMsg +=
": Unknown exception";
259 LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg);
273 xoap::MessageReference returnMsg;
276 errorMsg =
"Failed to extract FSM event and parameters from SOAP message: ";
280 errorMsg =
"Failed to process '" + command +
"' state machine event: ";
281 if (command ==
"Configure")
283 newState = stateMachine_->processEvent(
Configure() );
285 else if (command ==
"Enable")
287 newState = stateMachine_->processEvent(
Enable() );
289 else if (command ==
"Stop")
291 newState = stateMachine_->processEvent(
Stop() );
293 else if (command ==
"Halt")
295 newState = stateMachine_->processEvent(
Halt() );
299 XCEPT_RAISE(exception::StateMachine,
300 "Received an unknown state machine event '" + command +
"'.");
303 errorMsg =
"Failed to create FSM SOAP reply message: ";
309 sentinelException, errorMsg);
310 stateMachine_->moveToFailedState(sentinelException);
314 sentinelException, errorMsg, e);
315 stateMachine_->moveToFailedState(sentinelException);
318 errorMsg += e.what();
320 sentinelException, errorMsg);
321 stateMachine_->moveToFailedState(sentinelException);
324 errorMsg +=
"Unknown exception";
326 sentinelException, errorMsg);
327 stateMachine_->moveToFailedState(sentinelException);
342 consumerUtils_->processConsumerRegistrationRequest(
in,
out);
350 consumerUtils_->processConsumerHeaderRequest(
in,
out);
358 consumerUtils_->processConsumerEventRequest(
in,
out);
366 consumerUtils_->processDQMConsumerRegistrationRequest(
in,
out);
374 consumerUtils_->processDQMConsumerEventRequest(
in,
out);
386 writeHTTPHeaders( out );
405 void processDQMConsumerEventRequest(xgi::Input *in, xgi::Output *out)
StateMachinePtr stateMachine_
void processConsumerRegistrationRequest(xgi::Input *in, xgi::Output *out)
void bindConsumerCallbacks()
virtual std::string explainSelf() const
boost::scoped_ptr< ConsumerUtils_t > consumerUtils_
xoap::MessageReference createFsmSoapResponseMsg(const std::string commandName, const std::string currentState)
void processConsumerHeaderRequest(xgi::Input *in, xgi::Output *out)
void bindStateMachineCallbacks()
void dataRetrieverWebPage(xgi::Input *in, xgi::Output *out)
void css(xgi::Input *in, xgi::Output *out)
void processConsumerEventRequest(xgi::Input *in, xgi::Output *out)
xoap::MessageReference handleFSMSoapMessage(xoap::MessageReference)
void initializeSharedResources()
void startWorkerThreads()
unsigned char * dataLocation() const
void consumerStatisticsWebPage(xgi::Input *in, xgi::Output *out)
void defaultWebPage(xgi::Input *in, xgi::Output *out)
void dqmEventStatisticsWebPage(xgi::Input *in, xgi::Output *out)
std::string extractParameters(xoap::MessageReference, xdaq::Application *)
void processDQMConsumerRegistrationRequest(xgi::Input *in, xgi::Output *out)
unsigned long totalDataSize() const
void bindWebInterfaceCallbacks()
boost::scoped_ptr< SMPSWebPageHelper > smpsWebPageHelper_