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-2015.
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 
87 protected:
88 
89  OPENMS_DLLAPI virtual void updateMembers_();
90 
91 public slots:
92 
93  OPENMS_DLLAPI void run();
94 
95 private slots:
96 
97  OPENMS_DLLAPI void timedOut();
98 
99  OPENMS_DLLAPI void readyReadSlot(const QHttpResponseHeader& resp);
100 
105  OPENMS_DLLAPI void httpRequestFinished(int request_id, bool error);
106 
108  OPENMS_DLLAPI void httpDataReadProgress(int bytes_read, int bytes_total);
109 
111  OPENMS_DLLAPI void httpDataSendProgress(int bytes_sent, int bytes_total);
112 
114  OPENMS_DLLAPI void httpRequestStarted(int request_id);
115 
120  OPENMS_DLLAPI void httpStateChanged(int state);
121 
123  OPENMS_DLLAPI void httpDone(bool error);
124 
126  OPENMS_DLLAPI void readResponseHeader(const QHttpResponseHeader& response_header);
127 
128  OPENMS_DLLAPI void login();
129 
130  OPENMS_DLLAPI void execQuery();
131 
132  OPENMS_DLLAPI void getResults(QString results_path);
133 
134  OPENMS_DLLAPI void followRedirect(const QHttpResponseHeader& resp);
135 
136 signals:
137 
138  OPENMS_DLLAPI void done();
139 
140  OPENMS_DLLAPI void gotRedirect(const QHttpResponseHeader& resp);
141 
142 private:
144  OPENMS_DLLAPI MascotRemoteQuery& operator=(const MascotRemoteQuery& rhs);
146  OPENMS_DLLAPI MascotRemoteQuery(const MascotRemoteQuery& rhs);
147 
148  OPENMS_DLLAPI void endRun_();
149 
151  OPENMS_DLLAPI void logHeader_(const QHttpHeader& header,
152  const String& what);
158  void removeHostName_(QString& url);
159 
161  QByteArray mascot_xml_;
162  QHttp* http_;
163  QString cookie_;
165  QTimer timeout_;
167 
175  bool use_ssl_;
178  };
179 
180 }
181 #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:162
A more convenient string class.
Definition: String.h:57
void httpStateChanged(int state)
const QByteArray & getMascotXMLResponse() const
returns the Mascot XML response which contains the identifications
void getResults(QString results_path)
MascotRemoteQuery(QObject *parent=0)
default constructor
String query_spectra_
Definition: MascotRemoteQuery.h:160
QTimer timeout_
Definition: MascotRemoteQuery.h:165
String server_path_
Path on mascot server.
Definition: MascotRemoteQuery.h:169
void removeHostName_(QString &url)
Remove host name information from an url, e.g., &quot;http://www.google.de/search&quot; -&gt; &quot;search&quot;.
bool hasError() const
predicate which returns true if an error occurred during the query
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:161
String error_message_
Definition: MascotRemoteQuery.h:164
const String & getErrorMessage() const
returns the error message, if hasError can be used to check whether an error has occurred ...
QString cookie_
Definition: MascotRemoteQuery.h:163
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:173
String host_name_
Hostname of the mascot server.
Definition: MascotRemoteQuery.h:171
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:166
bool use_ssl_
Use SSL connection.
Definition: MascotRemoteQuery.h:175
int Int
Signed integer type.
Definition: Types.h:96
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:177

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:40 using doxygen 1.8.5