Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

JobInfoSvc Class Reference

#include <JobInfoSvc.h>

Inheritance diagram for JobInfoSvc:

IJobInfoSvc IJobInfoSvc List of all members.

Public Member Functions

StatusCode finalize ()
StatusCode finalize ()
std::string getJobOutputFile ()
std::string getJobOutputFile ()
void handle (const Incident &)
void handle (const Incident &)
StatusCode initialize ()
StatusCode initialize ()
 JobInfoSvc (const std::string &name, ISvcLocator *pSvcLocator)
 JobInfoSvc (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
int xmlrpc (int evtNum)
int xmlrpc (int evtNum)
 ~JobInfoSvc ()
 ~JobInfoSvc ()

Static Public Member Functions

const InterfaceID & interfaceID ()
const InterfaceID & interfaceID ()

Private Attributes

long m_count
std::string m_outputFileName
std::string m_xmlrpcMethod
int m_xmlrpcPort
std::string m_xmlrpcServer
std::string m_xmlrpcUrl

Constructor & Destructor Documentation

JobInfoSvc::JobInfoSvc const std::string &  name,
ISvcLocator *  pSvcLocator
 

00027                                                                       :
00028   Service(name, pSvcLocator) {
00029     declareProperty("xmlrpcServer",     m_xmlrpcServer = "202.122.37.68");
00030     declareProperty("xmlrpcPort",       m_xmlrpcPort = 8080);
00031     declareProperty("xmlrpcUrl",        m_xmlrpcUrl = "/bemp/xmlrpc");
00032     declareProperty("xmlrpcMethod",     m_xmlrpcMethod = "SetJobInfo.setEvtNum");
00033   }

JobInfoSvc::~JobInfoSvc  )  [inline]
 

00017 {};

JobInfoSvc::JobInfoSvc const std::string &  name,
ISvcLocator *  pSvcLocator
 

JobInfoSvc::~JobInfoSvc  )  [inline]
 

00017 {};


Member Function Documentation

StatusCode JobInfoSvc::finalize  ) 
 

StatusCode JobInfoSvc::finalize  ) 
 

00081                                 {
00082   MsgStream log(msgSvc(), name());
00083   log << MSG::INFO << "in finalize" << endreq;
00084 
00085   //Keep this line for log file output please!
00086   std::cout<< "JobInfoSvc: totle event number =  "<< m_count << std::endl;
00087 
00088   //Save event number to job manage database
00089   xmlrpc(m_count);
00090 
00091   return StatusCode::SUCCESS;
00092 }

std::string JobInfoSvc::getJobOutputFile  )  [virtual]
 

Implements IJobInfoSvc.

std::string JobInfoSvc::getJobOutputFile  )  [virtual]
 

Implements IJobInfoSvc.

00113                                       {
00114   MsgStream log(msgSvc(), name());
00115   std::string outputFileName = "";
00116 
00117   IJobOptionsSvc* jobSvc; 
00118   Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
00119 
00120   const std::vector<const Property*>* properties_event = jobSvc->getProperties("EventCnvSvc");
00121   if (properties_event != NULL) {
00122     for (unsigned int i = 0; i < properties_event->size(); i++) {
00123       if ((*properties_event)[i]->name() == "digiRootOutputFile") {
00124         outputFileName = (*properties_event)[i]->toString();
00125         break;
00126       }
00127     }
00128   }
00129 
00130   const std::vector<const Property*>* properties_root = jobSvc->getProperties("RootCnvSvc");
00131   if (properties_root != NULL) {
00132     for (unsigned int i = 0; i < properties_root->size(); i++) {
00133       if ((*properties_root)[i]->name() == "digiRootOutputFile") {
00134         outputFileName = (*properties_root)[i]->toString();
00135         break;
00136       }
00137     }
00138   }
00139 
00140   //FIXME for RawDataCnvSvc
00141 
00142   return outputFileName;
00143 }

void JobInfoSvc::handle const Incident &   ) 
 

void JobInfoSvc::handle const Incident &   ) 
 

00069                                           {
00070   MsgStream log( messageService(), name() );
00071 
00072   log << MSG::DEBUG << "handle: " << inc.type() << endreq;
00073   if ( inc.type() == "BeginEvent" ){
00074     log << MSG::DEBUG << "Begin Event" << endreq;
00075     //count execute time
00076     m_count++;
00077   }
00078 }

StatusCode JobInfoSvc::initialize  ) 
 

StatusCode JobInfoSvc::initialize  ) 
 

00035                                  {
00036   MsgStream log( msgSvc(), name() );
00037   log << MSG::INFO << "in initialize" << endreq;
00038 
00039   StatusCode sc = Service::initialize();
00040   if( sc.isFailure() ) return sc;
00041 
00042   IIncidentSvc* incsvc;
00043   sc = service("IncidentSvc", incsvc);
00044   int priority = 100;
00045   if( sc.isSuccess() ){
00046     incsvc -> addListener(this, "BeginEvent", priority);
00047   }
00048 
00049   m_outputFileName = getJobOutputFile();
00050   m_count = 0;
00051 
00052   //Set initialize value of real event number
00053   xmlrpc(-1);
00054 
00055   return StatusCode::SUCCESS;
00056 }

const InterfaceID& IJobInfoSvc::interfaceID  )  [inline, static, inherited]
 

00016 { return IID_IJobInfoSvc; }

const InterfaceID& IJobInfoSvc::interfaceID  )  [inline, static, inherited]
 

00016 { return IID_IJobInfoSvc; }

StatusCode JobInfoSvc::queryInterface const InterfaceID &  riid,
void **  ppvInterface
 

StatusCode JobInfoSvc::queryInterface const InterfaceID &  riid,
void **  ppvInterface
 

00059 {
00060   if ( IJobInfoSvc::interfaceID().versionMatch(riid) )    {
00061     *ppvInterface = (IJobInfoSvc*)this;
00062   }else{ 
00063     return Service::queryInterface(riid, ppvInterface);
00064   }
00065   addRef();
00066   return StatusCode::SUCCESS;
00067 }

int JobInfoSvc::xmlrpc int  evtNum  )  [virtual]
 

Implements IJobInfoSvc.

int JobInfoSvc::xmlrpc int  evtNum  )  [virtual]
 

Implements IJobInfoSvc.

00094                                 {
00095   MsgStream log(msgSvc(), name());
00096 
00097   XmlRpcClient c(m_xmlrpcServer.c_str(), m_xmlrpcPort, m_xmlrpcUrl.c_str());
00098   XmlRpcValue args, result;
00099 
00100   args[0] = m_outputFileName; 
00101   args[1] = evtNum;
00102 
00103   if (args[0] != "" && c.execute(m_xmlrpcMethod.c_str(), args, result)){
00104     log << MSG::INFO << " set evtNum = "<< evtNum << endreq;
00105   }else{
00106     log << MSG::ERROR<< " Error in execute "<< m_xmlrpcMethod << endreq;
00107     return -1;
00108   }
00109 
00110   return 0;
00111 }


Member Data Documentation

long JobInfoSvc::m_count [private]
 

std::string JobInfoSvc::m_outputFileName [private]
 

std::string JobInfoSvc::m_xmlrpcMethod [private]
 

int JobInfoSvc::m_xmlrpcPort [private]
 

std::string JobInfoSvc::m_xmlrpcServer [private]
 

std::string JobInfoSvc::m_xmlrpcUrl [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:18:59 2011 for BOSS6.5.5 by  doxygen 1.3.9.1