2016-05-03 22:50:21 +00:00
|
|
|
// Copyright IBM Corp. 2013,2014. All Rights Reserved.
|
|
|
|
// Node module: loopback
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2013-06-08 00:37:30 +00:00
|
|
|
/**
|
|
|
|
* Expose `Connector`.
|
|
|
|
*/
|
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
'use strict';
|
2013-06-08 00:37:30 +00:00
|
|
|
module.exports = Connector;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies.
|
|
|
|
*/
|
2014-10-16 22:54:40 +00:00
|
|
|
|
2014-10-30 20:49:47 +00:00
|
|
|
var EventEmitter = require('events').EventEmitter;
|
|
|
|
var debug = require('debug')('connector');
|
|
|
|
var util = require('util');
|
|
|
|
var inherits = util.inherits;
|
|
|
|
var assert = require('assert');
|
2014-10-16 22:54:40 +00:00
|
|
|
|
2013-06-08 00:37:30 +00:00
|
|
|
/**
|
|
|
|
* Create a new `Connector` with the given `options`.
|
|
|
|
*
|
|
|
|
* @param {Object} options
|
|
|
|
* @return {Connector}
|
|
|
|
*/
|
|
|
|
|
|
|
|
function Connector(options) {
|
|
|
|
EventEmitter.apply(this, arguments);
|
|
|
|
this.options = options;
|
2014-10-16 22:54:40 +00:00
|
|
|
|
2013-06-08 00:37:30 +00:00
|
|
|
debug('created with options', options);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inherit from `EventEmitter`.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inherits(Connector, EventEmitter);
|
|
|
|
|
|
|
|
/*!
|
2013-07-23 19:58:03 +00:00
|
|
|
* Create an connector instance from a JugglingDB adapter.
|
2013-06-08 00:37:30 +00:00
|
|
|
*/
|
|
|
|
|
2014-10-30 20:49:47 +00:00
|
|
|
Connector._createJDBAdapter = function(jdbModule) {
|
2013-06-08 00:37:30 +00:00
|
|
|
var fauxSchema = {};
|
2014-10-30 20:49:47 +00:00
|
|
|
jdbModule.initialize(fauxSchema, function() {
|
2013-06-08 00:37:30 +00:00
|
|
|
// connected
|
|
|
|
});
|
2014-10-16 22:54:40 +00:00
|
|
|
};
|
2013-06-08 00:37:30 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Add default crud operations from a JugglingDB adapter.
|
|
|
|
*/
|
|
|
|
|
2014-10-30 20:49:47 +00:00
|
|
|
Connector.prototype._addCrudOperationsFromJDBAdapter = function(connector) {
|
2014-10-16 22:54:40 +00:00
|
|
|
|
|
|
|
};
|