|
| 1 | +/*************************************************************************** |
| 2 | + qgsserviceregistry.h |
| 3 | + |
| 4 | + Class defining the service manager for QGIS server services. |
| 5 | + ------------------- |
| 6 | + begin : 2016-12-05 |
| 7 | + copyright : (C) 2016 by David Marteau |
| 8 | + email : david dot marteau at 3liz dot com |
| 9 | + ***************************************************************************/ |
| 10 | + |
| 11 | +/*************************************************************************** |
| 12 | + * * |
| 13 | + * This program is free software; you can redistribute it and/or modify * |
| 14 | + * it under the terms of the GNU General Public License as published by * |
| 15 | + * the Free Software Foundation; either version 2 of the License, or * |
| 16 | + * (at your option) any later version. * |
| 17 | + * * |
| 18 | + ***************************************************************************/ |
| 19 | + |
| 20 | +/** |
| 21 | + * \ingroup server |
| 22 | + * QgsServiceRegistry |
| 23 | + * Class defining the cegistry manager for QGIS server services |
| 24 | + * |
| 25 | + * This class provides methods for registering and retrieving |
| 26 | + * services. Note that the regstiry does not hord ownership of |
| 27 | + * registered service but vill call the 'release' method on cleanup) |
| 28 | + * |
| 29 | + */ |
| 30 | +class QgsServiceRegistry |
| 31 | +{ |
| 32 | +%TypeHeaderCode |
| 33 | +#include "qgsserviceregistry.h" |
| 34 | +#include "qgsservice.h" |
| 35 | +#include "qgsserverrequest.h" |
| 36 | +#include "qgsserverresponse.h" |
| 37 | +%End |
| 38 | + public: |
| 39 | + |
| 40 | + //! Constructor |
| 41 | + QgsServiceRegistry(); |
| 42 | + |
| 43 | + //! Destructor |
| 44 | + ~QgsServiceRegistry(); |
| 45 | + |
| 46 | + /** |
| 47 | + * Retrieve a service from its name |
| 48 | + * @param name the name of the service |
| 49 | + * @param version the required version (optional) |
| 50 | + * @return QgsService |
| 51 | + */ |
| 52 | + QgsService* getService( const QString& name, const QString& version = QString() ); |
| 53 | + |
| 54 | + /** |
| 55 | + * Register a service by its name |
| 56 | + * |
| 57 | + * This method is intended to be called by modules for registering |
| 58 | + * services. A module may register multiple services. |
| 59 | + * The registry gain ownership of services. |
| 60 | + * |
| 61 | + * @param name the name of the service |
| 62 | + * @param service a QgsServerResponse to be registered |
| 63 | + * @param version the service version |
| 64 | + */ |
| 65 | + void registerService( const QString& name, QgsService* service /Transfer/, const QString& version ); |
| 66 | + |
| 67 | + /** |
| 68 | + * Initialize registry, load modules and auto register services |
| 69 | + * @param nativeModulepath the native module path |
| 70 | + * @param pythonModulePath the python module path |
| 71 | + * |
| 72 | + * If pythonModulePath is not specified the environnement variables QGIS_PYTHON_SERVICE_PATH |
| 73 | + * is examined. |
| 74 | + */ |
| 75 | + void init( const QString& nativeModulepath, const QString& pythonModulePath = QString() ); |
| 76 | + |
| 77 | + /** |
| 78 | + * Clean up registered service and unregister modules |
| 79 | + */ |
| 80 | + void cleanUp(); |
| 81 | +}; |
| 82 | + |
| 83 | + |
0 commit comments