diff --git a/DESCRIPTION b/DESCRIPTION index 7260be8..88bbf72 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,13 +1,14 @@ Package: geonapi Type: Package Title: 'GeoNetwork' API R Interface -Version: 0.5-1 -Date: 2022-01-14 +Version: 0.5-2 +Date: 2022-01-24 Authors@R: c(person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emmanuel.blondel1@gmail.com", comment = c(ORCID = "0000-0002-5870-5762"))) Maintainer: Emmanuel Blondel Description: Provides an R interface to the 'GeoNetwork' API () allowing to upload and publish metadata in a 'GeoNetwork' web-application and expose it to OGC CSW. Depends: R (>= 3.1.0), geometa, keyring Imports: R6, openssl, httr, XML +Remotes: geometa Suggests: testthat, roxygen2 License: MIT + file LICENSE URL: https://github.com/eblondel/geonapi/wiki, https://geonetwork-opensource.org diff --git a/R/GNLegacyAPIManager.R b/R/GNLegacyAPIManager.R index 2dea98d..c7375ff 100644 --- a/R/GNLegacyAPIManager.R +++ b/R/GNLegacyAPIManager.R @@ -69,12 +69,15 @@ #' \item{\code{getCategories()}}{ #' Retrieves the list of categories available in Geonetwork #' } -#' \item{\code{insertMetadata(xml, file, geometa, group, category, stylesheet, validate, geometa_validate, geometa_inspire)}}{ +#' \item{\code{insertMetadata(xml, file, geometa, group, category, stylesheet, validate, geometa_validate, +#' geometa_inspire, geometa_inspireValidator)}}{ #' Inserts a metadata by file, XML object or \pkg{geometa} object of class #' \code{ISOMetadata} or \code{ISOFeatureCatalogue}. If successful, returns the Geonetwork #' metadata internal identifier (integer). Extra parameters \code{geometa_validate} (TRUE #' by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects -#' for perform ISO and INSPIRE validation respectively. +#' for perform ISO and INSPIRE validation respectively. In that case on object of class +#' \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as +#' \code{geometa_inspireValidator} argument. #' } #' \item{\code{setPrivConfiguration(id, config)}}{ #' Set the privilege configuration for a metadata. 'id' is the metadata integer id. @@ -99,11 +102,14 @@ #' \item{\code{getInfoByUUID(uuid)}}{ #' Get a metadata Info by UUID. Returns an XML document object #' } -#' \item{\code{updateMetadata(id, xml, file, geometa, geometa_validate, geometa_inspire)}}{ +#' \item{\code{updateMetadata(id, xml, file, geometa, geometa_validate, +#' geometa_inspire, geometa_inspireValidator)}}{ #' Updates a metadata by file, XML object or \pkg{geometa} object of class #' 'ISOMetadata' or 'ISOFeatureCatalogue'. Extra parameters \code{geometa_validate} (TRUE #' by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects -#' for perform ISO and INSPIRE validation respectively. +#' for perform ISO and INSPIRE validation respectively. In that case on object of class +#' \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as +#' \code{geometa_inspireValidator} argument. #' } #' \item{\code{deleteMetadata(id)}}{ #' Deletes a metadata @@ -318,7 +324,7 @@ GNLegacyAPIManager <- R6Class("GNLegacyAPIManager", #--------------------------------------------------------------------------- insertMetadata = function(xml = NULL, file = NULL, geometa = NULL, group, category = NULL, stylesheet = NULL, validate = FALSE, - geometa_validate = TRUE, geometa_inspire = FALSE){ + geometa_validate = TRUE, geometa_inspire = FALSE, geometa_inspireValidator = NULL){ self$INFO("Inserting metadata ...") out <- NULL data <- NULL @@ -337,7 +343,8 @@ GNLegacyAPIManager <- R6Class("GNLegacyAPIManager", if(!is(geometa, "ISOMetadata") & !is(geometa, "ISOFeatureCatalogue")){ stop("Object 'geometa' should be of class 'ISOMetadata' or 'ISOFeatureCatalogue") } - data <- geometa$encode(validate = geometa_validate, inspire = geometa_inspire) + data <- geometa$encode(validate = geometa_validate, + inspire = geometa_inspire, inspireValidator = geometa_inspireValidator) } if(is.null(data)){ @@ -504,7 +511,7 @@ GNLegacyAPIManager <- R6Class("GNLegacyAPIManager", #updateMetadata #--------------------------------------------------------------------------- updateMetadata = function(id, xml = NULL, file = NULL, geometa = NULL, - geometa_validate = TRUE, geometa_inspire = FALSE){ + geometa_validate = TRUE, geometa_inspire = FALSE, geometa_inspireValidator = NULL){ self$INFO(sprintf("Updating metadata id = %s ...", id)) out <- NULL @@ -524,7 +531,8 @@ GNLegacyAPIManager <- R6Class("GNLegacyAPIManager", if(!is(geometa, "ISOMetadata") & !is(geometa, "ISOFeatureCatalogue")){ stop("Object 'geometa' should be of class 'ISOMetadata' or 'ISOFeatureCatalogue") } - data <- geometa$encode(validate = geometa_validate, inspire = geometa_inspire) + data <- geometa$encode(validate = geometa_validate, + inspire = geometa_inspire, inspireValidator = geometa_inspireValidator) } if(is.null(data)){ diff --git a/R/GNOpenAPIManager.R b/R/GNOpenAPIManager.R index 65afb89..3be61bd 100644 --- a/R/GNOpenAPIManager.R +++ b/R/GNOpenAPIManager.R @@ -80,27 +80,33 @@ #' \item{\code{insertRecord(xml, file, geometa, metadataType, uuidProcessing, #' group, category, rejectIfInvalid, publishToAll, #' transformWith, schema, extra, -#' geometa_validate, geometa_inspire)}}{ +#' geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ #' Inserts a record by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. #' Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} -#' (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. +#' (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. In that case on object of class +#' \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as \code{geometa_inspireValidator} +#' argument. #' } #' \item{\code{insertMetadata(xml, file, geometa, metadataType, uuidProcessing, #' group, category, rejectIfInvalid, publishToAll, #' transformWith, schema, extra, -#' geometa_validate, geometa_inspire)}}{ +#' geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ #' Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. #' Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} -#' (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. +#' (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. In that case on object of class +#' \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as +#' \code{geometa_inspireValidator} argument. #' } #' \item{\code{updateMetadata(xml, file, geometa, metadataType, #' group, category, rejectIfInvalid, publishToAll, #' transformWith, schema, extra, -#' geometa_validate, geometa_inspire)}}{ +#' geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ #' Updates a metadata by file, XML object or \pkg{geometa} object of class #' 'ISOMetadata' or 'ISOFeatureCatalogue'. Extra parameters \code{geometa_validate} (TRUE #' by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects -#' for perform ISO and INSPIRE validation respectively. +#' for perform ISO and INSPIRE validation respectively. In that case on object of class +#' \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as +#' \code{geometa_inspireValidator} argument. #' } #' \item{\code{deleteMetadata(id, withBackup)}}{ #' Deletes a metadata @@ -303,7 +309,7 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager", metadataType = "METADATA", uuidProcessing = "NOTHING", group, category = NULL, rejectIfInvalid = FALSE, publishToAll = TRUE, transformWith = "_none_", schema = NULL, extra = NULL, - geometa_validate = TRUE, geometa_inspire = FALSE){ + geometa_validate = TRUE, geometa_inspire = FALSE, geometa_inspireValidator = NULL){ allowedMetadataTypes <- c("METADATA", "TEMPLATE", "SUB_TEMPLATE", "TEMPLATE_OF_SUB_TEMPLATE") if(!metadataType %in% allowedMetadataTypes){ @@ -338,7 +344,8 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager", tempf = tempfile(tmpdir = tempdir()) file <- paste(tempf,".xml",sep='') isTempFile <- TRUE - geometa$save(file = file, validate = geometa_validate, inspire = geometa_inspire) + geometa$save(file = file, validate = geometa_validate, + inspire = geometa_inspire, inspireValidator = geometa_inspireValidator) } if(is.null(file)){ @@ -391,13 +398,14 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager", metadataType = "METADATA", uuidProcessing = "NOTHING", group, category = NULL, rejectIfInvalid = FALSE, publishToAll = TRUE, transformWith = "_none_", schema = NULL, extra = NULL, - geometa_validate = TRUE, geometa_inspire = FALSE){ + geometa_validate = TRUE, geometa_inspire = FALSE, geometa_inspireValidator = NULL){ self$INFO("Inserting metadata ...") inserted <- self$insertRecord(xml = xml, file = file, geometa = geometa, metadataType = metadataType, uuidProcessing = uuidProcessing, group = group, category = category, rejectIfInvalid = rejectIfInvalid, publishToAll = publishToAll, transformWith = transformWith, schema = schema, extra = extra, - geometa_validate = geometa_validate, geometa_inspire = geometa_inspire) + geometa_validate = geometa_validate, + geometa_inspire = geometa_inspire, geometa_inspireValidator = geometa_inspireValidator) }, #updateMetadata @@ -406,13 +414,14 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager", metadataType = "METADATA", group, category = NULL, rejectIfInvalid = FALSE, publishToAll = TRUE, transformWith = "_none_", schema = NULL, extra = NULL, - geometa_validate = TRUE, geometa_inspire = FALSE){ + geometa_validate = TRUE, geometa_inspire = FALSE, geometa_inspireValidator = NULL){ self$INFO("Updating metadata ...") self$insertRecord(xml = xml, file = file, geometa = geometa, metadataType = metadataType, uuidProcessing = "OVERWRITE", group = group, category = category, rejectIfInvalid = rejectIfInvalid, publishToAll = publishToAll, transformWith = transformWith, schema = schema, extra = extra, - geometa_validate = geometa_validate, geometa_inspire = geometa_inspire) + geometa_validate = geometa_validate, + geometa_inspire = geometa_inspire, geometa_inspireValidator = geometa_inspireValidator) }, #deleteMetadata diff --git a/R/geonapi.R b/R/geonapi.R index f0d1208..a61f008 100644 --- a/R/geonapi.R +++ b/R/geonapi.R @@ -12,8 +12,8 @@ #' \tabular{ll}{ #' Package: \tab geonapi\cr #' Type: \tab Package\cr -#' Version: \tab 0.5-1\cr -#' Date: \tab 2022-01-14\cr +#' Version: \tab 0.5-2\cr +#' Date: \tab 2022-01-24\cr #' License: \tab MIT\cr #' LazyLoad: \tab yes\cr #' } diff --git a/README.md b/README.md index 42c0512..0e65f19 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ =========== [![Build Status](https://github.com/eblondel/geonapi/actions/workflows/r-cmd-check.yml/badge.svg?branch=master)](https://github.com/eblondel/geonapi/actions/workflows/r-cmd-check.yml) -[![Github_Status_Badge](https://img.shields.io/badge/Github-0.5--1-blue.svg)](https://github.com/eblondel/geonapi) +[![Github_Status_Badge](https://img.shields.io/badge/Github-0.5--2-blue.svg)](https://github.com/eblondel/geonapi) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/geonapi)](https://cran.r-project.org/package=geonapi) [![CRAN checks](https://cranchecks.info/badges/worst/geonapi)](https://cran.r-project.org/web/checks/check_results_geonapi.html) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1345012.svg)](https://doi.org/10.5281/zenodo.1345012) diff --git a/man/GNLegacyAPIManager.Rd b/man/GNLegacyAPIManager.Rd index 54bd8ed..7d72015 100644 --- a/man/GNLegacyAPIManager.Rd +++ b/man/GNLegacyAPIManager.Rd @@ -71,12 +71,15 @@ GNLegacyAPIManager \item{\code{getCategories()}}{ Retrieves the list of categories available in Geonetwork } - \item{\code{insertMetadata(xml, file, geometa, group, category, stylesheet, validate, geometa_validate, geometa_inspire)}}{ + \item{\code{insertMetadata(xml, file, geometa, group, category, stylesheet, validate, geometa_validate, + geometa_inspire, geometa_inspireValidator)}}{ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. If successful, returns the Geonetwork metadata internal identifier (integer). Extra parameters \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects - for perform ISO and INSPIRE validation respectively. + for perform ISO and INSPIRE validation respectively. In that case on object of class + \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as + \code{geometa_inspireValidator} argument. } \item{\code{setPrivConfiguration(id, config)}}{ Set the privilege configuration for a metadata. 'id' is the metadata integer id. @@ -101,11 +104,14 @@ GNLegacyAPIManager \item{\code{getInfoByUUID(uuid)}}{ Get a metadata Info by UUID. Returns an XML document object } - \item{\code{updateMetadata(id, xml, file, geometa, geometa_validate, geometa_inspire)}}{ + \item{\code{updateMetadata(id, xml, file, geometa, geometa_validate, + geometa_inspire, geometa_inspireValidator)}}{ Updates a metadata by file, XML object or \pkg{geometa} object of class 'ISOMetadata' or 'ISOFeatureCatalogue'. Extra parameters \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects - for perform ISO and INSPIRE validation respectively. + for perform ISO and INSPIRE validation respectively. In that case on object of class + \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as + \code{geometa_inspireValidator} argument. } \item{\code{deleteMetadata(id)}}{ Deletes a metadata diff --git a/man/GNOpenAPIManager.Rd b/man/GNOpenAPIManager.Rd index dd90d21..2756d76 100644 --- a/man/GNOpenAPIManager.Rd +++ b/man/GNOpenAPIManager.Rd @@ -82,27 +82,33 @@ GNOpenAPIManager \item{\code{insertRecord(xml, file, geometa, metadataType, uuidProcessing, group, category, rejectIfInvalid, publishToAll, transformWith, schema, extra, - geometa_validate, geometa_inspire)}}{ + geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ Inserts a record by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} - (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. + (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. In that case on object of class + \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as \code{geometa_inspireValidator} + argument. } \item{\code{insertMetadata(xml, file, geometa, metadataType, uuidProcessing, group, category, rejectIfInvalid, publishToAll, transformWith, schema, extra, - geometa_validate, geometa_inspire)}}{ + geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} - (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. + (FALSE by default) can be used to perform ISO and INSPIRE validation respectively. In that case on object of class + \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as + \code{geometa_inspireValidator} argument. } \item{\code{updateMetadata(xml, file, geometa, metadataType, group, category, rejectIfInvalid, publishToAll, transformWith, schema, extra, - geometa_validate, geometa_inspire)}}{ + geometa_validate, geometa_inspire, geometa_inspireValidator)}}{ Updates a metadata by file, XML object or \pkg{geometa} object of class 'ISOMetadata' or 'ISOFeatureCatalogue'. Extra parameters \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} (FALSE by default) can be used with geometa objects - for perform ISO and INSPIRE validation respectively. + for perform ISO and INSPIRE validation respectively. In that case on object of class + \code{geometa::INSPIREMetadataValidator}, with a proper user API key, should be specified as + \code{geometa_inspireValidator} argument. } \item{\code{deleteMetadata(id, withBackup)}}{ Deletes a metadata diff --git a/man/geonapi.Rd b/man/geonapi.Rd index 4aed682..50a00aa 100644 --- a/man/geonapi.Rd +++ b/man/geonapi.Rd @@ -14,8 +14,8 @@ Web-Services (Catalogue Service for the Web). \tabular{ll}{ Package: \tab geonapi\cr Type: \tab Package\cr - Version: \tab 0.5-1\cr - Date: \tab 2022-01-14\cr + Version: \tab 0.5-2\cr + Date: \tab 2022-01-24\cr License: \tab MIT\cr LazyLoad: \tab yes\cr }