00001 00006 #include "EventFilter/ResourceBroker/interface/RBStateMachine.h" 00007 #include "EventFilter/ResourceBroker/interface/SharedResources.h" 00008 00009 #include <iostream> 00010 00011 using std::string; 00012 using namespace evf::rb_statemachine; 00013 00014 // entry action, state notification, state action 00015 //______________________________________________________________________________ 00016 void Stopped::do_entryActionWork() { 00017 } 00018 00019 void Stopped::do_stateNotify() { 00020 /* 00021 * Stopped will set the externally visible state to ready. 00022 * (useful when re-entering Stopped after a _stop_ event) 00023 */ 00024 SharedResourcesPtr_t res = outermost_context().getSharedResources(); 00025 LOG4CPLUS_INFO(res->log_, "--> ResourceBroker: NEW STATE: " << stateName()); 00026 outermost_context().setExternallyVisibleState("Ready"); 00027 outermost_context().setInternalStateName(stateName()); 00028 // notify RCMS of the new state 00029 outermost_context().rcmsStateChangeNotify(); 00030 } 00031 00032 // construction / destruction 00033 //______________________________________________________________________________ 00034 Stopped::Stopped(my_context c) : 00035 my_base(c) { 00036 safeEntryAction(); 00037 } 00038 00039 Stopped::~Stopped() { 00040 safeExitAction(); 00041 } 00042 00043 // exit action, state name, move to failed state 00044 //______________________________________________________________________________ 00045 void Stopped::do_exitActionWork() { 00046 } 00047 00048 string Stopped::do_stateName() const { 00049 return string("Stopped"); 00050 } 00051 00052 void Stopped::do_moveToFailedState(xcept::Exception& exception) const { 00053 SharedResourcesPtr_t res = outermost_context().getSharedResources(); 00054 res->reasonForFailed_ = exception.what(); 00055 LOG4CPLUS_FATAL(res->log_, 00056 "Moving to FAILED state! Reason: " << exception.what()); 00057 EventPtr fail(new Fail()); 00058 res->commands_.enqEvent(fail); 00059 }