28#include <XrdCl/XrdClFileSystem.hh>
29#include <XrdCl/XrdClXRootDResponses.hh>
30#include <XrdVersion.hh>
31#if XrdVNUMBER >= 40000
32#include <XrdNet/XrdNetAddr.hh>
34#include <XrdSys/XrdSysDNS.hh>
53 struct DirectoryInfo {
55 XrdCl::DirectoryList *fDirList;
56 XrdCl::DirectoryList::Iterator *fDirListIter;
59 DirectoryInfo(
const char *dir) : fUrl(new
XrdCl::URL(dir)), fDirList(0), fDirListIter(0) {}
74 TSystem(
"-root",
"Net file Helper System"), fUrl(0), fFileSystem(0)
88 TSystem(
"-root",
"Net file Helper System")
90 using namespace XrdCl;
94 fUrl =
new URL(std::string(url));
116 using namespace XrdCl;
118 DirectoryInfo *dirInfo =
new DirectoryInfo(dir);
120 return (
void *) dirInfo;
131 using namespace XrdCl;
133 XRootDStatus st =
fFileSystem->MkDir(url.GetPath(), MkDirFlags::MakePath,
136 Error(
"MakeDirectory",
"%s", st.GetErrorMessage().c_str());
151 delete (DirectoryInfo *) dirp;
162 using namespace XrdCl;
163 DirectoryInfo *dirInfo = (DirectoryInfo *) dirp;
165 if (!dirInfo->fDirList) {
166 XRootDStatus st =
fFileSystem->DirList(dirInfo->fUrl->GetPath(),
167 DirListFlags::Locate,
170 Error(
"GetDirEntry",
"%s", st.GetErrorMessage().c_str());
173 dirInfo->fDirListIter =
new DirectoryList::Iterator(dirInfo->fDirList->Begin());
176 if (*(dirInfo->fDirListIter) != dirInfo->fDirList->End()) {
177 const char *
filename = (**(dirInfo->fDirListIter))->GetName().c_str();
178 (*(dirInfo->fDirListIter))++;
195 using namespace XrdCl;
203 Info(
"GetPathInfo",
"Stat error: %s", st.GetErrorMessage().c_str());
211 if (info->TestFlags(StatInfo::Offline)) {
214 std::stringstream sstr(info->GetId());
218 buf.
fDev = (
id >> 32);
219 buf.
fIno = (
id & 0x00000000FFFFFFFF);
223 buf.
fSize = info->GetSize();
224 buf.
fMtime = info->GetModTime();
226 if (info->TestFlags(StatInfo::XBitSet))
231 if (info->TestFlags(StatInfo::IsReadable)) buf.
fMode |=
kS_IRUSR;
232 if (info->TestFlags(StatInfo::IsWritable)) buf.
fMode |=
kS_IWUSR;
249 using namespace XrdCl;
256 Info(
"ConsistentWith",
"Protocol: '%s' (%s), Username: '%s' (%s), "
257 "Password: '%s' (%s), Hostname: '%s' (%s), Port: %d (%d)",
258 fUrl->GetProtocol().c_str(), url.GetProtocol().c_str(),
259 fUrl->GetUserName().c_str(), url.GetUserName().c_str(),
260 fUrl->GetPassword().c_str(), url.GetPassword().c_str(),
261 fUrl->GetHostName().c_str(), url.GetHostName().c_str(),
262 fUrl->GetPort(), url.GetPort());
265 if(
fUrl->GetProtocol() == url.GetProtocol() &&
266 fUrl->GetUserName() == url.GetUserName() &&
267 fUrl->GetPassword() == url.GetPassword() &&
268 fUrl->GetHostName() == url.GetHostName() &&
269 fUrl->GetPort() == url.GetPort())
287 using namespace XrdCl;
292 XRootDStatus st =
fFileSystem->Stat(url.GetPath(), info);
294 Error(
"Unlink",
"%s", st.GetErrorMessage().c_str());
298 if (info->TestFlags(StatInfo::IsDir))
305 Error(
"Unlink",
"%s", st.GetErrorMessage().c_str());
333 using namespace XrdCl;
334 LocationInfo *info = 0;
338 XRootDStatus st =
fFileSystem->Locate(pathUrl.GetPath(), OpenFlags::None,
341 Error(
"Locate",
"%s", st.GetErrorMessage().c_str());
347 URL locUrl(info->Begin()->GetAddress());
348 TString loc = locUrl.GetHostName();
360#if XrdVNUMBER >= 40000
362 netaddr.Set(loc.
Data());
363 const char*
name = netaddr.Name();
367 hn =
new TNamed(loc, loc);
370 char *addr[1] = {0}, *
name[1] = {0};
371 int naddr = XrdSysDNS::getAddrName(loc.
Data(), 1, addr,
name);
375 hn =
new TNamed(loc, loc);
418 using namespace XrdCl;
419 std::vector<std::string> fileList;
427 Warning(
"Stage",
"object is of unexpected type %s - ignoring",
432 fileList.push_back(std::string(URL(path.
Data()).GetPath()));
436 XRootDStatus st =
fFileSystem->Prepare(fileList, PrepareFlags::Stage,
437 (uint8_t) priority, response);
439 Error(
"Stage",
"%s", st.GetErrorMessage().c_str());
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
TSystem * ROOT_Plugin_TNetXNGSystem(const char *url, Bool_t owner)
PluginManager creation function.
#define R__LOCKGUARD(mutex)
Collection abstract base class.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static TString GetPathName(TObject *o)
Return the path name contained in object 'o' allowing for TUrl, TObjString or TFileInfo.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * FindObject(const char *name) const override
Find object using its name.
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Bool_t ConsistentWith(const char *path, void *dirptr) override
Check consistency of this helper with the one required by 'path' or 'dirptr'.
int Unlink(const char *path) override
Unlink a file on the remote server.
XrdCl::FileSystem * fFileSystem
static TMutex fgAddrMutex
void * OpenDirectory(const char *dir) override
Open a directory.
std::set< void * > fDirPtrs
static THashList fgAddrFQDN
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file (stat)
const char * GetDirEntry(void *dirp) override
Get a directory entry.
virtual Int_t Stage(const char *path, UChar_t priority)
Issue a stage request for a single file.
virtual Int_t Locate(const char *path, TString &endurl)
Get the endpoint URL of a file.
void FreeDirectory(void *dirp) override
Free a directory.
TNetXNGSystem(Bool_t owner=kTRUE)
Constructor: Create system class without connecting to server.
virtual ~TNetXNGSystem()
Destructor.
Bool_t IsPathLocal(const char *path) override
Is this path a local path?
Int_t MakeDirectory(const char *dir) override
Create a directory.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
Abstract base class defining a generic interface to the underlying Operating System.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
void SetHost(const char *host)