1 // ========================================================================== 2 // Project: The M-Project - Mobile HTML5 Application Framework 3 // Copyright: �2010 M-Way Solutions GmbH. All rights reserved. 4 // Creator: Dominik 5 // Date: 28.10.2010 6 // License: Dual licensed under the MIT or GPL Version 2 licenses. 7 // http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE 8 // http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE 9 // ========================================================================== 10 11 m_require('core/utility/logger.js'); 12 13 /** 14 * @class 15 * 16 * Wraps access to any defined data source and is the only interface for a model to 17 * access this data. 18 * 19 * @extends M.Object 20 */ 21 M.DataProvider = M.Object.extend( 22 /** @scope M.DataProvider.prototype */ { 23 24 /** 25 * The type of this object. 26 * 27 * @type String 28 */ 29 type: 'M.DataProvider', 30 31 /** 32 * Interface method. 33 * Implemented by specific data provider. 34 */ 35 find: function(query) { 36 }, 37 38 /** 39 * Interface method. 40 * Implemented by specific data provider. 41 */ 42 save: function() { 43 }, 44 45 /** 46 * Interface method. 47 * Implemented by specific data provider. 48 */ 49 del: function() { 50 51 }, 52 53 /** 54 * Checks if object has certain property. 55 * 56 * @param {obj} obj The object to check. 57 * @param {String} prop The property to check for. 58 * @returns {Booleans} Returns YES (true) if object has property and NO (false) if not. 59 */ 60 check: function(obj, prop) { 61 return obj[prop] ? YES : NO; 62 } 63 64 });