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"
28 Service(name, pSvcLocator) {
29 declareProperty(
"xmlrpcServer", m_xmlrpcServer =
"202.122.37.68");
30 declareProperty(
"xmlrpcPort", m_xmlrpcPort = 8080);
31 declareProperty(
"xmlrpcUrl", m_xmlrpcUrl =
"/bemp/xmlrpc");
32 declareProperty(
"xmlrpcMethod", m_xmlrpcMethod =
"SetJobInfo.setEvtNum");
36 MsgStream log(
msgSvc(), name() );
37 log << MSG::INFO <<
"in initialize" << endreq;
39 StatusCode sc = Service::initialize();
40 if( sc.isFailure() )
return sc;
43 sc = service(
"IncidentSvc", incsvc);
46 incsvc -> addListener(
this,
"BeginEvent", priority);
55 return StatusCode::SUCCESS;
63 return Service::queryInterface(riid, ppvInterface);
66 return StatusCode::SUCCESS;
70 MsgStream log( messageService(), name() );
72 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
73 if ( inc.type() ==
"BeginEvent" ){
74 log << MSG::DEBUG <<
"Begin Event" << endreq;
82 MsgStream log(
msgSvc(), name());
83 log << MSG::INFO <<
"in finalize" << endreq;
86 std::cout<<
"JobInfoSvc: totle event number = "<< m_count << std::endl;
91 return StatusCode::SUCCESS;
95 MsgStream log(
msgSvc(), name());
97 XmlRpcClient c(m_xmlrpcServer.c_str(), m_xmlrpcPort, m_xmlrpcUrl.c_str());
100 args[0] = m_outputFileName;
103 if (args[0] !=
"" && c.
execute(m_xmlrpcMethod.c_str(), args, result)){
104 log << MSG::INFO <<
" set evtNum = "<< evtNum << endreq;
106 log << MSG::ERROR<<
" Error in execute "<< m_xmlrpcMethod << endreq;
114 MsgStream log(
msgSvc(), name());
115 std::string outputFileName =
"";
117 IJobOptionsSvc* jobSvc;
118 Gaudi::svcLocator()->service(
"JobOptionsSvc", jobSvc);
120 const std::vector<const Property*>* properties_event = jobSvc->getProperties(
"EventCnvSvc");
121 if (properties_event !=
NULL) {
122 for (
unsigned int i = 0; i < properties_event->size(); i++) {
123 if ((*properties_event)[i]->name() ==
"digiRootOutputFile") {
124 outputFileName = (*properties_event)[i]->toString();
130 const std::vector<const Property*>* properties_root = jobSvc->getProperties(
"RootCnvSvc");
131 if (properties_root !=
NULL) {
132 for (
unsigned int i = 0; i < properties_root->size(); i++) {
133 if ((*properties_root)[i]->name() ==
"digiRootOutputFile") {
134 outputFileName = (*properties_root)[i]->toString();
142 return outputFileName;
static const InterfaceID & interfaceID()
StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
void handle(const Incident &)
std::string getJobOutputFile()
JobInfoSvc(const std::string &name, ISvcLocator *pSvcLocator)
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.