-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcloseWorkflow.R
58 lines (56 loc) · 1.99 KB
/
closeWorkflow.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#' @name closeWorkflow
#' @aliases closeWorkflow
#' @title closeWorkflow
#' @description \code{closeWorkflow} allows to close a workflow
#'
#' @usage closeWorkflow(config)
#'
#' @param config a configuration object as read by \code{closeWorkflow}
#'
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
#' @export
#'
closeWorkflow <- function(config){
#close DBs
if(!is.null(config$software$input$dbi)){
config$logger.info("Closing input database connection")
DBI::dbDisconnect(config$software$input$dbi)
config$software$input$dbi <- config$software$input$dbi_config
config$software$input$dbi_config <- NULL
}
if(!is.null(config$software$output$dbi)){
config$logger.info("Closing output database connection")
DBI::dbDisconnect(config$software$output$dbi)
config$software$output$dbi <- config$software$output$dbi_config
config$software$output$dbi_config <- NULL
}
#Geoserver API manager
if(!is.null(config$software$output$geoserver)){
config$logger.info("Reset Geoserver API manager")
config$software$output$geoserver <- config$software$output$geoserver_config
config$software$output$geoserver_config <- NULL
}
#Geonetwork API manager
if(!is.null(config$software$output$geonetwork)){
config$logger.info("Reset Geonetwork API manager")
config$software$output$geonetwork <- config$software$output$geonetwork_config
config$software$output$geonetwork_config <- NULL
}
#WFS
if(!is.null(config$software$output$wfs)){
config$logger.info("Reset WFS client")
config$software$output$wfs <- config$software$output$wfs_config
config$software$output$wfs_config <- NULL
}
#CSW
if(!is.null(config$software$output$csw)){
config$logger.info("Reset CSW client")
config$software$output$csw <- config$software$output$csw_config
config$software$output$csw_config <- NULL
}
setwd(config$wd)
#set default line separator
set_line_separator()
#unload env environment
unload_workflow_environment(config)
}