36 #include "XrdOuc/XrdOucString.hh"
37 #include "XrdClient/XrdClientVector.hh"
38 #include "XrdClient/XrdClientAdmin.hh"
40 #include "XrdClient/XrdClientConst.hh"
41 #include "XrdClient/XrdClientEnv.hh"
42 #include "XProtocol/XProtocol.hh"
60 SetTitle(
"(x)rootd system administration");
73 SetTitle(
"(x)rootd system administration");
95 Error(
"TXNetSystem",
"fatal error: connection creation failed.");
114 Error(
"Connect",
"fatal error: new object creation failed.");
119 Int_t maxOld = EnvGetLong(NAME_FIRSTCONNECTMAXCNT);
123 EnvPutInt(NAME_FIRSTCONNECTMAXCNT, 1);
124 if (cadm->Connect()) {
126 EnvPutInt(NAME_FIRSTCONNECTMAXCNT, maxOld);
128 EnvPutInt(NAME_FIRSTCONNECTMAXCNT, maxOld);
131 (cadm->GetClientConn()->GetServerType() ==
kSTRootd);
132 Int_t sd = cadm->GetClientConn()->GetOpenSockFD();
133 if (isRootd && sd > -1) {
140 gROOT->GetListOfSockets()->Remove(s);
147 Error(
"TXNetSystem",
"getting protocol of the rootd server");
153 TUrl uut((cadm->GetClientConn()
154 ->GetCurrentUrl()).GetUrl().c_str());
158 Info(
"Connect",
" url: %s",uu.Data());
182 Error(
"Connect",
"some severe error occurred while opening"
183 " the connection at %s - exit", url);
184 if (cadm && cadm->LastServerError())
185 Printf(
" '%s'", cadm->LastServerError()->errmsg);
187 Printf(
" (error message not available)");
193 "while opening the connection at %s - exit", url);
215 Info(
"TXNetFile",
"(C) 2005 SLAC TXNetSystem (eXtended TNetSystem) %s",
216 gROOT->GetVersion());
240 if (existDirs.GetSize()>0 && existDirs[0])
249 Info(
"OpenDirectory",
"calling TNetSystem::OpenDirectory");
260 Error(
"FreeDirectory",
"invalid directory pointer (%p, %p)", dirp,
fDirp);
275 Info(
"FreeDirectory",
"calling TNetSystem::FreeDirectory");
300 Info(
"MakeDirectory",
"Calling TNetSystem::MakeDirectory");
312 Error(
"GetDirEntry",
"invalid directory pointer");
340 if (
gDebug > 1)
Info(
"GetDirEntry",
"Calling TNetSystem::GetDirEntry");
375 if (flags & kXR_offline) {
378 buf.
fDev = (
id >> 24);
379 buf.
fIno = (
id & 0x00FFFFFF);
403 Info(
"GetPathInfo",
"Calling TNetSystem::GetPathInfo");
414 Info(
"ConsistentWith",
415 "calling for path: %s, dir: %p", path, dirptr);
440 Info(
"AccessPathName",
"calling TNetSystem::AccessPathName");
465 if (ok && !(flags & kXR_offline)) {
466 if (flags & kXR_isDir)
473 return ((ok) ? 0 : -1);
482 Info(
"Unlink",
"calling TNetSystem::Unlink");
495 Info(
"IsOnline",
"path '%s' cannot be stat'ed", path);
500 Info(
"IsOnline",
"path '%s' is offline", path);
516 vs.Push_back(pathname);
517 cg.
ClientAdmin()->Prepare(vs, (kXR_char)option, (kXR_char)priority);
520 Info(
"Prepare",
"Got Status %d for %s",
521 cg.
ClientAdmin()->LastServerResp()->status, pathname.c_str());
522 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
543 Warning(
"Prepare",
"input list is empty!");
559 while ((o = nxt())) {
563 Warning(
"Prepare",
"object is of unexpected type %s - ignoring", o->
ClassName());
574 Info(
"Prepare",
"buffer ready: issuing prepare (opt=%d, prio=%d) ...",
581 Info(
"Prepare",
"Got Status %d",
583 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
601 Warning(
"GetPathsInfo",
"input list is empty!");
610 Info(
"GetPathsInfo",
"Got Status %d",
612 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
653 XrdClientLocate_Info li;
658 XrdClientUrlInfo ui((
const char *)&li.Location[0]);
668 hn =
new TNamed(ui.Host.c_str(), ui.Host.c_str());
687 if (
gDebug > 0)
Info(
"Locate",
"server not Xrootd: method not implemented!");
697 XrdClientAdmin *ca = 0;
709 ca =
new XrdClientAdmin(url);
const char * GetHost() const
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
virtual const char * GetTitle() const
Returns title of object.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
void NotifyLastError()
Print message about last occured error.
void SetRemoteProtocol(Int_t rproto)
const char * GetHostName() const
static TString GetPathName(TObject *o)
Return the path name contained in object 'o' allowing for TUrl, TObjString or TFileInfo.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual int Unlink(const char *path)
Unlink 'path' on the remote server system.
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Bool_t IsOnline(const char *path)
Check if the file defined by 'path' is ready to be used.
TObject * FindObject(const char *name) const
Find object using its name.
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
This class represents an Internet Protocol (IP) address.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
R__EXTERN TVirtualMutex * gROOTMutex
static Int_t GetRootdProtocol(TSocket *s)
Find out the remote rootd protocol version.
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
static TString GetKey(const char *url)
Build from uu a unique ID key used in hash tables.
static THashList fgAdminHash
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
static THashList fgAddrFQDN
TXNetSystem(Bool_t owner=kTRUE)
Create system management class without connecting to server.
XrdClientVector< XrdOucString > VecString_t
void SetServType(Int_t st)
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
const char * Data() const
TXNetSystemConnectGuard(TXNetSystem *xn, const char *url)
Construct a guard object.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
The TNamed class is the base class for all named ROOT classes.
virtual Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
static XrdClientAdmin * GetClientAdmin(const char *url)
Checks if an admin for 'url' exists already.
void Clear()
Clear string without changing its capacity.
virtual ~TXrdClientAdminWrapper()
Destructor: destroy the instance.
virtual Int_t Locate(const char *path, TString &endurl)
Get end-point url of a file.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SetEnv()
Set the relevant environment variables.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
XrdClientAdmin * ClientAdmin() const
XrdClientAdmin * Connect(const char *url)
Init a connection to the server.
Bool_t GetPathsInfo(const char *paths, UChar_t *info)
Retrieve status of a ' '-separated list of files in 'paths'.
~TXNetSystemConnectGuard()
Destructor: close the connection.
R__EXTERN TSystem * gSystem
static void FormUrl(TUrl uut, TString &uu)
Form url for rootd socket.
virtual const char * GetDirEntry(void *dirp)
Get directory entry for directory referenced by dirp.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Collection abstract base class.
char * Form(const char *fmt,...)
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
void * OpenDirectory(const char *name)
Open a directory via rfiod.
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
virtual void * OpenDirectory(const char *dir)
Open a directory.
XrdClientAdmin * fClientAdmin
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Bool_t Prepare(const char *path, UChar_t opt=8, UChar_t prio=0)
Issue a prepare request for file defined by 'path'.
void SetHost(const char *host)
virtual Int_t GetSize() const
void InitXrdClient()
One-time initialization of some communication variables for xrootd protocol.
static RooMathCoreReg dummy
Mother of all ROOT objects.
Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
virtual void FreeDirectory(void *dirp)
Free(Close) the directory referenced by dirp.
virtual void Add(TObject *obj)
virtual Int_t MakeDirectory(const char *dir)
Create a directory. Return 0 on success, -1 otherwise.
virtual Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
void SetUrl(const char *url)
void SetService(const char *service)
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
const char * GetUser() const
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
void FreeDirectory(void *dirp=0)
Free directory via rootd.
const char * GetFile() const
Bool_t R_ISOFF(Int_t mode)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.