76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Extends DataSource with schema-parsing on text data.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module datasource
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @submodule datasource-textschema
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Adds schema-parsing to the DataSource Utility.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class DataSourceTextSchema
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @extends Plugin.Base
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glassvar DataSourceTextSchema = function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass DataSourceTextSchema.superclass.constructor.apply(this, arguments);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * The namespace for the plugin. This will be the property on the host which
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * references the plugin instance.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property NS
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type String
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @value "schema"
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Class name.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property NAME
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type String
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @value "dataSourceTextSchema"
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass /////////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // DataSourceTextSchema Attributes
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass /////////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Internal init() handler.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method initializer
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param config {Object} Config object.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass this.doBefore("_defDataFn", this._beforeDefDataFn);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Parses raw data into a normalized response.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method _beforeDefDataFn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param tId {Number} Unique transaction ID.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param request {Object} The request.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param callback {Object} The callback object with the following properties:
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt>success (Function)</dt> <dd>Success handler.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt>failure (Function)</dt> <dd>Failure handler.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param data {Object} Raw data.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @protected
2fe13ddab136a6eb6239d89e5e064e09d9e1bb92Luke Smith // TODO: Do I need to sniff for DS.IO + isString(responseText)?
2fe13ddab136a6eb6239d89e5e064e09d9e1bb92Luke Smith payload.response = Y.DataSchema.Text.apply.call(this, schema, data) || {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass return new Y.Do.Halt("DataSourceTextSchema plugin halted _defDataFn");
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassY.namespace('Plugin').DataSourceTextSchema = DataSourceTextSchema;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass}, '@VERSION@' ,{requires:['datasource-local', 'plugin', 'dataschema-text']});