2#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/IJobOptionsSvc.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "GaudiKernel/SvcFactory.h"
8#include "GaudiKernel/Bootstrap.h"
9#include "GaudiKernel/Kernel.h"
10#include "GaudiKernel/IInterface.h"
11#include "GaudiKernel/IIncidentSvc.h"
12#include "GaudiKernel/Incident.h"
13#include "GaudiKernel/IIncidentListener.h"
14#include "GaudiKernel/StatusCode.h"
15#include "GaudiKernel/SvcFactory.h"
29 base_class(name, pSvcLocator) {
30 declareProperty(
"xmlrpcServer", m_xmlrpcServer =
"202.122.37.68");
31 declareProperty(
"xmlrpcPort", m_xmlrpcPort = 8080);
32 declareProperty(
"xmlrpcUrl", m_xmlrpcUrl =
"/bemp/xmlrpc");
33 declareProperty(
"xmlrpcMethod", m_xmlrpcMethod =
"SetJobInfo.setEvtNum");
37 MsgStream log(
msgSvc(), name() );
38 log << MSG::INFO <<
"in initialize" << endreq;
40 StatusCode sc = Service::initialize();
41 if( sc.isFailure() )
return sc;
44 sc = service(
"IncidentSvc", incsvc);
47 incsvc -> addListener(
this,
"BeginEvent", priority);
56 return StatusCode::SUCCESS;
71 MsgStream log( messageService(), name() );
73 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
74 if ( inc.type() ==
"BeginEvent" ){
75 log << MSG::DEBUG <<
"Begin Event" << endreq;
83 MsgStream log(
msgSvc(), name());
84 log << MSG::INFO <<
"in finalize" << endreq;
87 std::cout<<
"JobInfoSvc: totle event number = "<< m_count << std::endl;
92 return StatusCode::SUCCESS;
96 MsgStream log(
msgSvc(), name());
98 XmlRpcClient c(m_xmlrpcServer.c_str(), m_xmlrpcPort, m_xmlrpcUrl.c_str());
101 args[0] = m_outputFileName;
104 if (args[0] !=
"" && c.
execute(m_xmlrpcMethod.c_str(), args, result)){
105 log << MSG::INFO <<
" set evtNum = "<< evtNum << endreq;
107 log << MSG::ERROR<<
" Error in execute "<< m_xmlrpcMethod << endreq;
115 MsgStream log(
msgSvc(), name());
116 std::string outputFileName =
"";
118 IJobOptionsSvc* jobSvc;
119 Gaudi::svcLocator()->service(
"JobOptionsSvc", jobSvc);
121 const std::vector<const Property*>* properties_event = jobSvc->getProperties(
"EventCnvSvc");
122 if (properties_event !=
NULL) {
123 for (
unsigned int i = 0; i < properties_event->size(); i++) {
124 if ((*properties_event)[i]->name() ==
"digiRootOutputFile") {
125 outputFileName = (*properties_event)[i]->toString();
131 const std::vector<const Property*>* properties_root = jobSvc->getProperties(
"RootCnvSvc");
132 if (properties_root !=
NULL) {
133 for (
unsigned int i = 0; i < properties_root->size(); i++) {
134 if ((*properties_root)[i]->name() ==
"digiRootOutputFile") {
135 outputFileName = (*properties_root)[i]->toString();
143 return outputFileName;
void handle(const Incident &)
std::string getJobOutputFile()
A class to send XML RPC requests to a server and return the results.
bool execute(const char *method, XmlRpcValue const ¶ms, XmlRpcValue &result)
RPC method arguments and results are represented by Values.