ATLAS Offline Software
VP1WebWatcher.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1WebWatcher //
9 // //
10 // Description: Http analogy of QFileSystemWatcher, which //
11 // uses http HEAD requests (in a subthread) at //
12 // regular intervals to monitor for changes //
13 // in files located on a webserver. //
14 // //
15 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
16 // Initial version: June 2008 //
17 // //
19 
20 #ifndef VP1WEBWATCHER_H
21 #define VP1WEBWATCHER_H
22 
23 #include <QObject>
24 #include <QStringList>
25 
26 
27 class QDateTime;
28 
29 class VP1WebWatcher : public QObject {
30 
31  Q_OBJECT
32 
33 public:
34 
35  VP1WebWatcher( int recheckInterval_ms = 30000, QObject * parent = 0 );
36  VP1WebWatcher( const QStringList& urls, int recheckInterval_ms = 30000, QObject * parent = 0 );
37  virtual ~VP1WebWatcher();
38 
39  void addUrl(const QString&);
40  void addUrls(const QStringList&);
41 
42  QStringList urls() const;
43  bool isWatchingUrl(const QString&) const;
44 
45  void removeUrl(const QString&);
46  void removeUrls(const QStringList&);
47 
48  //Get more information:
49  enum RESULT { UNKNOWN,//Might be because no http request was yet done.
51  CONNECTION_PROBLEMS,//Various problems (server not found, no net connection, etc.)
52  NOT_ON_SERVER,//Request returned 404 (file not found on server)
53  EXISTS };//File was found on server
54  RESULT lastResult(const QString& url);
55  QString lastResultToString(const QString& url);
56 
57  QDateTime lastModTime(const QString& url);//Always invalid if lastResult(url)!=EXISTS (might be invalid for EXISTS as well).
58 
59 signals:
60  void urlChanged(const QString& url );
61 
62 private Q_SLOTS:
63  void httpRequestDone(bool);
64 protected:
65  void timerEvent(QTimerEvent*);
66 private:
67  class Imp;
68  Imp * m_d;
69 
70 };
71 
72 #endif
VP1WebWatcher::lastModTime
QDateTime lastModTime(const QString &url)
Definition: VP1WebWatcher.cxx:325
VP1WebWatcher
Definition: VP1WebWatcher.h:29
VP1WebWatcher::CONNECTION_PROBLEMS
@ CONNECTION_PROBLEMS
Definition: VP1WebWatcher.h:51
VP1WebWatcher::timerEvent
void timerEvent(QTimerEvent *)
Definition: VP1WebWatcher.cxx:270
VP1WebWatcher::addUrls
void addUrls(const QStringList &)
Definition: VP1WebWatcher.cxx:236
VP1WebWatcher::m_d
Imp * m_d
Definition: VP1WebWatcher.h:67
VP1WebWatcher::NOT_ON_SERVER
@ NOT_ON_SERVER
Definition: VP1WebWatcher.h:52
VP1WebWatcher::Imp
Definition: VP1WebWatcher.cxx:37
VP1WebWatcher::INVALID_URL
@ INVALID_URL
Definition: VP1WebWatcher.h:50
VP1WebWatcher::removeUrl
void removeUrl(const QString &)
Definition: VP1WebWatcher.cxx:252
VP1WebWatcher::VP1WebWatcher
VP1WebWatcher(int recheckInterval_ms=30000, QObject *parent=0)
Definition: VP1WebWatcher.cxx:177
VP1WebWatcher::RESULT
RESULT
Definition: VP1WebWatcher.h:49
VP1WebWatcher::~VP1WebWatcher
virtual ~VP1WebWatcher()
Definition: VP1WebWatcher.cxx:192
physics_parameters.url
string url
Definition: physics_parameters.py:27
VP1WebWatcher::lastResultToString
QString lastResultToString(const QString &url)
Definition: VP1WebWatcher.cxx:311
VP1WebWatcher::lastResult
RESULT lastResult(const QString &url)
Definition: VP1WebWatcher.cxx:291
VP1WebWatcher::urls
QStringList urls() const
Definition: VP1WebWatcher.cxx:243
VP1WebWatcher::addUrl
void addUrl(const QString &)
Definition: VP1WebWatcher.cxx:226
VP1WebWatcher::UNKNOWN
@ UNKNOWN
Definition: VP1WebWatcher.h:49
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1WebWatcher::removeUrls
void removeUrls(const QStringList &)
Definition: VP1WebWatcher.cxx:263
VP1WebWatcher::urlChanged
void urlChanged(const QString &url)
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
VP1WebWatcher::isWatchingUrl
bool isWatchingUrl(const QString &) const
Definition: VP1WebWatcher.cxx:216
VP1WebWatcher::EXISTS
@ EXISTS
Definition: VP1WebWatcher.h:53
VP1WebWatcher::httpRequestDone
void httpRequestDone(bool)
Definition: VP1WebWatcher.cxx:200