[Groonga-commit] droonga/express-droonga at 20b227a [master] Inherit at first

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Dec 16 16:05:15 JST 2013


YUKI Hiroshi	2013-12-16 16:05:15 +0900 (Mon, 16 Dec 2013)

  New Revision: 20b227a6d1e0df64e37ab5e3ec953f8c4600bbfa
  https://github.com/droonga/express-droonga/commit/20b227a6d1e0df64e37ab5e3ec953f8c4600bbfa

  Message:
    Inherit at first

  Modified files:
    lib/adapter/command.js
    lib/adapter/http.js

  Modified: lib/adapter/command.js (+14 -14)
===================================================================
--- lib/adapter/command.js    2013-12-16 16:03:09 +0900 (cb09541)
+++ lib/adapter/command.js    2013-12-16 16:05:15 +0900 (09fb6f8)
@@ -35,9 +35,9 @@ function RequestResponse(options) {
   Command.apply(this, arguments);
 }
 RequestResponse.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
   Object.defineProperty(targetClass.prototype, 'onRequest', {
     get: function() { return this._options.onRequest; }
@@ -54,9 +54,9 @@ function PublishSubscribe(options) {
   Command.apply(this, arguments);
 }
 PublishSubscribe.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
   Object.defineProperty(targetClass.prototype, 'onSubscribe', {
     get: function() { return this._options.onSubscribe; }
@@ -86,9 +86,9 @@ function HTTPCommand(options) {
   Command.apply(this, arguments);
 }
 HTTPCommand.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
   Object.defineProperty(targetClass.prototype, 'path', {
     get: function() { return this._options.path; }
@@ -106,10 +106,10 @@ function HTTPRequestResponse(options) {
   Command.apply(this, arguments);
 }
 HTTPRequestResponse.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
   RequestResponse.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
 };
 HTTPRequestResponse.extend(HTTPRequestResponse);
@@ -121,9 +121,9 @@ function SocketCommand() {
   Command.apply(this, arguments);
 }
 SocketCommand.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
 };
 SocketCommand.extend(SocketCommand);
@@ -134,10 +134,10 @@ function SocketRequestResponse(options) {
   Command.apply(this, arguments);
 }
 SocketRequestResponse.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
   RequestResponse.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
 };
 SocketRequestResponse.extend(SocketRequestResponse);
@@ -148,10 +148,10 @@ function SocketPublishSubscribe(options) {
   Command.apply(this, arguments);
 }
 SocketPublishSubscribe.extend = function(targetClass) {
-  if (targetClass.commandTypes.indexOf(this))
-    return;
   Command.extend(targetClass);
   PublishSubscribe.extend(targetClass);
+  if (targetClass.commandTypes.indexOf(this) > -1)
+    return;
   targetClass.commandTypes.push(this);
 };
 SocketPublishSubscribe.extend(SocketPublishSubscribe);

  Modified: lib/adapter/http.js (+7 -5)
===================================================================
--- lib/adapter/http.js    2013-12-16 16:03:09 +0900 (c415b77)
+++ lib/adapter/http.js    2013-12-16 16:05:15 +0900 (2fe62d7)
@@ -11,7 +11,7 @@ function createRequestResponseHandler(params) {
   var definition = params.definition;
 
   return (function(request, response) {
-    debug('adapter.http.createRequestResponseHandler.handle');
+    console.log('adapter.http.createRequestResponseHandler.handle');
 
     var timeout = definition.timeout || null;
     var options = {
@@ -19,13 +19,13 @@ function createRequestResponseHandler(params) {
       timeout: timeout
     };
     var callback = function(error, message) {
-        debug('adapter.http.createRequestResponseHandler.handle.response');
+        console.log('adapter.http.createRequestResponseHandler.handle.response');
         if (error) {
-          debug('adapter.http.createRequestResponseHandler.handle.response.error:', error);
+          console.log('adapter.http.createRequestResponseHandler.handle.response.error:', error);
           var body = message && message.body || null;
           response.jsonp(body, error);
         } else {
-          debug('adapter.http.createRequestResponseHandler.handle.response.success');
+          console.log('adapter.http.createRequestResponseHandler.handle.response.success');
           var body = message.body;
           if (definition.onResponse) {
             definition.onResponse(body, response);
@@ -57,7 +57,7 @@ function createGenericHandler(params) {
   var definition = params.definition;
 
   return (function(request, response) {
-    debug('adapter.http.createGenericHandler.handle');
+    console.log('adapter.http.createGenericHandler.handle');
 
     var wrappedConnection = new wrapper.DroongaProtocolConnectionWrapper(connection, options);
     try {
@@ -112,10 +112,12 @@ exports.register = function(application, params) {
 
     var creator;
     if (command.RequestResponse.isInstance(definition)) {
+console.log('REGISTER '+commandName+' AS REQ-REP');
       creator = createRequestResponseHandler;
     } else {
       if (typeof definition.onHandle != 'function')
         throw new Error('onHandle() is missing');
+console.log('REGISTER '+commandName+' AS GENERIC');
       creator = createGenericHandler;
     }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index