[Groonga-commit] droonga/droonga.org at 9bcf5bc [gh-pages] Add plugin API reference for handler (WIP)

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Feb 20 19:03:37 JST 2014


YUKI Hiroshi	2014-02-20 19:03:37 +0900 (Thu, 20 Feb 2014)

  New Revision: 9bcf5bc88c1f9a0e3d40485bf208f39fff964947
  https://github.com/droonga/droonga.org/commit/9bcf5bc88c1f9a0e3d40485bf208f39fff964947

  Message:
    Add plugin API reference for handler (WIP)

  Added files:
    _po/ja/reference/plugin/handler/index.po
    ja/reference/plugin/handler/index.md
    reference/plugin/handler/index.md

  Added: _po/ja/reference/plugin/handler/index.po (+164 -0) 100644
===================================================================
--- /dev/null
+++ _po/ja/reference/plugin/handler/index.po    2014-02-20 19:03:37 +0900 (e6b4b4f)
@@ -0,0 +1,164 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-11-20 22:17+0900\n"
+"PO-Revision-Date: 2013-12-25 18:27+0900\n"
+"Last-Translator: Kouhei Sutou <kou �� clear-code.com>\n"
+"Language-Team: Japanese\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+msgid ""
+"---\n"
+"title: API set for plugins on the handling phase\n"
+"layout: en\n"
+"---"
+msgstr ""
+
+msgid ""
+"* TOC\n"
+"{:toc}"
+msgstr ""
+
+msgid "## Abstract {#abstract}"
+msgstr "## 概要 {#abstract}"
+
+msgid ""
+"Each Droonga Engine plugin can have its *handler*.\n"
+"On the handling phase, handlers can process any incoming message and output va"
+"rious messages (ex. a \"response\" for a \"request\") as you like."
+msgstr ""
+
+msgid "### How to define a handler? {#howto-define}"
+msgstr ""
+
+msgid "For example, here is a sample plugin named \"foo\" with a handler:"
+msgstr ""
+
+msgid ""
+"~~~ruby\n"
+"require \"droonga/plugin\""
+msgstr ""
+
+msgid ""
+"module Droonga::Plugins::FooPlugin\n"
+"  Plugin.registry.register(\"foo\", self)"
+msgstr ""
+
+msgid ""
+"  class Handler < Droonga::Handler\n"
+"    # operations to configure this handler\n"
+"    XXXXXX = XXXXXX"
+msgstr ""
+
+msgid ""
+"    def handle(message, messenger)\n"
+"      # operations to process incoming messages\n"
+"    end\n"
+"  end\n"
+"end\n"
+"~~~"
+msgstr ""
+
+msgid "Steps to define a handler:"
+msgstr ""
+
+msgid ""
+" 1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and re"
+"gister it as a plugin. (required)\n"
+" 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheri"
+"ting [`Droonga::Handler`](#classes-Droonga-Handler). (required)\n"
+" 3. [Configure conditions for the handler](#howto-configure). (required)\n"
+" 4. Define handling logic for incoming messages as [`#handle`](#classes-Droong"
+"a-Handler-handle). (optional)"
+msgstr ""
+
+msgid ""
+"See also the [plugin development tutorial](../../../tutorial/plugin-developmen"
+"t/handler/)."
+msgstr ""
+
+msgid "### How a handler works? {#how-works}"
+msgstr ""
+
+msgid "A handler works like following:"
+msgstr ""
+
+msgid ""
+" 1. The Droonga Engine starts.\n"
+"    * A global instance of the handler class (ex. `Droonga::Plugins::FooPlugin"
+"::Handler`) is created and it is registered.\n"
+"      * The message type is registered.\n"
+"    * The Droonga Engine starts to wait for incoming messages.\n"
+" 2. An incoming message is transferred from the planning phase.\n"
+"    Then, the handling phase starts.\n"
+"    * The Droonga Engine finds the handler from the message type.\n"
+"    * Found handler's [`#handle`](#classes-Droonga-Handler-handle) is called w"
+"ith the incoming message.\n"
+"      * The method can process the given incoming message as you like.\n"
+"      * The method can output any message as you like.\n"
+"    * If no handler is found for the type, nothing happens.\n"
+" 3. After the handler finishes (or no handler is found), the handling phase fo"
+"r the incoming message ends."
+msgstr ""
+
+msgid ""
+"As described above, the Droonga Engine creates only one global instance of the"
+" handler class for each plugin.\n"
+"You should not keep stateful information as instance variables of the handler "
+"itself.\n"
+"Instead, you should use the body of messages."
+msgstr ""
+
+msgid ""
+"Any error raised from the handler is handled by the Droonga Engine itself. See"
+" also [error handling][]."
+msgstr ""
+
+msgid "## Configurations {#config}"
+msgstr ""
+
+msgid ""
+"`message.type` (`String`, required)\n"
+": (TBD)"
+msgstr ""
+
+msgid ""
+"`action.synchronous` (boolean, optional, default=false)\n"
+": (TBD)"
+msgstr ""
+
+msgid "## Classes and methods {#classes}"
+msgstr ""
+
+msgid "### `Droonga::Handler` {#classes-Droonga-Handler}"
+msgstr ""
+
+msgid ""
+"This is the common base class of any handler. Your plugin's handler class must"
+" inherit this."
+msgstr ""
+
+msgid "#### `#handle(message, messenger)` {#classes-Droonga-Handler-handle}"
+msgstr ""
+
+msgid ""
+"This method receives a [`Droonga::HandlerMessage`](#classes-Droonga-HandlerMes"
+"sage) wrapped incoming message."
+msgstr ""
+
+msgid "(TBD)"
+msgstr ""
+
+msgid "### `Droonga::HandlerMessage` {#classes-Droonga-HandlerMessage}"
+msgstr ""
+
+msgid "#### `#request` {#classes-Droonga-HandlerMessage-request}"
+msgstr ""
+
+msgid "  [error handling]: ../error/"
+msgstr ""

  Added: ja/reference/plugin/handler/index.md (+107 -0) 100644
===================================================================
--- /dev/null
+++ ja/reference/plugin/handler/index.md    2014-02-20 19:03:37 +0900 (4cc1385)
@@ -0,0 +1,107 @@
+---
+title: API set for plugins on the handling phase
+layout: en
+---
+
+{% comment %}
+##############################################
+  THIS FILE IS AUTOMATICALLY GENERATED FROM
+  "_po/ja/reference/plugin/handler/index.po"
+  DO NOT EDIT THIS FILE MANUALLY!
+##############################################
+{% endcomment %}
+
+
+* TOC
+{:toc}
+
+
+## 概要 {#abstract}
+
+Each Droonga Engine plugin can have its *handler*.
+On the handling phase, handlers can process any incoming message and output various messages (ex. a "response" for a "request") as you like.
+
+
+### How to define a handler? {#howto-define}
+
+For example, here is a sample plugin named "foo" with a handler:
+
+~~~ruby
+require "droonga/plugin"
+
+module Droonga::Plugins::FooPlugin
+  Plugin.registry.register("foo", self)
+
+  class Handler < Droonga::Handler
+    # operations to configure this handler
+    XXXXXX = XXXXXX
+
+    def handle(message, messenger)
+      # operations to process incoming messages
+    end
+  end
+end
+~~~
+
+Steps to define a handler:
+
+ 1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and register it as a plugin. (required)
+ 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required)
+ 3. [Configure conditions for the handler](#howto-configure). (required)
+ 4. Define handling logic for incoming messages as [`#handle`](#classes-Droonga-Handler-handle). (optional)
+
+See also the [plugin development tutorial](../../../tutorial/plugin-development/handler/).
+
+
+### How a handler works? {#how-works}
+
+A handler works like following:
+
+ 1. The Droonga Engine starts.
+    * A global instance of the handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) is created and it is registered.
+      * The message type is registered.
+    * The Droonga Engine starts to wait for incoming messages.
+ 2. An incoming message is transferred from the planning phase.
+    Then, the handling phase starts.
+    * The Droonga Engine finds the handler from the message type.
+    * Found handler's [`#handle`](#classes-Droonga-Handler-handle) is called with the incoming message.
+      * The method can process the given incoming message as you like.
+      * The method can output any message as you like.
+    * If no handler is found for the type, nothing happens.
+ 3. After the handler finishes (or no handler is found), the handling phase for the incoming message ends.
+
+As described above, the Droonga Engine creates only one global instance of the handler class for each plugin.
+You should not keep stateful information as instance variables of the handler itself.
+Instead, you should use the body of messages.
+
+Any error raised from the handler is handled by the Droonga Engine itself. See also [error handling][].
+
+
+## Configurations {#config}
+
+`message.type` (`String`, required)
+: (TBD)
+
+`action.synchronous` (boolean, optional, default=false)
+: (TBD)
+
+
+## Classes and methods {#classes}
+
+### `Droonga::Handler` {#classes-Droonga-Handler}
+
+This is the common base class of any handler. Your plugin's handler class must inherit this.
+
+#### `#handle(message, messenger)` {#classes-Droonga-Handler-handle}
+
+This method receives a [`Droonga::HandlerMessage`](#classes-Droonga-HandlerMessage) wrapped incoming message.
+
+(TBD)
+
+### `Droonga::HandlerMessage` {#classes-Droonga-HandlerMessage}
+
+#### `#request` {#classes-Droonga-HandlerMessage-request}
+
+(TBD)
+
+  [error handling]: ../error/

  Added: reference/plugin/handler/index.md (+98 -0) 100644
===================================================================
--- /dev/null
+++ reference/plugin/handler/index.md    2014-02-20 19:03:37 +0900 (d1bdddb)
@@ -0,0 +1,98 @@
+---
+title: API set for plugins on the handling phase
+layout: en
+---
+
+* TOC
+{:toc}
+
+
+## Abstract {#abstract}
+
+Each Droonga Engine plugin can have its *handler*.
+On the handling phase, handlers can process any incoming message and output various messages (ex. a "response" for a "request") as you like.
+
+
+### How to define a handler? {#howto-define}
+
+For example, here is a sample plugin named "foo" with a handler:
+
+~~~ruby
+require "droonga/plugin"
+
+module Droonga::Plugins::FooPlugin
+  Plugin.registry.register("foo", self)
+
+  class Handler < Droonga::Handler
+    # operations to configure this handler
+    XXXXXX = XXXXXX
+
+    def handle(message, messenger)
+      # operations to process incoming messages
+    end
+  end
+end
+~~~
+
+Steps to define a handler:
+
+ 1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and register it as a plugin. (required)
+ 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required)
+ 3. [Configure conditions for the handler](#howto-configure). (required)
+ 4. Define handling logic for incoming messages as [`#handle`](#classes-Droonga-Handler-handle). (optional)
+
+See also the [plugin development tutorial](../../../tutorial/plugin-development/handler/).
+
+
+### How a handler works? {#how-works}
+
+A handler works like following:
+
+ 1. The Droonga Engine starts.
+    * A global instance of the handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) is created and it is registered.
+      * The message type is registered.
+    * The Droonga Engine starts to wait for incoming messages.
+ 2. An incoming message is transferred from the planning phase.
+    Then, the handling phase starts.
+    * The Droonga Engine finds the handler from the message type.
+    * Found handler's [`#handle`](#classes-Droonga-Handler-handle) is called with the incoming message.
+      * The method can process the given incoming message as you like.
+      * The method can output any message as you like.
+    * If no handler is found for the type, nothing happens.
+ 3. After the handler finishes (or no handler is found), the handling phase for the incoming message ends.
+
+As described above, the Droonga Engine creates only one global instance of the handler class for each plugin.
+You should not keep stateful information as instance variables of the handler itself.
+Instead, you should use the body of messages.
+
+Any error raised from the handler is handled by the Droonga Engine itself. See also [error handling][].
+
+
+## Configurations {#config}
+
+`message.type` (`String`, required)
+: (TBD)
+
+`action.synchronous` (boolean, optional, default=false)
+: (TBD)
+
+
+## Classes and methods {#classes}
+
+### `Droonga::Handler` {#classes-Droonga-Handler}
+
+This is the common base class of any handler. Your plugin's handler class must inherit this.
+
+#### `#handle(message, messenger)` {#classes-Droonga-Handler-handle}
+
+This method receives a [`Droonga::HandlerMessage`](#classes-Droonga-HandlerMessage) wrapped incoming message.
+
+(TBD)
+
+### `Droonga::HandlerMessage` {#classes-Droonga-HandlerMessage}
+
+#### `#request` {#classes-Droonga-HandlerMessage-request}
+
+(TBD)
+
+  [error handling]: ../error/
-------------- next part --------------
HTML����������������������������...
Download 



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