36#include "XrdOuc/XrdOucString.hh"
38#include "XrdClient/XrdClientAdmin.hh"
42#include "XProtocol/XProtocol.hh"
69 SetTitle(
"(x)rootd system administration");
82 SetTitle(
"(x)rootd system administration");
104 Error(
"TXNetSystem",
"fatal error: connection creation failed.");
123 Error(
"Connect",
"fatal error: new object creation failed.");
133 if (
cadm->Connect()) {
149 gROOT->GetListOfSockets()->Remove(s);
156 Error(
"TXNetSystem",
"getting protocol of the rootd server");
163 ->GetCurrentUrl()).GetUrl().c_str());
167 Info(
"Connect",
" url: %s",
uu.Data());
191 Error(
"Connect",
"some severe error occurred while opening"
192 " the connection at %s - exit",
url);
193 if (
cadm &&
cadm->LastServerError())
194 Printf(
" '%s'",
cadm->LastServerError()->errmsg);
196 Printf(
" (error message not available)");
202 "while opening the connection at %s - exit",
url);
224 Info(
"TXNetFile",
"(C) 2005 SLAC TXNetSystem (eXtended TNetSystem) %s",
225 gROOT->GetVersion());
248 cg.ClientAdmin()->GoBackToRedirector();
252 cg.NotifyLastError();
258 Info(
"OpenDirectory",
"calling TNetSystem::OpenDirectory");
269 Error(
"FreeDirectory",
"invalid directory pointer (%p, %p)",
dirp,
fDirp);
284 Info(
"FreeDirectory",
"calling TNetSystem::FreeDirectory");
298 cg.ClientAdmin()->GoBackToRedirector();
302 cg.NotifyLastError();
309 Info(
"MakeDirectory",
"Calling TNetSystem::MakeDirectory");
321 Error(
"GetDirEntry",
"invalid directory pointer");
331 cg.ClientAdmin()->GoBackToRedirector();
333 cg.NotifyLastError();
349 if (
gDebug > 1)
Info(
"GetDirEntry",
"Calling TNetSystem::GetDirEntry");
376 urlpath.SetProtocol(
cg.ClientAdmin()->GetCurrentUrl().Proto.c_str());
377 urlpath.SetHost(
cg.ClientAdmin()->GetCurrentUrl().Host.c_str());
378 urlpath.SetPort(
cg.ClientAdmin()->GetCurrentUrl().Port);
381 cg.ClientAdmin()->GoBackToRedirector();
387 buf.
fDev = (
id >> 24);
388 buf.
fIno = (
id & 0x00FFFFFF);
405 cg.NotifyLastError();
412 Info(
"GetPathInfo",
"Calling TNetSystem::GetPathInfo");
423 Info(
"ConsistentWith",
424 "calling for path: %s, dir: %p", path,
dirptr);
449 Info(
"AccessPathName",
"calling TNetSystem::AccessPathName");
476 ok =
cg.ClientAdmin()->Rmdir(
edir.Data());
478 ok =
cg.ClientAdmin()->Rm(
edir.Data());
479 cg.ClientAdmin()->GoBackToRedirector();
482 return ((ok) ? 0 : -1);
484 cg.ClientAdmin()->GoBackToRedirector();
485 cg.NotifyLastError();
491 Info(
"Unlink",
"calling TNetSystem::Unlink");
504 Info(
"IsOnline",
"path '%s' cannot be stat'ed", path);
509 Info(
"IsOnline",
"path '%s' is offline", path);
527 cg.ClientAdmin()->GoBackToRedirector();
529 Info(
"Prepare",
"Got Status %d for %s",
530 cg.ClientAdmin()->LastServerResp()->status,
pathname.c_str());
531 if (!(
cg.ClientAdmin()->LastServerResp()->status)){
534 cg.NotifyLastError();
552 Warning(
"Prepare",
"input list is empty!");
568 while ((o =
nxt())) {
572 Warning(
"Prepare",
"object is of unexpected type %s - ignoring", o->
ClassName());
577 path =
u.GetFileAndOptions();
583 Info(
"Prepare",
"buffer ready: issuing prepare (opt=%d, prio=%d) ...",
585 cg.ClientAdmin()->Prepare(buf->
Data(), (kXR_char)opt, (kXR_char)
prio);
586 cg.ClientAdmin()->GoBackToRedirector();
590 Info(
"Prepare",
"Got Status %d",
591 cg.ClientAdmin()->LastServerResp()->status);
592 if (!(
cg.ClientAdmin()->LastServerResp()->status)){
595 cg.NotifyLastError();
610 Warning(
"GetPathsInfo",
"input list is empty!");
617 cg.ClientAdmin()->GoBackToRedirector();
619 Info(
"GetPathsInfo",
"Got Status %d",
620 cg.ClientAdmin()->LastServerResp()->status);
621 if (!(
cg.ClientAdmin()->LastServerResp()->status)){
624 cg.NotifyLastError();
640 if (
cg.ClientAdmin()->GetClientConn()->GetServerType() !=
kSTDataXrootd) {
665 if (
cg.ClientAdmin()->Locate((kXR_char *)
edir.Data(),
li)) {
674 if (
strlen(
a.GetHostName()) > 0)
680 Info(
"Locate",
"caching host name: %s",
hn->GetTitle());
683 u.SetHost(
hn->GetTitle());
685 u.SetHost(
ui.Host.c_str());
690 cg.NotifyLastError();
696 if (
gDebug > 0)
Info(
"Locate",
"server not Xrootd: method not implemented!");
735 if (
u.GetPort() > 0) {
767 :
xn->Connect(
xn->fUrl);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Bool_t R_ISOFF(Int_t mode)
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
TSystem * ROOT_Plugin_TXNetSystem(const char *url, Bool_t owner)
PluginManager creation function.
XrdClientVector< XrdOucString > VecString_t
#define NAME_FIRSTCONNECTMAXCNT
#define EnvPutInt(name, val)
Collection abstract base class.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
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...
This class represents an Internet Protocol (IP) address.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void Create(const char *url, TSocket *sock=nullptr)
Create a TNetSystem object.
Int_t MakeDirectory(const char *name) override
Make a directory via rootd.
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Bool_t ConsistentWith(const char *path, void *dirptr) override
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
const char * GetDirEntry(void *dirp=nullptr) override
Get directory entry via rootd. Returns 0 in case no more entries.
void FreeDirectory(void *dirp=nullptr) override
Free directory via rootd.
Bool_t AccessPathName(const char *path, EAccessMode mode) override
Returns FALSE if one can access a file using the specified access mode.
void * OpenDirectory(const char *name) override
Open a directory and return an opaque pointer to a dir structure.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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.
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
void SetServType(Int_t st)
void SetRemoteProtocol(Int_t rproto)
void SetService(const char *service)
void SetUrl(const char *url)
void Clear()
Clear string without changing its capacity.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
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.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
This class represents a WWW compatible URL.
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
const char * GetFile() const
static void SetEnv()
Set the relevant environment variables.
static void FormUrl(TUrl uut, TString &uu)
Form url for rootd socket.
static Int_t GetRootdProtocol(TSocket *s)
Find out the remote rootd protocol version.
~TXNetSystemConnectGuard()
Destructor: close the connection.
XrdClientAdmin * fClientAdmin
TXNetSystemConnectGuard(TXNetSystem *xn, const char *url)
Construct a guard object.
void NotifyLastError()
Print message about last occured error.
virtual Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
static THashList fgAddrFQDN
static XrdClientAdmin * GetClientAdmin(const char *url)
Checks if an admin for 'url' exists already.
virtual int Unlink(const char *path)
Unlink 'path' on the remote server system.
virtual Int_t MakeDirectory(const char *dir)
Create a directory. Return 0 on success, -1 otherwise.
Bool_t GetPathsInfo(const char *paths, UChar_t *info)
Retrieve status of a ' '-separated list of files in 'paths'.
void InitXrdClient()
One-time initialization of some communication variables for xrootd protocol.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
TXNetSystem(Bool_t owner=kTRUE)
Create system management class without connecting to server.
virtual void FreeDirectory(void *dirp)
Free(Close) the directory referenced by dirp.
virtual void * OpenDirectory(const char *dir)
Open a directory.
virtual Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
static THashList fgAdminHash
Bool_t IsOnline(const char *path)
Check if the file defined by 'path' is ready to be used.
virtual const char * GetDirEntry(void *dirp)
Get directory entry for directory referenced by dirp.
Bool_t Prepare(const char *path, UChar_t opt=8, UChar_t prio=0)
Issue a prepare request for file defined by 'path'.
static TString GetKey(const char *url)
Build from uu a unique ID key used in hash tables.
virtual Int_t Locate(const char *path, TString &endurl)
Get end-point url of a file.
XrdClientAdmin * Connect(const char *url)
Init a connection to the server.
virtual ~TXrdClientAdminWrapper()
Destructor: destroy the instance.