Skip to content

Commit

Permalink
Merge pull request #24 from rok4/develop
Browse files Browse the repository at this point in the history
Release 5.3.0
  • Loading branch information
Dolite authored Dec 6, 2023
2 parents 555257b + 21e09dc commit aee5afb
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 28 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 5.3.0

### [Added]

* Sur les routes admin de ajout, modification et suppression de couche, on peut demander que les capacités des services ne soient pas regénérés
* Un nouvelle route admin (PUT /admin/layers) sans paramètre permet de demander la réécriture des capacités des services

### [Changed]

* Ajout de l'ID de thread dans les logs

## 5.2.1

### [Changed]
Expand Down Expand Up @@ -39,7 +50,7 @@ Implémentation partielle de l'API OGC Tiles - Part 1 [v1.0.0 final release](htt
* /ogcapitiles/collections/{layer}/map/tiles
* /ogcapitiles/collections/{layer}/tiles
* /ogcapitiles/tilematrixsets
* /ogcapitiles/tilematrixsets/{tms}
* /ogcapitiles/tilematrixsets/{tms}

* Liste des nouvelles routes pour obtenir le **GetTile** :

Expand Down
32 changes: 32 additions & 0 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,17 @@ paths:

######################################### ADMIN

/admin/layers:
put:
tags:
- Administration
summary: Re-génére les capacités des services
operationId: admin_build_capabilities

responses:
204:
description: Réécriture des capacités réussie

/admin/layers/{layername}:
post:
tags:
Expand All @@ -1391,6 +1402,13 @@ paths:
description: Identifiant de la nouvelle couche
schema:
type: string
- name: build_capabilities
required: false
in: query
description: Doit-on re-générer les capacités des services (oui par défaut)
schema:
type: boolean
default: true


requestBody:
Expand Down Expand Up @@ -1427,6 +1445,13 @@ paths:
description: Identifiant de la couche à modifier
schema:
type: string
- name: build_capabilities
required: false
in: query
description: Doit-on re-générer les capacités des services (oui par défaut)
schema:
type: boolean
default: true

requestBody:
content:
Expand Down Expand Up @@ -1462,6 +1487,13 @@ paths:
description: Identifiant de la couche à supprimer
schema:
type: string
- name: build_capabilities
required: false
in: query
description: Doit-on re-générer les capacités des services (oui par défaut)
schema:
type: boolean
default: true

responses:
204:
Expand Down
6 changes: 6 additions & 0 deletions src/Request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace RequestType {
"AddLayer",
"UpdateLayer",
"DeleteLayer",
"BuildCapabilities",
"GetStatus",
"GetInfos"
"GetThreads",
Expand Down Expand Up @@ -878,6 +879,11 @@ void Request::determineServiceAndRequest() {
request = RequestType::ADDLAYER;
}

else if (method == "PUT" && pathParts.size() == 2 && pathParts.at(1) == "layers") {
//--> PUT /admin/layers
request = RequestType::BUILDCAPABILITIES;
}

else if (method == "PUT" && pathParts.size() == 3 && pathParts.at(1) == "layers") {
//--> PUT /admin/layers/{layername}
request = RequestType::UPDATELAYER;
Expand Down
1 change: 1 addition & 0 deletions src/Request.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace RequestType {
ADDLAYER,
UPDATELAYER,
DELETELAYER,
BUILDCAPABILITIES,
GETHEALTHSTATUS,
GETINFOSTATUS,
GETTHREADSTATUS,
Expand Down
2 changes: 2 additions & 0 deletions src/Rok4Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ void Rok4Server::processTMS(Request* request, FCGX_Request& fcgxRequest) {
void Rok4Server::processAdmin(Request* request, FCGX_Request& fcgxRequest) {
if (request->request == RequestType::ADDLAYER) {
S.sendresponse(AdminCreateLayer(request), &fcgxRequest);
} else if (request->request == RequestType::BUILDCAPABILITIES) {
S.sendresponse(AdminBuildCapabilities(request), &fcgxRequest);
} else if (request->request == RequestType::UPDATELAYER) {
S.sendresponse(AdminUpdateLayer(request), &fcgxRequest);
} else if (request->request == RequestType::DELETELAYER) {
Expand Down
12 changes: 12 additions & 0 deletions src/Rok4Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,18 @@ class Rok4Server {
*/
DataStream* AdminCreateLayer ( Request* request );

/**
* \~french
* \brief Traitement d'une requête de réécriture des capacités
* \param[in] request représentation de la requête
* \return flux de la réponse
* \~english
* \brief Process a BuildCapabilities admin request
* \param[in] request request representation
* \return response stream
*/
DataStream* AdminBuildCapabilities ( Request* request );

/**
* \~french
* \brief Traitement d'une requête de suppression de couche
Expand Down
81 changes: 57 additions & 24 deletions src/UtilsAdmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,32 @@ DataStream* Rok4Server::AdminCreateLayer ( Request* request ) {

serverConf->addLayer ( layer );


if (request->getParam("build_capabilities") != "false") {
// On recalcule les GetCapabilities
BOOST_LOG_TRIVIAL(debug) << "Services capabilities build" ;
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
if ( servicesConf->supportWMTS ) {
buildWMTSCapabilities();
}
if ( servicesConf->supportTMS ) {
buildTMSCapabilities();
}
if ( servicesConf->supportOGCTILES ) {
buildOGCTILESCapabilities();
}
}

return new EmptyResponseDataStream ();
}


DataStream* Rok4Server::AdminBuildCapabilities ( Request* request ) {

// On recalcule les GetCapabilities
BOOST_LOG_TRIVIAL(debug) << "Services capabilities build" ;
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
Expand Down Expand Up @@ -105,18 +130,21 @@ DataStream* Rok4Server::AdminDeleteLayer ( Request* request ) {

serverConf->removeLayer ( layer->getId() );

// On recalcule les GetCapabilities
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
if ( servicesConf->supportWMTS ) {
buildWMTSCapabilities();
}
if ( servicesConf->supportTMS ) {
buildTMSCapabilities();
}
if ( servicesConf->supportOGCTILES ) {
buildOGCTILESCapabilities();
if (request->getParam("build_capabilities") != "false") {
// On recalcule les GetCapabilities
BOOST_LOG_TRIVIAL(debug) << "Services capabilities build" ;
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
if ( servicesConf->supportWMTS ) {
buildWMTSCapabilities();
}
if ( servicesConf->supportTMS ) {
buildTMSCapabilities();
}
if ( servicesConf->supportOGCTILES ) {
buildOGCTILESCapabilities();
}
}

return new EmptyResponseDataStream ();
Expand All @@ -142,18 +170,23 @@ DataStream* Rok4Server::AdminUpdateLayer ( Request* request ) {
serverConf->removeLayer ( layer->getId() );
serverConf->addLayer ( newLayer );

// On recalcule les GetCapabilities
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
if ( servicesConf->supportWMTS ) {
buildWMTSCapabilities();
}
if ( servicesConf->supportTMS ) {
buildTMSCapabilities();
}
if ( servicesConf->supportOGCTILES ) {
buildOGCTILESCapabilities();
if (request->getParam("build_capabilities") != "false") {
// On recalcule les GetCapabilities
BOOST_LOG_TRIVIAL(debug) << "Services capabilities build" ;

// On recalcule les GetCapabilities
if ( servicesConf->supportWMS ) {
buildWMSCapabilities();
}
if ( servicesConf->supportWMTS ) {
buildWMTSCapabilities();
}
if ( servicesConf->supportTMS ) {
buildTMSCapabilities();
}
if ( servicesConf->supportOGCTILES ) {
buildOGCTILESCapabilities();
}
}

return new EmptyResponseDataStream ();
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,19 @@ Rok4Server* loadConfiguration ( const char* serverConfigFile ) {
logging::add_file_log (
keywords::file_name = serverConf->getLogFilePrefix()+"-%Y-%m-%d-%H-%M-%S.log",
keywords::time_based_rotation = sinks::file::rotation_at_time_interval(boost::posix_time::seconds(serverConf->getLogFilePeriod())),
keywords::format = "%TimeStamp%\t%ProcessID%\t%Severity%\t%Message%",
keywords::format = "%TimeStamp%\t%ProcessID%\t%ThreadID%\t%Severity%\t%Message%",
keywords::auto_flush = true
);
} else if ( serverConf->getLogOutput() == "static_file") {
logging::add_file_log (
keywords::file_name = serverConf->getLogFilePrefix(),
keywords::format = "%TimeStamp%\t%ProcessID%\t%Severity%\t%Message%",
keywords::format = "%TimeStamp%\t%ProcessID%\t%ThreadID%\t%Severity%\t%Message%",
keywords::auto_flush = true
);
} else if ( serverConf->getLogOutput() == "standard_output") {
logging::add_console_log (
std::cout,
keywords::format = "%TimeStamp%\t%ProcessID%\t%Severity%\t%Message%"
keywords::format = "%TimeStamp%\t%ProcessID%\t%ThreadID%\t%Severity%\t%Message%"
);
}

Expand Down

0 comments on commit aee5afb

Please sign in to comment.