#' An S4 class to represent a source of data.
#'
#' @slot user An instance of the class User
#' @slot host An instance of the class Host
#' @slot webService An instance of the class WebService
#' @slot database An instance of the class Database
#' @slot file An instance of the class File
#' @slot geoSpatialDataset An instance of the class GeoSpatialDataset
setClass (
Class = "DataSource",
representation = representation(
user = "User",
host = "Host",
webService = "WebService",
database = "Database",
file = "File",
geoSpatialDataset = "GeoSpatialDataSet"
),
validity = function(object){
cat("~~~ ValueReduct: inspector ~~~ \n")
user <- object@user
host <- object@host
webService <- object@webService
database <- object@database
file <- object@file
geoSpatialDataset <- object@geoSpatialDataset
#TODO: Validate!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#if(ncol(object@valueReduct) != ncol(dtMat)){
# stop ("[ValueReduct: validation] valueReduct number of columns must match the number of column Ids of the conditionReduct")
#}else{}
return(TRUE)
}
)
#*******************************************************
#CONSTRUCTOR
setMethod (
f="initialize",
signature="DataSource",
definition=function(.Object,user,host,webService,database,file,geoSpatialDataset){
#cat ("~~~~~ User: initializator ~~~~~ \n")
if(!missing(user)){
if(!missing(host)){
if(!missing(webService)){
if(!missing(database)){
if(!missing(file)){
if(!missing(geoSpatialDataset)){
.Object@user <- user
.Object@host <- host
.Object@webService <- webService
.Object@database <- database
.Object@geoSpatialDataset <- geoSpatialDataset
validObject(.Object)# call of the inspector
}else{
.Object@geoSpatialDataset <- new(Class="GeoSpatialDataset")
}
}else{
.Object@file <- new(Class="File")
}
}else{
.Object@database <- new(Class="Database")
}
}else{
.Object@webService <- new(Class="WebService")
}
}else{
.Object@host <- new(Class="Host")
}
}else{
.Object@user <- new(Class="User")
}
return(.Object)
}
)
#CONSTRUCTOR (USER FRIENDLY)
dataSource <- function(user,host,webService,database,geoSpatialDataset){
cat ("~~~~~ User: constructor ~~~~~ \n")
new (Class="User", user = user, host = host, webService = webService, database = database, geoSpatialDataset = geoSpatialDataset)
}
#*******************************************************
#ACCESSORS
setGeneric("getUser",function(object){standardGeneric ("getUser")})
setMethod("getUser","DataSource",
function(object){
return(object@user)
}
)
setGeneric("getHost",function(object){standardGeneric ("getHost")})
setMethod("getHost","DataSource",
function(object){
return(object@host)
}
)
setGeneric("getWebService",function(object){standardGeneric ("getWebService")})
setMethod("getWebService","DataSource",
function(object){
return(object@webService)
}
)
setGeneric("getDatabase",function(object){standardGeneric ("getDatabase")})
setMethod("getDatabase","DataSource",
function(object){
return(object@database)
}
)
setGeneric("getFile",function(object){standardGeneric ("getFile")})
setMethod("getFile","DataSource",
function(object){
return(object@file)
}
)
setGeneric("getGeoSpatialDataset",function(object){standardGeneric ("getGeoSpatialDataset")})
setMethod("getGeoSpatialDataset","DataSource",
function(object){
return(object@geoSpatialDataset)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.