Skip to content

Commit 89859ef

Browse files
committed
Server refactoring: Added sample native service module; fixed typo
1 parent af5eed1 commit 89859ef

14 files changed

Lines changed: 172 additions & 21 deletions

‎CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ IF (WIN32)
445445
SET (DEFAULT_PLUGIN_SUBDIR plugins)
446446
SET (DEFAULT_INCLUDE_SUBDIR include)
447447

448+
SET (DEFAULT_SERVER_MODULE_SUBDIR server)
449+
448450
IF (MSVC)
449451
SET (DEFAULT_BIN_SUBDIR bin)
450452
SET (DEFAULT_CGIBIN_SUBDIR bin)
@@ -518,6 +520,9 @@ ELSE (WIN32)
518520
SET (DEFAULT_PLUGIN_SUBDIR ../PlugIns/qgis)
519521
SET (QGIS_PLUGIN_SUBDIR_REV ../../MacOS)
520522
SET (DEFAULT_INCLUDE_SUBDIR include/qgis)
523+
524+
SET (DEFAULT_SERVER_MODULE_SUBDIR ../PlugIns/server)
525+
521526
# path for framework references when running from build directory
522527
# changed later to reference in-app resources upon install
523528
SET (CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib)
@@ -541,6 +546,8 @@ ELSE (WIN32)
541546
SET (DEFAULT_LIBEXEC_SUBDIR lib${LIB_SUFFIX}/qgis)
542547
SET (DEFAULT_PLUGIN_SUBDIR lib${LIB_SUFFIX}/qgis/plugins)
543548
SET (DEFAULT_INCLUDE_SUBDIR include/qgis)
549+
550+
SET (DEFAULT_SERVER_MODULE_SUBDIR lib${LIB_SUFFIX}/qgis/server)
544551
ENDIF (APPLE)
545552

546553
ENDIF (WIN32)
@@ -587,6 +594,8 @@ SET (QGIS_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING "Subdirectory wh
587594
SET (QGIS_PLUGIN_SUBDIR ${DEFAULT_PLUGIN_SUBDIR} CACHE STRING "Subdirectory where plugins will be installed")
588595
SET (QGIS_INCLUDE_SUBDIR ${DEFAULT_INCLUDE_SUBDIR} CACHE STRING "Subdirectory where header files will be installed")
589596

597+
SET (QGIS_SERVER_MODULE_SUBDIR ${DEFAULT_SERVER_MODULE_SUBDIR} CACHE STRING "Subdirectory where server modules will be installed")
598+
590599
# mark *_SUBDIR variables as advanced as this is not something
591600
# that an average user would use
592601
MARK_AS_ADVANCED (QGIS_BIN_SUBDIR QGIS_CGIBIN_SUBDIR QGIS_LIB_SUBDIR QGIS_LIBEXEC_SUBDIR QGIS_DATA_SUBDIR QGIS_PLUGIN_SUBDIR QGIS_INCLUDE_SUBDIR)
@@ -600,6 +609,8 @@ SET (QGIS_DATA_DIR ${QGIS_DATA_SUBDIR})
600609
SET (QGIS_PLUGIN_DIR ${QGIS_PLUGIN_SUBDIR})
601610
SET (QGIS_INCLUDE_DIR ${QGIS_INCLUDE_SUBDIR})
602611

612+
SET (QGIS_SERVER_MODULE_DIR ${QGIS_SERVER_MODULE_SUBDIR})
613+
603614
# set the default locations where the targets (executables, libraries) will land when compiled
604615
# this is to allow running qgis from the source tree without having to actually do a "make install"
605616
SET (QGIS_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output)

‎python/server/qgsserverrequest.sip‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class QgsServerRequest
3737
/**
3838
* Constructor
3939
*
40-
* @param url the lurl string
40+
* @param url the url string
4141
* @param method the request method
4242
*/
4343
QgsServerRequest( const QString& url, Method method );

‎python/server/qgsserverresponse.sip‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class QgsServerResponse
3838

3939
/** Set Header entry
4040
* Add Header entry to the response
41-
* Note that it is usually an error to set Header after writng data
41+
* Note that it is usually an error to set Header after writing data
4242
*/
4343
virtual void setHeader( const QString& key, const QString& value ) = 0;
4444

@@ -49,8 +49,8 @@ class QgsServerResponse
4949

5050
/**
5151
* Send error
52-
* This method delegate error handling at the server level. This is different
53-
* from calling setReturnCodei() along with and a specific response body.
52+
* This method delegates error handling at the server level. This is different
53+
* from calling setReturnCode() along with and a specific response body.
5454
* @param code HHTP return code value
5555
* @param message An informative error message
5656
*/
@@ -65,9 +65,9 @@ class QgsServerResponse
6565

6666
/**
6767
* Write chunk of data
68-
* They is a convenient method that will write directly to the
68+
* This is a convenient method that will write directly to the
6969
* underlying I/O device
70-
* @return the number of bytes that were actually writtene
70+
* @return the number of bytes that were actually written
7171
*/
7272
virtual qint64 write(const QByteArray& byteArray );
7373

‎python/server/qgsservicemodule.sip‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* QgsServiceModule
2323
* Class defining the service module interface for QGIS server services
2424
*
25-
* This class act as a service registrar for services.
25+
* This class acts as a service registrar for services.
2626
*
2727
* For dynamic modules, a QgsServiceModule instance is returned from the QGS_ServiceModule_Init() entry point
2828
*/

‎python/server/qgsserviceregistry.sip‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* \ingroup server
2222
* QgsServiceRegistry
23-
* Class defining the cegistry manager for QGIS server services
23+
* Class defining the registry manager for QGIS server services
2424
*
2525
* This class provides methods for registering and retrieving
2626
* services.

‎src/server/CMakeLists.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ IF (ENABLE_TESTS)
1414
ADD_DEFINITIONS(-DENABLE_MS_TESTS=1)
1515
ENDIF (ENABLE_TESTS)
1616

17+
ADD_SUBDIRECTORY(services)
18+
1719
########################################################
1820
# Files
1921

@@ -49,7 +51,6 @@ SET ( qgis_mapserv_SRCS
4951
qgssldconfigparser.cpp
5052
qgsconfigparserutils.cpp
5153
qgsserver.cpp
52-
#XXX https://github.com/qgis/QGIS-Enhancement-Proposals/issues/74
5354
qgsservice.cpp
5455
qgsservicemodule.cpp
5556
qgsserviceloader.cpp

‎src/server/qgsserverrequest.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929

3030
// Note about design: this intreface must be passed along to python and thus signatures methods must be
31-
// compatible with pyQGS/pyQT api and rules.
31+
// compatible with pyQGIS/pyQT api and rules.
3232

3333
class SERVER_EXPORT QgsServerRequest
3434
{
@@ -41,7 +41,7 @@ class SERVER_EXPORT QgsServerRequest
4141
/**
4242
* Constructor
4343
*
44-
* @param url the lurl string
44+
* @param url the url string
4545
* @param method the request method
4646
*/
4747
QgsServerRequest( const QString& url, Method method );

‎src/server/qgsserverresponse.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SERVER_EXPORT QgsServerResponse
4444

4545
/** Set Header entry
4646
* Add Header entry to the response
47-
* Note that it is usually an error to set Header after writng data
47+
* Note that it is usually an error to set Header after writing data
4848
*/
4949
virtual void setHeader( const QString& key, const QString& value ) = 0;
5050

@@ -55,8 +55,8 @@ class SERVER_EXPORT QgsServerResponse
5555

5656
/**
5757
* Send error
58-
* This method delegate error handling at the server level. This is different
59-
* from calling setReturnCodei() along with and a specific response body.
58+
* This method delegates error handling at the server level. This is different
59+
* from calling setReturnCode() along with and a specific response body.
6060
* @param code HHTP return code value
6161
* @param message An informative error message
6262
*/
@@ -70,10 +70,10 @@ class SERVER_EXPORT QgsServerResponse
7070
virtual void write( const QString& data );
7171

7272
/**
73-
* Write chunk af data
73+
* Write chunk of data
7474
* This is a convenient method that will write directly
7575
* to the underlying I/O device
76-
* @creturn the number of bytes that were actually written
76+
* @return the number of bytes that were actually written
7777
*/
7878
virtual qint64 write( const QByteArray &byteArray );
7979

@@ -84,7 +84,7 @@ class SERVER_EXPORT QgsServerResponse
8484
* to the underlying I/O device
8585
* @return the number of bytes written
8686
*
87-
* @note not available in pything bindings
87+
* @note not available in python bindings
8888
*/
8989
virtual qint64 write( const char* data, qint64 maxsize);
9090

@@ -95,7 +95,7 @@ class SERVER_EXPORT QgsServerResponse
9595
* to the underlying I/O device
9696
* @return the number of bytes written
9797
*
98-
* @note not available in pything bindings
98+
* @note not available in python bindings
9999
*/
100100
virtual qint64 write( const char* data );
101101

‎src/server/qgsservicemodule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class QgsServiceRegistry;
2828
* QgsServiceModule
2929
* Class defining the service module interface for QGIS server services
3030
*
31-
* This class act as a service registrar for services.
31+
* This class acts as a service registrar for services.
3232
*
3333
* For dynamic modules, a QgsServiceModule instance is returned from the QGS_ServiceModule_Init() entry point
3434
*/

‎src/server/qgsserviceregistry.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class QgsService;
3333
/**
3434
* \ingroup server
3535
* QgsServiceRegistry
36-
* Class defining the cegistry manager for QGIS server services
36+
* Class defining the registry manager for QGIS server services
3737
*
3838
* This class provides methods for registering and retrieving
3939
* services.
@@ -59,7 +59,7 @@ class SERVER_EXPORT QgsServiceRegistry
5959
* @param version the version string (optional)
6060
* @return QgsService
6161
*
62-
* If the version is not provided the higher version of the service is rerturnod
62+
* If the version is not provided the higher version of the service is returned
6363
*/
6464
QgsService* getService( const QString& name, const QString& version = QString() );
6565

0 commit comments

Comments
 (0)