7#include "GaudiKernel/IDetDataSvc.h"
8#include "GaudiKernel/IConversionSvc.h"
10#include "GaudiKernel/MsgStream.h"
11#include "GaudiKernel/SvcFactory.h"
12#include "GaudiKernel/CnvFactory.h"
13#include "GaudiKernel/ISvcLocator.h"
14#include "GaudiKernel/IDataProviderSvc.h"
15#include "GaudiKernel/GenericAddress.h"
25 ConversionSvc(name, svc, XML_StorageType),
26 m_detPersSvc(0), m_detDataSvc(0), m_parser(0) {
33 void** ppvInterface) {
34 if (IID_ICalibXmlSvc.versionMatch(riid)) {
39 return ConversionSvc::queryInterface(riid, ppvInterface);
42 return StatusCode::SUCCESS;
46 StatusCode sc = ConversionSvc::initialize();
48 MsgStream log(
msgSvc(),
"CalibXmlCnvSvc");
50 if (!sc.isSuccess())
return sc;
56 IDataProviderSvc* pCDS = 0;
58 sc = serviceLocator()->getService(
"CalibDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)pCDS)
60 if ( !sc.isSuccess() ) {
61 log << MSG::ERROR <<
"Could not locate CalibDataSvc" << endreq;
66 sc = setDataProvider(pCDS);
67 if ( !sc.isSuccess() ) {
68 log << MSG::ERROR <<
"Could not set data provider" << endreq;
77 sc = serviceLocator()->service
78 (
"DetectorPersistencySvc", m_detPersSvc,
true);
79 if ( !sc.isSuccess() ) {
81 <<
"Cannot locate IConversionSvc interface of DetectorPersistencySvc"
86 <<
"Retrieved IConversionSvc interface of DetectorPersistencySvc"
91 IAddressCreator* iAddrCreator;
94 sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(), (
void**) &iAddrCreator);
95 if ( !sc.isSuccess() ) {
97 <<
"Cannot query IAddressCreator interface of DetectorPersistencySvc"
102 <<
"Retrieved IAddressCreator interface of DetectorPersistencySvc"
106 <<
"Set it as the address creator of the CalibXmlCnvSvc" << endreq;
107 sc = setAddressCreator(iAddrCreator);
108 if ( !sc.isSuccess() ) {
109 log << MSG::ERROR <<
"Cannot set the address creator" << endreq;
119 log << MSG::FATAL <<
"Unable to create XML parser instance \n"
131 return ConversionSvc::finalize();
136 const std::string* par,
137 const unsigned long* ip,
138 IOpaqueAddress*& refpAddress) {
140 MsgStream log(
msgSvc(), name() );
142 if (svc_type != XML_StorageType) {
143 log << MSG::ERROR <<
"bad storage type" << (int)svc_type << endreq;
144 return StatusCode::FAILURE;
147 std::string dataIdent(par[0]);
148 std::string fullpath(par[1]);
149 std::string fmtVersion(par[2]);
157 refpAddress =
new GenericAddress(XML_StorageType,
163 return StatusCode::SUCCESS;
170XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*
172 return m_parser->
parse(filename);
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
virtual StatusCode createAddress(unsigned char svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
virtual StatusCode initialize()
CalibXmlCnvSvc(const std::string &name, ISvcLocator *svc)
virtual StatusCode finalize()
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * parse(const char *filename)
DOMDocument * parse(const char *const filename, const std::string &docType=std::string(""))
Parse an xml file, returning document node if successful.