-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
260 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ before_install: | |
r: | ||
- oldrel | ||
- release | ||
- devel | ||
#- devel | ||
|
||
r_github_packages: | ||
- hadley/devtools | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#' CSWClient | ||
#' | ||
#' @docType class | ||
#' @export | ||
#' @keywords OGC CSW catalogue service web | ||
#' @return Object of \code{\link{R6Class}} with methods for interfacing an OGC | ||
#' Catalogue Service for the Web. | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' CSWClient$new("http://localhost:8080/geonetwork/srv/eng/csw", version = "2.0.2") | ||
#' } | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(url, version, user, pwd, logger)}}{ | ||
#' This method is used to instantiate a CSWClient with the \code{url} of the | ||
#' OGC service. Authentication (\code{user}/\code{pwd}) is not yet supported and will | ||
#' be added with the support of service transactional modes. By default, the \code{logger} | ||
#' argument will be set to \code{NULL} (no logger). This argument accepts two possible | ||
#' values: \code{INFO}: to print only \pkg{ows4R} logs, \code{DEBUG}: to print more verbose logs | ||
#' } | ||
#' \item{\code{getCapabilities()}}{ | ||
#' Get service capabilities. Inherited from OWS Client | ||
#' } | ||
#' } | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
CSWClient <- R6Class("CSWClient", | ||
inherit = OWSClient, | ||
private = list( | ||
serviceName = "CSW" | ||
), | ||
public = list( | ||
#initialize | ||
initialize = function(url, version = NULL, user = NULL, pwd = NULL, logger = NULL) { | ||
super$initialize(url, service = private$serviceName, version, user, pwd, logger) | ||
self$capabilities = CSWCapabilities$new(self$url, self$version) | ||
}, | ||
|
||
#describeRecord | ||
describeRecord = function(){ | ||
stop("Not yet implemented") | ||
}, | ||
|
||
#getRecordById | ||
getRecordById = function(id, outputSchema){ | ||
stop("Not yet implemented") | ||
}, | ||
|
||
#getRecords | ||
getRecords = function(outputSchema){ | ||
stop("Not yet implemented") | ||
} | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#' CSWGetCapabilities | ||
#' | ||
#' @docType class | ||
#' @export | ||
#' @keywords OGC CSW GetCapabilities | ||
#' @return Object of \code{\link{R6Class}} with methods for interfacing an OGC | ||
#' Catalogue Service for the Web (CSW) Get Capabilities document. | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' CSWGetCapabilities$new("http://localhost:8080/geonetwork/csw", version = "2.0.2") | ||
#' } | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(url, version)}}{ | ||
#' This method is used to instantiate a WFSGetCapabilities object | ||
#' } | ||
#' \item{\code{getServiceIdentification()}}{ | ||
#' Get the service identification | ||
#' } | ||
#' } | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
CSWCapabilities <- R6Class("CSWCapabilities", | ||
|
||
private = list( | ||
|
||
url = NA, | ||
version = NA, | ||
request = NA, | ||
serviceIdentification = NA, | ||
|
||
#buildRequest | ||
buildRequest = function(url, version){ | ||
namedParams <- list(request = "GetCapabilities", version = version) | ||
request <- OWSRequest$new(url, namedParams, "text/xml") | ||
return(request) | ||
} | ||
), | ||
|
||
public = list( | ||
|
||
#initialize | ||
initialize = function(url, version) { | ||
private$request <- private$buildRequest(url, version) | ||
xmlObj <- private$request$response | ||
private$serviceIdentification <- OWSServiceIdentification$new(xmlObj, version, "CSW") | ||
}, | ||
|
||
#getServiceIdentification | ||
getServiceIdentification = function(){ | ||
return(private$serviceIdentification) | ||
} | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# test_WFS.R | ||
# Author: Emmanuel Blondel <[email protected]> | ||
# | ||
# Description: Integration tests for WFS Client | ||
#======================= | ||
require(ows4R, quietly = TRUE) | ||
require(testthat) | ||
context("WFS") | ||
|
||
test_that("CSW 2.0.2",{ | ||
csw <- CSWClient$new("http://localhost:8080/geonetwork/srv/eng/csw", "2.0.2") | ||
expect_is(csw, "CSWClient") | ||
caps <- csw$getCapabilities() | ||
expect_is(caps, "CSWCapabilities") | ||
}) |