Mercurial > repos > prog > lcmsmatching
comparison RemotedbConn.R @ 1:253d531a0193 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 36c9d8099c20a1ae848f1337c16564335dd8fb2b
author | prog |
---|---|
date | Sat, 03 Sep 2016 17:02:01 -0400 |
parents | |
children | 20d69a062da3 |
comparison
equal
deleted
inserted
replaced
0:e66bb061af06 | 1:253d531a0193 |
---|---|
1 if ( ! exists('RemotedbConn')) { | |
2 | |
3 source('BiodbConn.R') | |
4 source(file.path('UrlRequestScheduler.R'), chdir = TRUE) | |
5 | |
6 ##################### | |
7 # CLASS DECLARATION # | |
8 ##################### | |
9 | |
10 RemotedbConn <- setRefClass("RemotedbConn", contains = "BiodbConn", fields = list(.scheduler = "UrlRequestScheduler")) | |
11 | |
12 ############### | |
13 # CONSTRUCTOR # | |
14 ############### | |
15 | |
16 RemotedbConn$methods( initialize = function(useragent = NA_character_, scheduler = NULL, ...) { | |
17 | |
18 # Check useragent | |
19 ( ! is.null(useragent) && ! is.na(useragent)) || stop("You must specify a valid useragent string (e.g.: \"myapp ; my.email@address\").") | |
20 | |
21 # Set scheduler | |
22 if (is.null(scheduler)) | |
23 scheduler <- UrlRequestScheduler$new(n = 3) | |
24 inherits(scheduler, "UrlRequestScheduler") || stop("The scheduler instance must inherit from UrlRequestScheduler class.") | |
25 scheduler$setUserAgent(useragent) # set agent | |
26 .scheduler <<- scheduler | |
27 | |
28 callSuper(...) # calls super-class initializer with remaining parameters | |
29 }) | |
30 | |
31 } |