CMS 3D CMS Logo

HttpStorageMaker.cc

Go to the documentation of this file.
00001 #include "Utilities/StorageFactory/interface/StorageMaker.h"
00002 #include "Utilities/StorageFactory/interface/StorageMakerFactory.h"
00003 #include "Utilities/StorageFactory/interface/RemoteFile.h"
00004 
00005 class HttpStorageMaker : public StorageMaker
00006 {
00007 public:
00008   virtual Storage *open (const std::string &proto,
00009                          const std::string &path,
00010                          int mode,
00011                          const std::string &tmpdir)
00012   {
00013     std::string temp;
00014     int         localfd = RemoteFile::local (tmpdir, temp);
00015     std::string newurl ((proto == "web" ? "https" : proto) + ":" + path);
00016     const char  *curlopts [] = {
00017       "curl", "-L", "-f", "-o", temp.c_str(), "-q", "-s", "--url",
00018       newurl.c_str (), 0
00019     };
00020 
00021     return RemoteFile::get (localfd, temp, (char **) curlopts, mode);
00022   }
00023 };
00024 
00025 DEFINE_EDM_PLUGIN (StorageMakerFactory, HttpStorageMaker, "https");
00026 DEFINE_EDM_PLUGIN (StorageMakerFactory, HttpStorageMaker, "ftp");
00027 DEFINE_EDM_PLUGIN (StorageMakerFactory, HttpStorageMaker, "web");

Generated on Tue Jun 9 17:48:53 2009 for CMSSW by  doxygen 1.5.4