#include <CalibXmlCnvSvc.h>
Inheritance diagram for CalibXmlCnvSvc:
Public Member Functions | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | createAddress (unsigned char svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) |
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | parse (const char *filename) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Protected Member Functions | |
CalibXmlCnvSvc (const std::string &name, ISvcLocator *svc) | |
virtual | ~CalibXmlCnvSvc () |
Private Attributes | |
IConversionSvc * | m_detPersSvc |
Handle to the IConversionSvc interface of the DetectorPersistencySvc. | |
IDetDataSvc * | m_detDataSvc |
Handle to the IDetDataSvc interface of the CalibDataSvc. | |
xmlBase::XmlParser * | m_parser |
Friends | |
class | SvcFactory< CalibXmlCnvSvc > |
Only factories can access protected constructors. |
A conversion service for GLAST calibration bulk data in Xml format.
Definition at line 31 of file CalibXmlCnvSvc.h.
CalibXmlCnvSvc::CalibXmlCnvSvc | ( | const std::string & | name, | |
ISvcLocator * | svc | |||
) | [protected] |
Definition at line 23 of file CalibXmlCnvSvc.cxx.
00024 : 00025 ConversionSvc(name, svc, XML_StorageType), 00026 m_detPersSvc(0), m_detDataSvc(0), m_parser(0) { 00027 00028 // Some day might have a property to declare having to do with path to 00029 // xml files. 00030 }
virtual CalibXmlCnvSvc::~CalibXmlCnvSvc | ( | ) | [inline, protected, virtual] |
StatusCode CalibXmlCnvSvc::createAddress | ( | unsigned char | svc_type, | |
const CLID & | clid, | |||
const std::string * | par, | |||
const unsigned long * | ip, | |||
IOpaqueAddress *& | refpAddress | |||
) | [virtual] |
Create an XML address using explicit arguments to identify a single object
svc_type | the service type | |
CLID | the CLID of the XML Element for which an address is created | |
par | an array of three strings containing the format version, calibration type name and the flavor, in this order | |
ip | has a single element, the serial number of the MySQL row which corresponds to this element | |
refpAddress | the new address created |
Definition at line 134 of file CalibXmlCnvSvc.cxx.
References calibUtil::ERROR, msgSvc(), and deljobs::string.
00138 { 00139 00140 MsgStream log( msgSvc(), name() ); 00141 00142 if (svc_type != XML_StorageType) { 00143 log << MSG::ERROR << "bad storage type" << (int)svc_type << endreq; 00144 return StatusCode::FAILURE; 00145 } 00146 00147 std::string dataIdent(par[0]); // file identifier for PDS version of data 00148 std::string fullpath(par[1]); // path within TCDS for the object 00149 std::string fmtVersion(par[2]); 00150 int serNo = ip[0]; 00151 00152 // for now have to ignore fmtVersion because of defective implementation 00153 // of GenericAddress. If we want it, should probably write new 00154 // opaque address implementation for this package to use. All 00155 // dealings with (calibration) opaque addresses are confined to 00156 // the CalibSvc package. 00157 refpAddress = new GenericAddress(XML_StorageType, 00158 clid, 00159 dataIdent, 00160 fullpath, 00161 serNo); 00162 00163 return StatusCode::SUCCESS; 00164 00165 }
StatusCode CalibXmlCnvSvc::finalize | ( | ) | [virtual] |
StatusCode CalibXmlCnvSvc::initialize | ( | ) | [virtual] |
Definition at line 45 of file CalibXmlCnvSvc.cxx.
References Bes_Common::DEBUG, calibUtil::ERROR, Bes_Common::FATAL, m_detPersSvc, m_parser, and msgSvc().
00045 { 00046 StatusCode sc = ConversionSvc::initialize(); 00047 00048 MsgStream log(msgSvc(), "CalibXmlCnvSvc"); 00049 00050 if (!sc.isSuccess()) return sc; 00051 00052 /* Paste in a bit of CalibMySQLCnvSvc::initialize */ 00053 00054 // Locate the Calib Data Service. Since it inherits from DataSvc 00055 // it has to implement IDataProviderSvc 00056 IDataProviderSvc* pCDS = 0; 00057 //sc = serviceLocator()->getService("CalibDataSvc", IID_IDataProviderSvc, (IInterface*&)pCDS); 00058 sc = serviceLocator()->getService("CalibDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)pCDS) 00059 ; 00060 if ( !sc.isSuccess() ) { 00061 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq; 00062 return sc; 00063 } 00064 00065 // Set the CalibDataSvc as data provider service 00066 sc = setDataProvider(pCDS); 00067 if ( !sc.isSuccess() ) { 00068 log << MSG::ERROR << "Could not set data provider" << endreq; 00069 return sc; 00070 } 00071 00072 /* End of pasted bit */ 00073 00074 00075 /* Paste in more of CalibMySQLCnvSvc::initialize */ 00076 // Locate IConversionSvc interface of the DetectorPersistencySvc 00077 sc = serviceLocator()->service 00078 ("DetectorPersistencySvc", m_detPersSvc, true); 00079 if ( !sc.isSuccess() ) { 00080 log << MSG::ERROR 00081 << "Cannot locate IConversionSvc interface of DetectorPersistencySvc" 00082 << endreq; 00083 return sc; 00084 } else { 00085 log << MSG::DEBUG 00086 << "Retrieved IConversionSvc interface of DetectorPersistencySvc" 00087 << endreq; 00088 } 00089 00090 // Query the IAddressCreator interface of the detector persistency service 00091 IAddressCreator* iAddrCreator; 00092 //sc = m_detPersSvc->queryInterface(IID_IAddressCreator, 00093 // (void**) &iAddrCreator); 00094 sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(), (void**) &iAddrCreator); 00095 if ( !sc.isSuccess() ) { 00096 log << MSG::ERROR 00097 << "Cannot query IAddressCreator interface of DetectorPersistencySvc" 00098 << endreq; 00099 return sc; 00100 } else { 00101 log << MSG::DEBUG 00102 << "Retrieved IAddressCreator interface of DetectorPersistencySvc" 00103 << endreq; 00104 } 00105 log << MSG::DEBUG 00106 << "Set it as the address creator of the CalibXmlCnvSvc" << endreq; 00107 sc = setAddressCreator(iAddrCreator); 00108 if ( !sc.isSuccess() ) { 00109 log << MSG::ERROR << "Cannot set the address creator" << endreq; 00110 return sc; 00111 } 00112 00113 // end of second pasted piece 00114 00115 00116 m_parser = new xmlBase::XmlParser(); 00117 00118 if (m_parser == 0) { 00119 log << MSG::FATAL << "Unable to create XML parser instance \n" 00120 << endreq; 00121 } 00122 00123 // set properties if there are any?? 00124 00125 return sc; 00126 }
static const InterfaceID& ICalibXmlSvc::interfaceID | ( | ) | [inline, static, inherited] |
Definition at line 30 of file ICalibXmlSvc.h.
References IID_ICalibXmlSvc().
00030 { return IID_ICalibXmlSvc; }
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * CalibXmlCnvSvc::parse | ( | const char * | filename | ) | [virtual] |
This method parses an xml file and produces the corresponding DOM document.
fileName | the name of the file to parse |
Implements ICalibXmlSvc.
Definition at line 171 of file CalibXmlCnvSvc.cxx.
References m_parser, and xmlBase::XmlParser::parse().
StatusCode CalibXmlCnvSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual] |
Definition at line 32 of file CalibXmlCnvSvc.cxx.
References IID_ICalibXmlSvc().
00033 { 00034 if (IID_ICalibXmlSvc.versionMatch(riid)) { 00035 *ppvInterface = (ICalibXmlSvc*)this; 00036 } 00037 else { 00038 // Interface is not directly availible: try out a base class 00039 return ConversionSvc::queryInterface(riid, ppvInterface); 00040 } 00041 addRef(); 00042 return StatusCode::SUCCESS; 00043 }
friend class SvcFactory< CalibXmlCnvSvc > [friend] |
IDetDataSvc* CalibXmlCnvSvc::m_detDataSvc [private] |
Handle to the IDetDataSvc interface of the CalibDataSvc.
Definition at line 132 of file CalibXmlCnvSvc.h.
IConversionSvc* CalibXmlCnvSvc::m_detPersSvc [private] |
Handle to the IConversionSvc interface of the DetectorPersistencySvc.
Definition at line 128 of file CalibXmlCnvSvc.h.
Referenced by initialize().
xmlBase::XmlParser* CalibXmlCnvSvc::m_parser [private] |
Definition at line 134 of file CalibXmlCnvSvc.h.
Referenced by finalize(), initialize(), and parse().