Skip to content

Commit ca8e0c3

Browse files
committed
Added comments for bindings.
1 parent 5b943ed commit ca8e0c3

7 files changed

Lines changed: 147 additions & 69 deletions

‎python/server/qgscapabilitiescache.sip‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
1+
/***************************************************************************
2+
qgscapabilitiescache.sip
13
2-
/**A cache for capabilities xml documents (by configuration file path)*/
4+
A cache for capabilities xml documents (by configuration file path)
5+
-------------------
6+
begin : 2014-09-10
7+
copyright : (C) 2014 by Alessandro Pasotti
8+
email : a dot pasotti at itopen dot it
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
20+
/**
21+
* \class QgsCapabilitiesCache
22+
* \brief A cache for capabilities xml documents (by configuration file path)
23+
*/
324
class QgsCapabilitiesCache: public QObject
425
{
526
%TypeHeaderCode
6-
#include <QDomDocument>
7-
#include <QFileSystemWatcher>
8-
#include <QHash>
9-
#include <QObject>
1027
#include "qgscapabilitiescache.h"
1128
%End
1229
public:

‎python/server/qgsmapserviceexception.sip‎

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1+
/***************************************************************************
2+
qgsmapserviceexception.sip
3+
QGIS Server exception
4+
-------------------
5+
begin : 2014-09-10
6+
copyright : (C) 2014 by Alessandro Pasotti
7+
email : a dot pasotti at itopen dot it
8+
***************************************************************************/
19

2-
/**Exception class for WMS service exceptions. The most important codes are:
3-
"InvalidFormat"
4-
"Invalid CRS"
5-
"LayerNotDefined" / "StyleNotDefined"
6-
"OperationNotSupported"*/
10+
/***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************/
18+
19+
20+
/**
21+
* \class QgsMapServiceException
22+
* \brief Exception class for WMS service exceptions.
23+
*
24+
* The most important codes are:
25+
* * "InvalidFormat"
26+
* * "Invalid CRS"
27+
* * "LayerNotDefined" / "StyleNotDefined"
28+
* * "OperationNotSupported"
29+
*/
730

831
class QgsMapServiceException
932
{
Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
/**This class is an interface hiding the details of reading input and writing output from/to a wms request mechanism.
2-
Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage as a standalone command line executable*/
1+
/***************************************************************************
2+
qgsrequesthandler.sip
3+
4+
This class is an interface hiding the details of reading input and
5+
writing output from/to a wms request mechanism
6+
-------------------
7+
begin : 2014-09-10
8+
copyright : (C) 2014 by Alessandro Pasotti
9+
email : a dot pasotti at itopen dot it
10+
***************************************************************************/
11+
12+
13+
/**
14+
* \class QgsRequestHandler
15+
* \brief This class is an interface hiding the details of reading input and
16+
* writing output from/to a wms request mechanism.
17+
*
18+
* Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage
19+
* as a standalone command line executable
20+
*/
21+
322
class QgsRequestHandler
423
{
524
%TypeHeaderCode
@@ -10,46 +29,61 @@ class QgsRequestHandler
1029

1130
public:
1231

13-
virtual void parseInput() = 0;
14-
virtual void setGetMapResponse( const QString& service, QImage* img, int imageQuality ) = 0;
15-
virtual void setGetCapabilitiesResponse( const QDomDocument& doc ) = 0;
16-
virtual void setGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) = 0;
17-
virtual void setServiceException( QgsMapServiceException ex ) = 0;
18-
virtual void setGetStyleResponse( const QDomDocument& doc ) = 0;
19-
virtual void setGetPrintResponse( QByteArray* ba ) = 0;
20-
virtual bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat ) = 0;
21-
virtual void setGetFeatureResponse( QByteArray* ba ) = 0;
22-
virtual void endGetFeatureResponse( QByteArray* ba ) = 0;
23-
virtual void setGetCoverageResponse( QByteArray* ba ) = 0;
24-
2532
/**Set an HTTP header*/
2633
virtual void setHeader( const QString &name, const QString &value ) = 0;
2734
/**Remove an HTTP header*/
2835
virtual int removeHeader( const QString &name ) = 0;
2936
/**Delete all HTTP headers*/
3037
virtual void clearHeaders( ) = 0;
38+
/**Returns the response body*/
39+
virtual QByteArray* body();
3140
/**Append the bytestream to response body*/
3241
virtual void appendBody( const QByteArray &body) = 0;
3342
/**Clears the response body*/
3443
virtual void clearBody( ) = 0;
44+
/**Set the info format string such as "text/xml"*/
3545
virtual void setInfoFormat( const QString &format ) = 0;
36-
virtual void sendResponse( ) const = 0;
46+
/**Check wether there is any header set or the body is not empty*/
3747
virtual bool responseReady() const = 0;
3848
/**Pointer to last raised exception*/
3949
virtual bool exceptionRaised() const = 0;
50+
/**Return a copy of the parsed parameters as a key-value pair, to modify
51+
* a parameter setParameter( const QString &key, const QString &value)
52+
* and removeParameter(const QString &key) must be used
53+
*/
4054
QMap<QString, QString> parameterMap( );
4155
/**Set a request parameter*/
4256
virtual void setParameter(const QString &key, const QString &value) = 0;
4357
/**Remove a request parameter*/
4458
virtual int removeParameter(const QString &key) = 0;
4559
/**Return a request parameter*/
4660
virtual QString parameter(const QString &key) const = 0;
61+
/**Return the image format*/
4762
QString format() const;
63+
/**Return the format string as requested by the client*/
64+
QString infoFormat() const;
65+
66+
private:
4867

49-
protected:
68+
/* Not yet part of the API */
5069

5170
virtual void sendHeaders( ) const = 0;
5271
virtual void sendBody( ) const = 0;
5372

73+
/**Send out the response writing to FCGI stdout*/
74+
virtual void sendResponse( ) const = 0;
75+
76+
virtual void parseInput() = 0;
77+
virtual void setGetMapResponse( const QString& service, QImage* img, int imageQuality ) = 0;
78+
virtual void setGetCapabilitiesResponse( const QDomDocument& doc ) = 0;
79+
virtual void setGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) = 0;
80+
virtual void setServiceException( QgsMapServiceException ex ) = 0;
81+
virtual void setGetStyleResponse( const QDomDocument& doc ) = 0;
82+
virtual void setGetPrintResponse( QByteArray* ba ) = 0;
83+
virtual bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat ) = 0;
84+
virtual void setGetFeatureResponse( QByteArray* ba ) = 0;
85+
virtual void endGetFeatureResponse( QByteArray* ba ) = 0;
86+
virtual void setGetCoverageResponse( QByteArray* ba ) = 0;
87+
5488

5589
};

‎python/server/qgsserverfilter.sip‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
***************************************************************************/
1818

1919
/**
20-
* QgsServerFilter
21-
* Class defining I/O filters for Qgis Mapserver and
22-
* implemented in plugins
20+
* \class QgsServerFilter
21+
* \brief Class defining I/O filters for Qgis Mapserver and
22+
* implemented in plugins.
2323
*
24+
* Filters can define any (or none) of the following hooks:
25+
* * requestReady() - called when request is ready
26+
* * responseReady() - called when the response is ready
2427
*/
2528

2629
class QgsServerFilter
@@ -32,12 +35,21 @@ class QgsServerFilter
3235

3336
public:
3437

35-
/** Constructor */
38+
/** Constructor
39+
* QgsServerInterface passed to plugins constructors
40+
* and must be passed to QgsServerFilter instances.
41+
*/
3642
QgsServerFilter( QgsServerInterface* serverInterface /Transfer/);
3743
/** Destructor */
3844
virtual ~QgsServerFilter();
45+
/** Return the QgsServerInterface instance*/
3946
QgsServerInterface* serverInterface( );
47+
/** Method called when the QgsRequestHandler is ready and populated with
48+
* parameters, just before entering the main switch for core services.*/
4049
virtual void requestReady();
50+
/** Method called when the QgsRequestHandler processing has done and
51+
* the response is ready, just after the main switch for core services.
52+
*/
4153
virtual void responseReady();
4254

4355
};

‎python/server/qgsserverinterface.sip‎

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1+
/***************************************************************************
2+
qgsserverinterface.sip
3+
4+
Class defining the interface made available to server plugins.
5+
-------------------
6+
begin : 2014-09-10
7+
copyright : (C) 2014 by Alessandro Pasotti
8+
email : a dot pasotti at itopen dot it
9+
***************************************************************************/
10+
11+
/***************************************************************************
12+
* *
13+
* This program is free software; you can redistribute it and/or modify *
14+
* it under the terms of the GNU General Public License as published by *
15+
* the Free Software Foundation; either version 2 of the License, or *
16+
* (at your option) any later version. *
17+
* *
18+
***************************************************************************/
19+
120
/**
221
* \class QgsServerInterface
3-
* \brief Class defining interfaces
4-
* made available to server plugins.
22+
* \brief Class defining the interface made available to server plugins.
523
*
6-
* Only functionality exposed by QgisServerInterface can be used in server plugins.
24+
* This class provides methods to access the request handler and
25+
* the capabilties cache. A method to read the environment
26+
* variables set in the main FCGI loop is also available.
27+
* Plugins can add listeners (instances of QgsServerFilter) with
28+
* a certain priority through the registerFilter( QgsServerFilter* , int) method.
729
*/
830

931

@@ -16,10 +38,15 @@ class QgsServerInterface
1638
%End
1739

1840
public:
19-
virtual QgsCapabilitiesCache* capabiblitiesCache() = 0 /KeepReference/;
41+
/**Returns the current request handler*/
2042
virtual QgsRequestHandler* requestHandler( ) = 0 /KeepReference/;
43+
/**Returns the capabilities cache*/
44+
virtual QgsCapabilitiesCache* capabiblitiesCache() = 0 /KeepReference/;
2145
// Tansfer ownership to avoid garbage collector to call dtor
46+
/** Register a filter with the given priority. The filter's requestReady()
47+
* and responseReady() methods will be called from the loop*/
2248
virtual void registerFilter( QgsServerFilter* filter /Transfer/, int priority = 0 ) = 0;
49+
/**Return an environment variable set by FCGI*/
2350
virtual QString getEnv(const QString& name ) const = 0;
2451
// Commented because of problems with typedef QgsServerFiltersMap, provided
2552
// methods to alter the filters map into QgsRequestHandler API

‎python/server/qgsserverlogger.sip‎

Lines changed: 0 additions & 34 deletions
This file was deleted.

‎python/server/server.sip‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
%Import core/core.sip
1111

1212
%Include qgsserverfilter.sip
13-
%Include qgsserverlogger.sip
1413
%Include qgsmapserviceexception.sip
1514
%Include qgscapabilitiescache.sip
1615
%Include qgsrequesthandler.sip

0 commit comments

Comments
 (0)