diff --git a/lib/storage-connector.js b/lib/storage-connector.js index bf81bc7..24ed13c 100644 --- a/lib/storage-connector.js +++ b/lib/storage-connector.js @@ -1,26 +1,26 @@ var StorageService = require('./index'); /** - * Export the initialize method to JDB - * @param schema + * Export the initialize method to Loopback data + * @param dataSource * @param callback */ -exports.initialize = function (schema, callback) { - var settings = schema.settings || {}; +exports.initialize = function (dataSource, callback) { + var settings = dataSource.settings || {}; - var adapter = new StorageService(settings); - schema.adapter = adapter; - schema.adapter.schema = schema; + var connector = new StorageService(settings); + dataSource.connector = connector; + dataSource.connector.dataSource = dataSource; - adapter.DataAccessObject = function() {}; + connector.DataAccessObject = function() {}; for (var m in StorageService.prototype) { var method = StorageService.prototype[m]; if ('function' === typeof method) { - adapter.DataAccessObject[m] = method.bind(adapter); + connector.DataAccessObject[m] = method.bind(connector); for(var k in method) { - adapter.DataAccessObject[m][k] = method[k]; + connector.DataAccessObject[m][k] = method[k]; } } } - adapter.define = function(model, properties, settings) {}; + connector.define = function(model, properties, settings) {}; }