Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:52

0001 #include "Utilities/StorageFactory/interface/StorageMaker.h"
0002 #include "Utilities/StorageFactory/interface/StorageMakerFactory.h"
0003 #include "Utilities/StorageFactory/interface/StorageFactory.h"
0004 #include "Utilities/StorageFactory/interface/RemoteFile.h"
0005 
0006 namespace edm::storage {
0007   class GsiFTPStorageMaker : public StorageMaker {
0008   public:
0009     std::unique_ptr<Storage> open(const std::string &proto,
0010                                   const std::string &path,
0011                                   int mode,
0012                                   const AuxSettings &) const override {
0013       std::string temp;
0014       const StorageFactory *f = StorageFactory::get();
0015       int localfd = RemoteFile::local(f->tempDir(), temp);
0016       std::string lurl = "file://" + temp;
0017       std::string newurl((proto == "sfn" ? "gsiftp" : proto) + ":" + path);
0018       const char *ftpopts[] = {"globus-url-copy", newurl.c_str(), lurl.c_str(), nullptr};
0019       return RemoteFile::get(localfd, temp, (char **)ftpopts, mode);
0020     }
0021   };
0022 }  // namespace edm::storage
0023 
0024 using namespace edm::storage;
0025 
0026 DEFINE_EDM_PLUGIN(StorageMakerFactory, GsiFTPStorageMaker, "gsiftp");
0027 DEFINE_EDM_PLUGIN(StorageMakerFactory, GsiFTPStorageMaker, "sfn");