00001 // -*- C++ -*- 00002 // 00003 // Package: Utilities 00004 // Class : cmsGetFnConnect 00005 // 00006 // Implementation: 00007 // Looks up a frontier connect string 00008 // 00009 // Original Author: Dave Dykstra 00010 // Created: Tue Feb 22 16:54:06 CST 2011 00011 // 00012 00013 #include "FWCore/Catalog/interface/SiteLocalConfig.h" 00014 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00015 #include "FWCore/ServiceRegistry/interface/Service.h" 00016 #include "FWCore/Services/src/SiteLocalConfigService.h" 00017 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" 00018 #include "FWCore/Utilities/interface/Exception.h" 00019 #include <iostream> 00020 #include <string.h> 00021 00022 int 00023 main(int argc, char* argv[]) 00024 { 00025 if ((argc != 2) || (strncmp(argv[1], "frontier://", 11) != 0)) 00026 { 00027 std::cerr << "Usage: cmsGetFnConnect frontier://shortname" << std::endl; 00028 return 2; 00029 } 00030 00031 try { 00032 std::auto_ptr<edm::SiteLocalConfig> slcptr(new edm::service::SiteLocalConfigService(edm::ParameterSet())); 00033 boost::shared_ptr<edm::serviceregistry::ServiceWrapper<edm::SiteLocalConfig> > slc(new edm::serviceregistry::ServiceWrapper<edm::SiteLocalConfig>(slcptr)); 00034 edm::ServiceToken slcToken = edm::ServiceRegistry::createContaining(slc); 00035 edm::ServiceRegistry::Operate operate(slcToken); 00036 00037 edm::Service<edm::SiteLocalConfig> localconfservice; 00038 00039 std::cout << localconfservice->lookupCalibConnect(argv[1]) << std::endl; 00040 } catch(cms::Exception const& e) { 00041 std::cerr << e.explainSelf() << std::endl; 00042 return 2; 00043 } 00044 return 0; 00045 }