Skip to content

Commit

Permalink
#31 coverages support & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jan 21, 2022
1 parent 3dd138d commit 8aa7c00
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 10 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export(GSVirtualTableParameter)
export(GSWorkspace)
export(GSWorkspaceManager)
export(GSWorkspaceSettings)
export(GSWorldImageCoverageStore)
import(XML)
import(httr)
import(keyring)
Expand Down
2 changes: 1 addition & 1 deletion R/GSAbstractCoverageStore.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ GSAbstractCoverageStore <- R6Class("GSAbstractCoverageStore",
public = list(
url = NULL,
initialize = function(xml = NULL, type = NULL,
name = NULL, description = "", enabled = TRUE, url){
name = NULL, description = "", enabled = TRUE, url = NULL){
super$initialize(xml = xml, storeType = private$STORE_TYPE, type = type,
name = name, description = description, enabled = enabled)
if(!missing(xml) & !is.null(xml)){
Expand Down
2 changes: 1 addition & 1 deletion R/GSArcGridCoverageStore.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GSArcGridCoverageStore <- R6Class("GSArcGridCoverageStore",
),
public = list(
url = NULL,
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url){
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url = NULL){
super$initialize(xml = xml, type = private$TYPE,
name = name, description = description, enabled = enabled, url = url)
}
Expand Down
8 changes: 4 additions & 4 deletions R/GSCoverageStoreManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ GSCoverageStoreManager <- R6Class("GSCoverageStoreManager",
pwd = private$keyring_backend$get(service = private$keyring_service, username = private$user),
path = sprintf("/workspaces/%s/coveragestores.xml", ws),
content = GSUtils$getPayloadXML(coverageStore),
contentType = "text/xml",
contentType = "application/xml",
verbose = self$verbose.debug
)
if(status_code(req) == 201){
Expand Down Expand Up @@ -368,7 +368,7 @@ GSCoverageStoreManager <- R6Class("GSCoverageStoreManager",
pwd = private$keyring_backend$get(service = private$keyring_service, username = private$user),
path = sprintf("/workspaces/%s/coveragestores/%s/coverages.xml", ws, cs),
content = GSUtils$getPayloadXML(coverage),
contentType = "text/xml",
contentType = "application/xml",
verbose = self$verbose.debug
)
if(status_code(req) == 201){
Expand Down Expand Up @@ -487,7 +487,7 @@ GSCoverageStoreManager <- R6Class("GSCoverageStoreManager",
ws = ws, cs = cs,
endpoint = endpoint, extension = "geotiff", filename = filename,
configure = configure, update = update,
contentType = "image/geotiff"
contentType = "text/plain"
))
},

Expand All @@ -511,7 +511,7 @@ GSCoverageStoreManager <- R6Class("GSCoverageStoreManager",
ws = ws, cs = cs,
endpoint = endpoint, extension = "arcgrid", filename = filename,
configure = configure, update = update,
contentType = "image/arcgrid"
contentType = "text/plain"
))
},

Expand Down
2 changes: 1 addition & 1 deletion R/GSGeoTIFFCoverageStore.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GSGeoTIFFCoverageStore <- R6Class("GSGeoTIFFCoverageStore",
),
public = list(
url = NULL,
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url){
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url = NULL){
super$initialize(xml = xml, type = private$TYPE,
name = name, description = description, enabled = enabled, url = url)
}
Expand Down
2 changes: 1 addition & 1 deletion R/GSImageMosaicCoverageStore.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GSImageMosaicCoverageStore <- R6Class("GSImageMosaicCoverageStore",
),
public = list(
url = NULL,
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url){
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url = NULL){
super$initialize(xml = xml, type = private$TYPE,
name = name, description = description, enabled = enabled, url = url)
}
Expand Down
4 changes: 2 additions & 2 deletions R/GSUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GSUtils$PUT <- function(url, user, pwd, path,
add_headers(
"User-Agent" = GSUtils$getUserAgent(),
"Authorization" = paste("Basic", GSUtils$getUserToken(user, pwd)),
"Content-type" = contentType
"Content-Type" = contentType
),
body = body
)
Expand All @@ -120,7 +120,7 @@ GSUtils$POST <- function(url, user, pwd, path, content, contentType, verbose = F
add_headers(
"User-Agent" = GSUtils$getUserAgent(),
"Authorization" = paste("Basic", GSUtils$getUserToken(user, pwd)),
"Content-type" = contentType
"Content-Type" = contentType
),
body = content
)
Expand Down
31 changes: 31 additions & 0 deletions R/GSWorldImageCoverageStore.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#' Geoserver REST API WorldImageCoverageStore
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords geoserver rest api CoverageStore WorldImage
#' @return Object of \code{\link{R6Class}} for modelling a GeoServer WorldImage CoverageStore
#' @format \code{\link{R6Class}} object.
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml, name, description, enabled, url)}}{
#' This method is used to instantiate a \code{GSWorldImageCoverageStore}
#' }
#' }
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
GSWorldImageCoverageStore <- R6Class("GSWorldImageCoverageStore",
inherit = GSAbstractCoverageStore,
private = list(
TYPE = "WorldImage"
),
public = list(
url = NULL,
initialize = function(xml = NULL, name = NULL, description = "", enabled = TRUE, url = NULL){
super$initialize(xml = xml, type = private$TYPE,
name = name, description = description, enabled = enabled, url = url)
}
)
)
32 changes: 32 additions & 0 deletions man/GSWorldImageCoverageStore.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8aa7c00

Please sign in to comment.