var util = require( "util" );
var ClassyBase = require( "./classy" );


module.exports = ReadHandler;


function ReadHandler ( req, res, next ) {

    ClassyBase.call( this, req, res, next );

    this.on( "pre.read", this.preRead );
    this.on( "read", this.read );
    this.on( "post.read", this.postRead );

}

util.inherits( ReadHandler, ClassyBase );


ReadHandler.prototype.preRead = function() {
    "Parse URL or query params in this step";
    "Emit 'read' and pass data to invoke 'read' method";
    "Emit 'error' and pass error to send error response";
    throw new Error( "Not implemented" );
};


ReadHandler.prototype.read = function( data ) {
    "Emit 'error' and pass error to send error response";
    "Emit 'respond' and pass data to send response";
    "Emit 'post.read' and pass data to invoke 'postRead' method";
    throw new Error( "Not implemented" );
};


ReadHandler.prototype.postRead = function( data ) {
    "Emit 'error' and pass error to send error response";
    "Emit 'respond' and pass data to send response";
    throw new Error( "Not implemented" );
};


ReadHandler.prototype.respond = function( data ) {
    this.res.status( 200 ).json( data );
};


ReadHandler.prototype.handle = function() {
    "Emit 'pre.read' and pass data to invoke 'preRead' method";
    "Emit 'read' and pass data to invoke 'read' method";
    this.read();
};

@@ -63,16 +63,52 @@
 ssy%22 );%0A
+var errors = require( %22./errors%22 );%0A
 %0A%0Amodule
@@ -384,24 +384,697 @@
 syBase );%0A%0A%0A
+ReadHandler.prototype.onReadList = function( nextEvent ) %7B%0A%0A    var _this = this;%0A%0A    return function ( err, data ) %7B%0A%0A        if ( err ) %7B%0A            return _this.emit( %22error%22, err );%0A        %7D%0A%0A        return _this.emit( nextEvent, data );%0A%0A    %7D;%0A%0A%7D;%0A%0AReadHandler.prototype.onReadDetail = function( nextEvent ) %7B%0A%0A    var _this = this;%0A%0A    return function ( err, data ) %7B%0A%0A        if ( ( err && err.name === %22CastError%22 ) %7C%7C !data ) %7B%0A            return _this.emit( %22error%22, errors.resourceNotFound( %22Not found%22 ) );%0A        %7D%0A%0A        if ( err ) %7B%0A            return _this.emit( %22error%22, err );%0A        %7D%0A%0A        return _this.emit( nextEvent, data );%0A%0A    %7D;%0A%0A%7D;%0A%0A
 ReadHandler.
@@ -1305,33 +1305,32 @@
 emented%22 );%0A%7D;%0A%0A
-%0A
 ReadHandler.prot
@@ -1576,33 +1576,32 @@
 emented%22 );%0A%7D;%0A%0A
-%0A
 ReadHandler.prot
@@ -1785,33 +1785,32 @@
 emented%22 );%0A%7D;%0A%0A
-%0A
 ReadHandler.prot
@@ -1889,13 +1889,12 @@
  );%0A
+
 %7D;%0A%0A
-%0A
 Read

Add callback method to ReadHandler