29 TNetFileStager::TNetFileStager(
const char *url) : TFileStager(
"net")
32 if (url && strlen(url) > 0) {
33 GetPrefix(url, fPrefix);
35 fSystem =
new TNetSystem(fPrefix);
42 TNetFileStager::~TNetFileStager()
51 Bool_t TNetFileStager::IsStaged(
const char *path)
54 GetPrefix(path, fPrefix);
55 fSystem =
new TNetSystem(path);
60 if (!p.BeginsWith(fPrefix)) p.Insert(0, fPrefix);
61 return (fSystem->AccessPathName(p, kReadPermission) ? kFALSE : kTRUE);
65 Warning(
"IsStaged",
"TNetSystem not initialized");
72 void TNetFileStager::GetPrefix(
const char *url, TString &pfx)
75 ::Info(
"TNetFileStager::GetPrefix",
"enter: %s", url);
78 pfx = TString::Format(
"%s://", u.GetProtocol());
79 if (strlen(u.GetUser()) > 0)
80 pfx += TString::Format(
"%s@", u.GetUser());
82 if (u.GetPort() != TUrl(
"root://host").GetPort())
83 pfx += TString::Format(
":%d", u.GetPort());
87 ::Info(
"TNetFileStager::GetPrefix",
"found prefix: %s", pfx.Data());
93 void TNetFileStager::Print(Option_t *)
const
95 Printf(
"+++ stager: %s %s", GetName(), fPrefix.Data());
102 Int_t TNetFileStager::Locate(
const char *path, TString &eurl)
105 GetPrefix(path, fPrefix);
106 fSystem =
new TNetSystem(path);
111 if (!p.BeginsWith(fPrefix)) p.Insert(0, fPrefix);
112 if (!fSystem->AccessPathName(p, kReadPermission)) {
126 Bool_t TNetFileStager::Matches(
const char *s)
131 return ((fPrefix == pfx) ? kTRUE : kFALSE);