StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testUcm.C
1 #include "logging/TxEventLogFactory.h"
2 #include "logging/TxEventLog.h"
3 #include "logging/StUcmTasks.h"
4 #include "logging/StRecordIterator.h"
5 #include "logging/RecordList.h"
6 #include "logging/StDbFieldI.h"
7 #include "logging/StUcmJobs.h"
8 #include "logging/StUcmEvents.h"
9 #include <iostream>
10 
11 using namespace TxLogging;
12 using namespace std;
13 
14 int main(int argc , char *argv[])
15 {
16  TxEventLog &ucm = *TxEventLogFactory::create("c");
17 
18  cout << "Total tasks recorded by \"Tasks\" table :=" <<ucm.queryTableSize("Tasks") << endl;
19  const char *username = "starreco";
20  ucm.setRequesterName(username);
21  cout << "Total tasks recorded by \"Tasks\" table for <"
22  << username << ">:= "
23  << ucm.queryTableSize("Tasks") << endl;
24  StUcmTasks &tasks = *ucm.getTaskList(10);
25  Iterator task = tasks.taskIterator();
26  StRecord *r = 0;
27  if (task.hasNext()) {
28  r = task.next();
29  cout << "*** Total " << ucm.queryTableSize("Jobs",r)
30  <<" jobs were found for the current task" << endl;
31  r->printHeader();
32  r->print();
33  StUcmJobs &jobs = *ucm.getJobList(r,20);
34  Iterator job = jobs.jobIterator();
35  ucm.setDbJobID(1);
36  {
37  StUcmEvents &events=*ucm.getEventList(20);
38  Iterator event = events.eventIterator();
39  while(event.hasNext() ){
40  r = event.next();
41  r->print();
42  }
43  }
44  bool doHeader = true;
45  while (job.hasNext() ) {
46  r = job.next();
47  cout << "*** Total " << ucm.queryTableSize("Events",r)
48  <<" events were found for the current job" << endl;
49  if (doHeader) {
50  r->printHeader();
51  r->print();
52  doHeader = false;
53  StUcmEvents &events=*ucm.getEventList(r,20);
54  Iterator event = events.eventIterator();
55  while(event.hasNext() ){
56  r = event.next();
57  r->print();
58  }
59  } else {
60  r->print();
61  }
62  }
63  ucm.setDbJobID(1);
64  cout << " --------------------------------------" << endl;
65  ucm.logJobAttribute ("queue","Very Long");
66  cout << " --------------------------------------" << endl;
67  StUcmEvents &events=*ucm.getEventList(20);
68  Iterator event = events.eventIterator();
69  while(event.hasNext() ){
70  r = event.next();
71  r->print();
72  }
73  }
74 }
virtual void setRequesterName(const std::string &requester)=0
virtual void logJobAttribute(const std::string &key, const std::string &value)=0