DBI_service.cc
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 /// \brief Simple service to provide a RunHistory configured to the right run
3 /// \author Christopher Backhouse - bckhouse@caltech.edu
4 //////////////////////////////////////////////////////////////////////////
5 
6 // nutools includes
7 #include "nutools/IFDatabase/DBIService.h"
8 
9 // Framework includes
11 
12 namespace nutools
13 {
14 namespace dbi
15 {
16 
17  //------------------------------------------------------------
18  DBIService::DBIService(const fhicl::ParameterSet& pset) : evdb::Reconfigurable{pset}
19  {
20  reconfigure(pset);
21  }
22 
23  //-----------------------------------------------------------
25  {
26  fVerbosity = pset.get< int >("Verbosity",0);
27  fTimeQueries = pset.get< bool >("TimeQueries", false);
28  fTimeParsing = pset.get< bool >("TimeParsing", false);
29 
30  fWebServiceURL = pset.get< std::string >("WebServiceURL");
31  fQueryEngineURL = pset.get< std::string >("QueryEngineURL");
32  fDBUser = pset.get< std::string >("DBUser");
33  }
34 
35  //-----------------------------------------------------------
37  std::string schemaName,
38  int tableType, int dataSource)
39  {
40  if (tableName.empty()) return 0;
41 
42  Table* t = new nutools::dbi::Table();
43  t->SetTableName(tableName);
44  t->SetDetector(schemaName);
45  if (tableType < 0 || tableType >= nutools::dbi::kNTableType)
47  if (dataSource < 0 || dataSource >= nutools::dbi::kNDataSources)
49 
53  if (!fWebServiceURL.empty())
55  if (!fQueryEngineURL.empty())
57 
58  if (!fDBUser.empty())
59  t->SetUser(fDBUser);
60 
61  return t;
62  }
63 
65 
66 }
67 }
68 ////////////////////////////////////////////////////////////////////////
void SetTimeQueries(bool f)
Definition: Table.h:305
void SetDataSource(std::string ds)
Definition: Table.cpp:530
std::string string
Definition: nybbler.cc:12
void SetWSURL(std::string url)
Definition: Table.h:302
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:88
Simple service to provide a RunHistory configured to the right run.
Definition: DBIService.h:25
DBIService(const fhicl::ParameterSet &pset)
Definition: DBI_service.cc:18
Simple service to provide a RunHistory configured to the right run.
Definition: Column.cpp:14
Manage all things related to colors for the event display.
void SetTimeParsing(bool f)
Definition: Table.h:306
void SetQEURL(std::string url)
Definition: Table.h:303
Table * CreateTable(std::string tableName="", std::string schemaName="", int tableType=nutools::dbi::kConditionsTable, int dataSource=nutools::dbi::kOffline)
Definition: DBI_service.cc:36
T get(std::string const &key) const
Definition: ParameterSet.h:231
bool SetDetector(std::string det)
Definition: Table.cpp:493
void SetTableName(std::string tname)
Definition: Table.cpp:517
std::string fQueryEngineURL
Definition: DBIService.h:44
std::string fWebServiceURL
Definition: DBIService.h:43
void SetVerbosity(int i)
Definition: Table.h:100
bool SetTableType(int t)
Definition: Table.cpp:451
void reconfigure(const fhicl::ParameterSet &pset)
Definition: DBI_service.cc:24
void SetUser(std::string uname)
Definition: Table.h:79
std::string tableName