Skip to content

Commit

Permalink
Merge pull request #4344 from rldhont/server-wfs-configparser
Browse files Browse the repository at this point in the history
[Server] WFS refactoring and QgsWfsProjectParser removal
  • Loading branch information
rldhont committed Apr 14, 2017
2 parents 1eaa486 + 7a48d07 commit cc55ae1
Show file tree
Hide file tree
Showing 25 changed files with 2,371 additions and 1,961 deletions.
1 change: 0 additions & 1 deletion python/server/qgsconfigcache.sip
Expand Up @@ -32,7 +32,6 @@ class QgsConfigCache: QObject
~QgsConfigCache();

QgsServerProjectParser* serverConfiguration( const QString& filePath );
QgsWfsProjectParser* wfsConfiguration( const QString& filePath, const QgsAccessControl* accessControl );
QgsWmsConfigParser* wmsConfiguration( const QString& filePath, const QgsAccessControl* accessControl, const QMap<QString, QString>& parameterMap = QMap< QString, QString >() );

private:
Expand Down
24 changes: 24 additions & 0 deletions python/server/qgsserverprojectutils.sip
Expand Up @@ -123,6 +123,30 @@ namespace QgsServerProjectUtils
*/
QString wfsServiceUrl( const QgsProject& project );

/** Returns the Layer ids list defined in a QGIS project as published in WFS.
* @param project the QGIS project
* @return the Layer ids list.
*/
QStringList wfsLayerIds( const QgsProject& project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
QStringList wfstUpdateLayerIds( const QgsProject& project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
QStringList wfstInsertLayerIds( const QgsProject& project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
QStringList wfstDeleteLayerIds( const QgsProject& project );

/** Returns the WCS service url defined in a QGIS project.
* @param project the QGIS project
* @return url if defined in project, an empty string otherwise.
Expand Down
125 changes: 0 additions & 125 deletions python/server/qgswfserver.sip

This file was deleted.

1 change: 0 additions & 1 deletion python/server/server.sip
Expand Up @@ -23,7 +23,6 @@
%Include qgsserverprojectparser.sip
%Include qgswmsconfigparser.sip
%Include qgswmsprojectparser.sip
%Include qgswfsprojectparser.sip
%Include qgsconfigcache.sip
%Include qgsserversettings.sip
%Include qgsserverprojectutils.sip
Expand Down
1 change: 0 additions & 1 deletion src/server/CMakeLists.txt
Expand Up @@ -34,7 +34,6 @@ SET(qgis_mapserv_SRCS
qgsremotedatasourcebuilder.cpp
qgssentdatasourcebuilder.cpp
qgsserverlogger.cpp
qgswfsprojectparser.cpp
qgswmsconfigparser.cpp
qgswmsprojectparser.cpp
qgsserverprojectparser.cpp
Expand Down
28 changes: 0 additions & 28 deletions src/server/qgsconfigcache.cpp
Expand Up @@ -18,7 +18,6 @@
#include "qgsconfigcache.h"
#include "qgsmessagelog.h"
#include "qgsmslayercache.h"
#include "qgswfsprojectparser.h"
#include "qgswmsprojectparser.h"
#include "qgssldconfigparser.h"
#include "qgsaccesscontrol.h"
Expand Down Expand Up @@ -76,32 +75,6 @@ QgsServerProjectParser *QgsConfigCache::serverConfiguration( const QString &file
return new QgsServerProjectParser( doc, filePath );
}

QgsWfsProjectParser *QgsConfigCache::wfsConfiguration(
const QString &filePath
, const QgsAccessControl *accessControl
)
{
QgsWfsProjectParser *p = mWFSConfigCache.object( filePath );
if ( !p )
{
QDomDocument *doc = xmlDocument( filePath );
if ( !doc )
{
return nullptr;
}
p = new QgsWfsProjectParser(
filePath
, accessControl
);
mWFSConfigCache.insert( filePath, p );
p = mWFSConfigCache.object( filePath );
Q_ASSERT( p );
}

QgsMSLayerCache::instance()->setProjectMaxLayers( p->wfsLayers().size() );
return p;
}

QgsWmsConfigParser *QgsConfigCache::wmsConfiguration(
const QString &filePath
, const QgsAccessControl *accessControl
Expand Down Expand Up @@ -182,7 +155,6 @@ QDomDocument *QgsConfigCache::xmlDocument( const QString &filePath )
void QgsConfigCache::removeChangedEntry( const QString &path )
{
mWMSConfigCache.remove( path );
mWFSConfigCache.remove( path );

//xml document must be removed last, as other config cache destructors may require it
mXmlDocumentCache.remove( path );
Expand Down
6 changes: 0 additions & 6 deletions src/server/qgsconfigcache.h
Expand Up @@ -27,7 +27,6 @@

#include "qgis_server.h"
#include "qgswmsconfigparser.h"
#include "qgswfsprojectparser.h"

class QgsServerProjectParser;
class QgsAccessControl;
Expand All @@ -41,10 +40,6 @@ class SERVER_EXPORT QgsConfigCache : public QObject
static QgsConfigCache *instance();

QgsServerProjectParser *serverConfiguration( const QString &filePath );
QgsWfsProjectParser *wfsConfiguration(
const QString &filePath
, const QgsAccessControl *accessControl
);
QgsWmsConfigParser *wmsConfiguration(
const QString &filePath
, const QgsAccessControl *accessControl
Expand All @@ -64,7 +59,6 @@ class SERVER_EXPORT QgsConfigCache : public QObject

QCache<QString, QDomDocument> mXmlDocumentCache;
QCache<QString, QgsWmsConfigParser> mWMSConfigCache;
QCache<QString, QgsWfsProjectParser> mWFSConfigCache;

private slots:
//! Removes changed entry from this cache
Expand Down
25 changes: 25 additions & 0 deletions src/server/qgsserverprojectutils.cpp
Expand Up @@ -97,6 +97,31 @@ QString QgsServerProjectUtils::wfsServiceUrl( const QgsProject &project )
return project.readEntry( QStringLiteral( "WFSUrl" ), QStringLiteral( "/" ), "" );
}

QStringList QgsServerProjectUtils::wfsLayerIds( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WFSLayers" ), QStringLiteral( "/" ) );
}

int QgsServerProjectUtils::wfsLayerPrecision( const QString &layerId, const QgsProject &project )
{
return project.readNumEntry( QStringLiteral( "WFSLayersPrecision" ), "/" + layerId, 6 );
}

QStringList QgsServerProjectUtils::wfstUpdateLayerIds( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Update" ) );
}

QStringList QgsServerProjectUtils::wfstInsertLayerIds( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Insert" ) );
}

QStringList QgsServerProjectUtils::wfstDeleteLayerIds( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Delete" ) );
}

QString QgsServerProjectUtils::wcsServiceUrl( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WCSUrl" ), QStringLiteral( "/" ), "" );
Expand Down
26 changes: 26 additions & 0 deletions src/server/qgsserverprojectutils.h
Expand Up @@ -125,6 +125,32 @@ namespace QgsServerProjectUtils
*/
SERVER_EXPORT QString wfsServiceUrl( const QgsProject &project );

/** Returns the Layer ids list defined in a QGIS project as published in WFS.
* @param project the QGIS project
* @return the Layer ids list.
*/
SERVER_EXPORT QStringList wfsLayerIds( const QgsProject &project );

SERVER_EXPORT int wfsLayerPrecision( const QString &layerId, const QgsProject &project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
SERVER_EXPORT QStringList wfstUpdateLayerIds( const QgsProject &project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
SERVER_EXPORT QStringList wfstInsertLayerIds( const QgsProject &project );

/** Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
* @param project the QGIS project
* @return the Layer ids list.
*/
SERVER_EXPORT QStringList wfstDeleteLayerIds( const QgsProject &project );

/** Returns the WCS service url defined in a QGIS project.
* \param project the QGIS project
* \returns url if defined in project, an empty string otherwise.
Expand Down

0 comments on commit cc55ae1

Please sign in to comment.