1 /***************************************************************************
2                               qgswfs3.cpp
3                               -------------------------
4   begin                : April 15, 2019
5   copyright            : (C) 2019 by Alessandro Pasotti
6   email                : elpaso at itopen dot it
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #include "qgsmodule.h"
19 #include "qgsserverogcapi.h"
20 #include "qgswfs3handlers.h"
21 #include "qgsserverstatichandler.h"
22 
23 /**
24  * \ingroup server
25  * \class QgsWfsModule
26  * \brief Module specialized for WFS3 service
27  * \since QGIS 3.10
28  */
29 class QgsWfs3Module: public QgsServiceModule
30 {
31   public:
registerSelf(QgsServiceRegistry & registry,QgsServerInterface * serverIface)32     void registerSelf( QgsServiceRegistry &registry, QgsServerInterface *serverIface ) override
33     {
34       QgsServerOgcApi *wfs3Api = new QgsServerOgcApi { serverIface,
35                                                        QStringLiteral( "/wfs3" ),
36                                                        QStringLiteral( "OGC WFS3 (Draft)" ),
37                                                        QStringLiteral( "1.0.0" )
38                                                      };
39       // Register handlers
40       wfs3Api->registerHandler<QgsWfs3CollectionsItemsHandler>();
41       wfs3Api->registerHandler<QgsWfs3CollectionsFeatureHandler>();
42       wfs3Api->registerHandler<QgsWfs3CollectionsHandler>();
43       wfs3Api->registerHandler<QgsWfs3DescribeCollectionHandler>();
44       wfs3Api->registerHandler<QgsWfs3ConformanceHandler>();
45       wfs3Api->registerHandler<QgsServerStaticHandler>();
46       // API handler must access to the whole API
47       wfs3Api->registerHandler<QgsWfs3APIHandler>( wfs3Api );
48       wfs3Api->registerHandler<QgsWfs3LandingPageHandler>();
49 
50       // Register API
51       registry.registerApi( wfs3Api );
52     }
53 };
54 
55 
56 
57 // Entry points
QGS_ServiceModule_Init()58 QGISEXTERN QgsServiceModule *QGS_ServiceModule_Init()
59 {
60   static QgsWfs3Module module;
61   return &module;
62 }
QGS_ServiceModule_Exit(QgsServiceModule *)63 QGISEXTERN void QGS_ServiceModule_Exit( QgsServiceModule * )
64 {
65   // Nothing to do
66 }
67