Skip to content
Permalink
Browse files
Merge pull request #4344 from rldhont/server-wfs-configparser
[Server] WFS refactoring and QgsWfsProjectParser removal
  • Loading branch information
rldhont committed Apr 14, 2017
2 parents 1eaa486 + 7a48d07 commit cc55ae1932042c9106d2da30d2e586c6ce8bbde9
@@ -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:
@@ -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.

This file was deleted.

@@ -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
@@ -34,7 +34,6 @@ SET(qgis_mapserv_SRCS
qgsremotedatasourcebuilder.cpp
qgssentdatasourcebuilder.cpp
qgsserverlogger.cpp
qgswfsprojectparser.cpp
qgswmsconfigparser.cpp
qgswmsprojectparser.cpp
qgsserverprojectparser.cpp
@@ -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"
@@ -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
@@ -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 );
@@ -27,7 +27,6 @@

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

class QgsServerProjectParser;
class QgsAccessControl;
@@ -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
@@ -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
@@ -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( "/" ), "" );
@@ -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.
Loading

0 comments on commit cc55ae1

Please sign in to comment.