/
ds.listClientsideFunctions.R
104 lines (88 loc) · 2.78 KB
/
ds.listClientsideFunctions.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#'
#' @title Lists client-side functions
#' @description Lists all current client-side functions
#' @details This function operates by directly interrogating
#' the R objects stored in the input client packages and objects of name
#' starting with \code{ds.} character in \code{.GlobalEnv}.
#'
#' This function does not call any server-side function.
#' @return \code{ds.listClientsideFunctions} returns a list containing
#' all server-side functions.
#' @author DataSHIELD Development Team
#'
#' @examples
#' \dontrun{
#' ## Version 6, for version 5 see the Wiki
#'
#' #Library with all DataSHIELD functions
#' require('dsBaseClient')
#'
#' #Visualise all functions
#' ds.listClientsideFunctions()
#'
#' }
#' @export
ds.listClientsideFunctions <-function(){
search.path<-search()
print.text.full<-NULL
test.dsBaseClient<-FALSE
test.dsBetaTestClient<-FALSE
test.userDefinedClient<-FALSE
test.no.functions<-TRUE
potential.clientside.repositories<-NULL
for(j in 1:length(search.path))
{
if(search.path[j]=="package:dsBaseClient")
{
test.dsBaseClient<-TRUE
test.no.functions<-FALSE
}
if(search.path[j]=="package:dsBetaTestClient")
{
test.dsBetaTestClient<-TRUE
test.no.functions<-FALSE
}
if(search.path[j]==".GlobalEnv")
{
test.userDefinedClient<-TRUE
test.no.functions<-FALSE
}
}
cat("\n### Full search path \n")
print.search.list<-search()
print(print.search.list)
if(test.userDefinedClient==TRUE)
{
cat("\n### userDefinedClient functions \n")
print.text<-ls(pos=".GlobalEnv",pattern="ds.*")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}
if(test.dsBetaTestClient==TRUE)
{
cat("\n### dsBetaTestClient functions \n")
print.text<-ls(pos="package:dsBetaTestClient")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}
if(test.dsBaseClient==TRUE)
{
cat("\n### dsBaseClient functions \n")
print.text<-ls(pos="package:dsBaseClient")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}
if(test.no.functions==TRUE)
{
cat("\n### No standard clientside functions identified \n")
}
cat("\nIf you cannot see one or more of the clientside functions you expected to find",
"please see above for the full search path. If one of the paths is a possible clientside repository",
"issue the R command ls(pos='package:dsPackageName')",
"where 'package:dsPackageName' is the full name stated in the search path\n\n")
return(print.text.full)
}
# ds.listClientsideFunctions()