dl
Version:
DreamLab Libs
64 lines (52 loc) • 1.52 kB
JavaScript
var Class = require("core").Class;
/**
* @class CdfDatasource
*/
var CdfDatasource = function(){
/*
this.driver = "DriverRemote";
this.url = null;
this.method = null;
this.gateway = null;
this.params = null;
*/
this.initialize = function (data) {
this.driver = "DriverRemote";
this.url = null;
this.method = null;
this.gateway = null;
this.params = null;
if (data.hasOwnProperty('driver')) {
this.driver = data.driver;
}
if (data.hasOwnProperty('url')) {
this.url = data.url;
}
if (data.hasOwnProperty('method')) {
this.method = data.method;
}
if (data.hasOwnProperty('gateway')) {
this.gateway = data.gateway;
}
if (data.hasOwnProperty('params')) {
this.params = data.params;
}
};
this.toJSON = function () {
var retVal = {
"driver": this.driver,
"url": this.url,
"method": this.method,
"params": this.params
};
if (this.gateway) {
retVal.gateway = this.gateway;
}
return retVal;
};
this.toString = function (indent) {
return JSON.stringify(this.toJSON(), null, (indent || 4));
}
};
CdfDatasource = new Class(new CdfDatasource());
exports.CdfDatasource = CdfDatasource;