1 var Class = require("../lib/mootools/mootools-node.js").Class;
  2 var Event = require('../lib/core/event/Event.js').Event;
  3 var DriverAbstract = require('../lib/DriverAbstract').DriverAbstract;
  4 
  5 /**
  6  * Special implementation of driver which not making any remote or I/O calls. Given 'data' will be threated as retrived data after calling load method.
  7  * @class DriverLocal Special implementation of driver which not making any remote or I/O calls.
  8  * @extends DriverAbstract
  9  * @requires Class 
 10  * @requires DriverAbstract 
 11  * @requires Event
 12  * @param {Object} data Model data.
 13  * @throws {DriverLocal.Exception.NO_DATA_GIVEN} if given data is null.
 14  */
 15 var DriverLocal = function(){
 16 
 17     /** @ignore */
 18     this.Extends = DriverAbstract;
 19     
 20     /**
 21      * @property {Object} _data
 22      * @private
 23      */
 24     this._data = null;
 25 
 26     /** @ignore */
 27     this.initialize = function(data){
 28         if(!data){
 29             throw DriverLocal.Exception.NO_DATA_GIVEN;
 30         }
 31 
 32         this._data = data;
 33     };
 34 
 35     /**
 36      * Implements DriverAbstract interface. Dispatches DriverAbstract.LOADED event with given model data.
 37      */
 38     this.load = function(){
 39         this.dispatchEvent(new Event(DriverAbstract.LOADED, this._data));
 40     };
 41 };
 42 
 43 DriverLocal = new Class(new DriverLocal());
 44 
 45 /**
 46  * Namespace for exeptions messages.
 47  * @constant
 48  * @static
 49  * @namespace
 50  */
 51 DriverLocal.Exception = {};
 52 /**
 53  * @constant
 54  * @static
 55  */
 56 DriverLocal.Exception.NO_DATA_GIVEN = "No data given!";
 57 
 58 exports.DriverLocal = DriverLocal;