QGIS API Documentation 4.1.0-Master (26185ffb827)
Loading...
Searching...
No Matches
qgsserverinterfaceimpl.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsseerversinterface.h
3 Interface class for exposing functions in QGIS Server for use by plugins
4 -------------------
5 begin : 2014-09-10
6 copyright : (C) 2014 by Alessandro Pasotti
7 email : a dot pasotti at itopen dot it
8 ***************************************************************************/
9
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
21
22#include "qgsconfigcache.h"
23
26 : mCapabilitiesCache( capCache )
27 , mServiceRegistry( srvRegistry )
28 , mServerSettings( settings )
29{
30 mRequestHandler = nullptr;
31#ifdef HAVE_SERVER_PYTHON_PLUGINS
32 mAccessControls = std::make_unique<QgsAccessControl>();
33 mCacheManager = std::make_unique<QgsServerCacheManager>( *settings );
34#endif
35}
36
37QString QgsServerInterfaceImpl::getEnv( const QString &name ) const
38{
39 return getenv( name.toLocal8Bit() );
40}
41
42
45
46
48{
49 mRequestHandler = nullptr;
50}
51
56
58{
59 mConfigFilePath = configFilePath;
60}
61
63{
64 mFilters.insert( priority, filter );
65}
66
71
74{
75#ifdef HAVE_SERVER_PYTHON_PLUGINS
76 mAccessControls->registerAccessControl( accessControl, priority );
77#else
78 Q_UNUSED( accessControl )
79 Q_UNUSED( priority )
80#endif
81}
82
85{
86#ifdef HAVE_SERVER_PYTHON_PLUGINS
87 mCacheManager->registerServerCache( serverCache, priority );
88#else
89 Q_UNUSED( serverCache )
90 Q_UNUSED( priority )
91#endif
92}
93
95{
96 return mCacheManager.get();
97}
98
100{
101 if ( mCapabilitiesCache )
102 {
103 mCapabilitiesCache->removeCapabilitiesDocument( path );
104 }
106}
107
109{
110 return mServiceRegistry;
111}
112
114{
115 return mServerSettings;
116}
117
119{
120 mServerSettings->load();
121}
Defines access control interface for QGIS Server plugins.
A cache for capabilities xml documents (by configuration file path).
void removeEntry(const QString &path)
Removes an entry from cache.
static QgsConfigCache * instance()
Returns the current instance.
An interface hiding the details of reading input and writing output from/to a wms request mechanism.
Defines cache interface for QGIS Server plugins.
A helper class that centralizes caches accesses given by all the server cache filter plugins.
Defines I/O filters for QGIS Server and implemented in plugins.
void registerServerCache(QgsServerCacheFilter *serverCache, int priority=0) override
Registers a server cache filter.
QgsServerSettings * serverSettings() override
Returns the server settings.
void removeConfigCacheEntry(const QString &path) override
Remove entry from config cache.
QgsServerInterfaceImpl(QgsCapabilitiesCache *capCache, QgsServiceRegistry *srvRegistry, QgsServerSettings *serverSettings)
Constructor.
void reloadSettings() override
Reloads the server settings re-reading the configuration.
void setRequestHandler(QgsRequestHandler *requestHandler) override
Set the request handler.
QString getEnv(const QString &name) const override
Returns an enrironment variable, used to pass environment variables to Python.
QgsRequestHandler * requestHandler() override
Returns the QgsRequestHandler, to be used only in server plugins.
void clearRequestHandler() override
Clear the request handler.
QgsServerFiltersMap filters() override
Returns the list of current QgsServerFilter.
QgsServiceRegistry * serviceRegistry() override
Returns the service registry.
void registerAccessControl(QgsAccessControlFilter *accessControl, int priority=0) override
Register an access control filter.
QgsServerCacheManager * cacheManager() const override
Gets the helper over all the registered server cache filters.
void setFilters(QgsServerFiltersMap *filters) override
Set the filters map.
QString configFilePath() override
Returns the configuration file path.
void setConfigFilePath(const QString &configFilePath) override
Set the configuration file path.
void registerFilter(QgsServerFilter *filter, int priority=0) override
Register a QgsServerFilter.
Provides a way to retrieve settings by prioritizing according to environment variables,...
void load()
Load settings according to current environment variables.
A registry manager for QGIS server services.
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap