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