CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Utilities/StorageFactory/plugins/GsiFTPStorageMaker.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/StorageFactory.h"
00004 #include "Utilities/StorageFactory/interface/RemoteFile.h"
00005 
00006 class GsiFTPStorageMaker : public StorageMaker
00007 {
00008 public:
00009   virtual Storage *open (const std::string &proto,
00010                          const std::string &path,
00011                          int mode)
00012   {
00013     std::string    temp;
00014     StorageFactory *f = StorageFactory::get();
00015     int            localfd = RemoteFile::local (f->tempDir(), temp);
00016     std::string    lurl = "file://" + temp;
00017     std::string    newurl ((proto == "sfn" ? "gsiftp" : proto) + ":" + path);
00018     const char     *ftpopts [] = { "globus-url-copy", newurl.c_str (), lurl.c_str (), 0 };
00019     return RemoteFile::get (localfd, temp, (char **) ftpopts, mode);
00020   }
00021 };
00022 
00023 DEFINE_EDM_PLUGIN (StorageMakerFactory, GsiFTPStorageMaker, "gsiftp");
00024 DEFINE_EDM_PLUGIN (StorageMakerFactory, GsiFTPStorageMaker, "sfn");