Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MascotRemoteQuery.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Andreas Bertsch, Daniel Jameson, Chris Bielow$
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_FORMAT_MASCOTREMOTEQUERY_H
36 #define OPENMS_FORMAT_MASCOTREMOTEQUERY_H
37 
39 #include <QtCore/QObject>
40 #include <QtCore/QString>
41 #include <QtNetwork/QHttpRequestHeader>
42 #include <QTimer>
43 
44 
45 namespace OpenMS
46 {
57  public QObject,
58  public DefaultParamHandler
59  {
60  Q_OBJECT
61 
62 public:
63 
67  OPENMS_DLLAPI MascotRemoteQuery(QObject* parent = 0);
69 
71  OPENMS_DLLAPI virtual ~MascotRemoteQuery();
73 
74 
76  OPENMS_DLLAPI void setQuerySpectra(const String& exp);
77 
79  OPENMS_DLLAPI const QByteArray& getMascotXMLResponse() const;
80 
82  OPENMS_DLLAPI bool hasError() const;
83 
85  OPENMS_DLLAPI const String& getErrorMessage() const;
86 
88  OPENMS_DLLAPI Int getSearchNumber() const;
89 
90 protected:
91 
92  OPENMS_DLLAPI virtual void updateMembers_();
93 
94 public slots:
95 
96  OPENMS_DLLAPI void run();
97 
98 private slots:
99 
100  OPENMS_DLLAPI void timedOut();
101 
102  OPENMS_DLLAPI void readyReadSlot(const QHttpResponseHeader& resp);
103 
108  OPENMS_DLLAPI void httpRequestFinished(int request_id, bool error);
109 
111  OPENMS_DLLAPI void httpDataReadProgress(int bytes_read, int bytes_total);
112 
114  OPENMS_DLLAPI void httpDataSendProgress(int bytes_sent, int bytes_total);
115 
117  OPENMS_DLLAPI void httpRequestStarted(int request_id);
118 
123  OPENMS_DLLAPI void httpStateChanged(int state);
124 
126  OPENMS_DLLAPI void httpDone(bool error);
127 
129  OPENMS_DLLAPI void readResponseHeader(const QHttpResponseHeader& response_header);
130 
131  OPENMS_DLLAPI void login();
132 
133  OPENMS_DLLAPI void execQuery();
134 
135  OPENMS_DLLAPI void getResults(QString results_path);
136 
137  OPENMS_DLLAPI void followRedirect(const QHttpResponseHeader& resp);
138 
139 signals:
140 
141  OPENMS_DLLAPI void done();
142 
143  OPENMS_DLLAPI void gotRedirect(const QHttpResponseHeader& resp);
144 
145 private:
147  OPENMS_DLLAPI MascotRemoteQuery& operator=(const MascotRemoteQuery& rhs);
149  OPENMS_DLLAPI MascotRemoteQuery(const MascotRemoteQuery& rhs);
150 
151  OPENMS_DLLAPI void endRun_();
152 
154  OPENMS_DLLAPI void logHeader_(const QHttpHeader& header,
155  const String& what);
161  void removeHostName_(QString& url);
162 
163  OPENMS_DLLAPI Int getSearchNumberFromFilePath_(const String& path) const;
164 
166  QByteArray mascot_xml_;
167  QHttp* http_;
168  QString cookie_;
170  QTimer timeout_;
173 
181  bool use_ssl_;
184  };
185 
186 }
187 #endif /*OPENMS_FORMAT_MASCOTREMOTEQUERY_H*/
virtual void updateMembers_()
This method is used to update extra member variables at the end of the setParameters() method...
MascotRemoteQuery & operator=(const MascotRemoteQuery &rhs)
assignment operator
void followRedirect(const QHttpResponseHeader &resp)
QHttp * http_
Definition: MascotRemoteQuery.h:167
const QByteArray & getMascotXMLResponse() const
returns the Mascot XML response which contains the identifications
A more convenient string class.
Definition: String.h:57
void httpStateChanged(int state)
void getResults(QString results_path)
MascotRemoteQuery(QObject *parent=0)
default constructor
Int search_number_
Definition: MascotRemoteQuery.h:172
const String & getErrorMessage() const
returns the error message, if hasError can be used to check whether an error has occurred ...
Int getSearchNumberFromFilePath_(const String &path) const
Int getSearchNumber() const
returns the search number
bool hasError() const
predicate which returns true if an error occurred during the query
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
String query_spectra_
Definition: MascotRemoteQuery.h:165
QTimer timeout_
Definition: MascotRemoteQuery.h:170
String server_path_
Path on mascot server.
Definition: MascotRemoteQuery.h:175
void removeHostName_(QString &url)
Remove host name information from an url, e.g., "http://www.google.de/search" -> "search".
void httpRequestFinished(int request_id, bool error)
void gotRedirect(const QHttpResponseHeader &resp)
void logHeader_(const QHttpHeader &header, const String &what)
Write HTTP header to error stream (for debugging)
QByteArray mascot_xml_
Definition: MascotRemoteQuery.h:166
String error_message_
Definition: MascotRemoteQuery.h:169
QString cookie_
Definition: MascotRemoteQuery.h:168
void httpDone(bool error)
slot connected to signal done of QHttp
void setQuerySpectra(const String &exp)
sets the query spectra, given in MGF file format
void httpDataReadProgress(int bytes_read, int bytes_total)
slot connected to signal dataReadProgress of QHttp
bool requires_login_
Login required.
Definition: MascotRemoteQuery.h:179
String host_name_
Hostname of the mascot server.
Definition: MascotRemoteQuery.h:177
void httpRequestStarted(int request_id)
slot connected to signal requestStarted of QHttp, which indicates that the processing of request requ...
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Class which handles the communication between OpenMS and the Mascot server.
Definition: MascotRemoteQuery.h:56
Int to_
Definition: MascotRemoteQuery.h:171
bool use_ssl_
Use SSL connection.
Definition: MascotRemoteQuery.h:181
int Int
Signed integer type.
Definition: Types.h:103
void httpDataSendProgress(int bytes_sent, int bytes_total)
slot connected to signal dataSendProgress of QHttp
void readResponseHeader(const QHttpResponseHeader &response_header)
slot connect to responseHeaderRecieved, which indicates that a new response header is available ...
virtual ~MascotRemoteQuery()
destructor
void readyReadSlot(const QHttpResponseHeader &resp)
String boundary_
boundary string that will be embedded into the HTTP requests
Definition: MascotRemoteQuery.h:183

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:01 using doxygen 1.8.13