YUKI Hiroshi
null+****@clear*****
Thu Mar 6 18:51:56 JST 2014
YUKI Hiroshi 2014-03-06 18:51:56 +0900 (Thu, 06 Mar 2014) New Revision: 76139cb1d1c8b495d998ed42baa4a29b9cbc5710 https://github.com/droonga/droonga.org/commit/76139cb1d1c8b495d998ed42baa4a29b9cbc5710 Message: Translate plugin API reference for handler Modified files: _po/ja/reference/plugin/handler/index.po ja/reference/plugin/handler/index.md reference/plugin/handler/index.md Modified: _po/ja/reference/plugin/handler/index.po (+46 -9) =================================================================== --- _po/ja/reference/plugin/handler/index.po 2014-03-06 18:13:24 +0900 (2d16dfd) +++ _po/ja/reference/plugin/handler/index.po 2014-03-06 18:51:56 +0900 (5b0e38e) @@ -31,12 +31,14 @@ msgid "" "Each Droonga Engine plugin can have its *handler*.\n" "On the handling phase, handlers can process a request and return a result." msgstr "" +"各々のDroonga Engineプラグインは、それ自身のための*ハンドラー*を持つことができます。Handling Phaseでは、ハンドラーはリクエスト" +"を処理して結果を返すことができます。" msgid "### How to define a handler? {#howto-define}" -msgstr "" +msgstr "### ハンドラーの定義の仕方 {#howto-define}" msgid "For example, here is a sample plugin named \"foo\" with a handler:" -msgstr "" +msgstr "例えば、「foo」という名前のプラグインにハンドラーを定義する場合は以下のようにします:" msgid "" "~~~ruby\n" @@ -66,9 +68,16 @@ msgid "" "end\n" "~~~" msgstr "" +" class Handler < Droonga::Handler\n" +" def handle(message)\n" +" # リクエストを処理するための操作\n" +" end\n" +" end\n" +"end\n" +"~~~" msgid "Steps to define a handler:" -msgstr "" +msgstr "ハンドラーを定義するための手順は以下の通りです:" msgid "" " 1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and re" @@ -76,22 +85,28 @@ msgid "" " 2. Define a \"single step\" corresponding to the handler you are going to imple" "ment, via [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinitio" "n). (required)\n" -" 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheri" +" 3. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheri" "ting [`Droonga::Handler`](#classes-Droonga-Handler). (required)\n" " 4. Define handling logic for requests as [`#handle`](#classes-Droonga-Handler" "-handle). (optional)" msgstr "" +" 1. プラグイン用のモジュール(例:`Droonga::Plugins::FooPlugin`)を定義し、プラグインとして登録する。(必須)\n" +" 2. [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinition)を使い、" +"実装しようとしているハンドラーに対応する「single step」を定義する。(必須)\n" +" 3. [`Droonga::Handler`](#classes-Droonga-Handler)を継承したハンドラークラス(例:`Droonga::Pl" +"ugins::FooPlugin::Handler`)を定義する。(必須)\n" +" 4. リクエストを処理する操作を[`#handle`](#classes-Droonga-Handler-handle)として定義する。(任意)\n" msgid "" "See also the [plugin development tutorial](../../../tutorial/plugin-developmen" "t/handler/)." -msgstr "" +msgstr "[プラグイン開発チュートリアル](../../../tutorial/plugin-development/handler/)も併せて参照して下さい。" msgid "### How a handler works? {#how-works}" -msgstr "" +msgstr "### ハンドラーはどのように操作するか {#how-works}" msgid "A handler works like following:" -msgstr "" +msgstr "ハンドラーは以下のように動作します:" msgid "" " 1. The Droonga Engine starts.\n" @@ -115,16 +130,34 @@ msgid "" " * All \"step\"s finish their task, the processing phase for the request ends" "." msgstr "" +" 1. Droonga Engineが起動する。\n" +" * stepとハンドラークラスが登録される。\n" +" * Droonga Engineが起動し、入力メッセージを待ち受ける。\n" +" 2. Adaption Phaseからメッセージが転送されてくる。\n" +" この時点でProcessing Phaseが開始される。\n" +" * Droonga Engineが、メッセージタイプからstepの定義を見つける。\n" +" * Droonga Engineが、登録済みの定義に従ってsingle stepを作成する。\n" +" * single stepが、登録済みのハンドラークラスのインスタンスを作成する。\n" +" この時点でHandling Phaseが開始される。\n" +" * ハンドラーの[`#handle`](#classes-Droonga-Handler-handle)メソッドが、リクエストの情報を含むタスク" +"メッセージを伴って呼ばれる。\n" +" * このメソッドにより、入力メッセージを任意に処理することができる。\n" +" * このメソッドは、処理結果の出力を戻り値として返す。\n" +" * ハンドラーの処理が完了した時点で、そのタスクメッセージ(およびリクエスト)のHandling Phaseが終了する。\n" +" * メッセージタイプからstepが見つからなかった場合は、何も処理されない。\n" +" * すべてのstepが処理を終えた時点で、そのリクエストに対するProcessing Phaseが終了する。" msgid "" "As described above, the Droonga Engine creates an instance of the handler clas" "s for each request." -msgstr "" +msgstr "上記の通り、Droonga Engineは各リクエストに対してその都度ハンドラークラスのインスタンスを生成します。" msgid "" "Any error raised from the handler is handled by the Droonga Engine itself. See" " also [error handling][]." msgstr "" +"ハンドラー内で発生したすべてのエラーは、Droonga Engine自身によって処理されます。[エラー処理][error handling]も併せて参照して" +"下さい。" msgid "## Configurations {#config}" msgstr "## 設定 {#config}" @@ -137,9 +170,13 @@ msgid "" " Then handlers for these requests have the configuration `action.synchronous " "= true`." msgstr "" +"`action.synchronous` (真偽値, 省略可能, 初期値=`false`)\n" +": リクエストを同期的に処理する必要があるかどうかを示す。\n" +" 例えば、テーブル内に新しいカラムを追加するリクエストは、テーブルが存在しない場合には必ず、テーブル作成用のリクエストの後で処理する必要がある。このような" +"場合のハンドラーは、 `action.synchronous = true` の指定を伴うことになる。" msgid "## Classes and methods {#classes}" -msgstr "" +msgstr "## クラスとメソッド {#classes}" msgid "### `Droonga::SingleStepDefinition` {#classes-Droonga-SingleStepDefinition}" msgstr "" Modified: ja/reference/plugin/handler/index.md (+33 -35) =================================================================== --- ja/reference/plugin/handler/index.md 2014-03-06 18:13:24 +0900 (8e59f75) +++ ja/reference/plugin/handler/index.md 2014-03-06 18:51:56 +0900 (c005c3e) @@ -18,13 +18,12 @@ layout: ja ## 概要 {#abstract} -Each Droonga Engine plugin can have its *handler*. -On the handling phase, handlers can process a request and return a result. +各々のDroonga Engineプラグインは、それ自身のための*ハンドラー*を持つことができます。Handling Phaseでは、ハンドラーはリクエストを処理して結果を返すことができます。 -### How to define a handler? {#howto-define} +### ハンドラーの定義の仕方 {#howto-define} -For example, here is a sample plugin named "foo" with a handler: +例えば、「foo」という名前のプラグインにハンドラーを定義する場合は以下のようにします: ~~~ruby require "droonga/plugin" @@ -41,54 +40,53 @@ module Droonga::Plugins::FooPlugin class Handler < Droonga::Handler def handle(message) - # operations to process a request + # リクエストを処理するための操作 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 "single step" corresponding to the handler you are going to implement, via [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinition). (required) - 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required) - 4. Define handling logic for requests as [`#handle`](#classes-Droonga-Handler-handle). (optional) + 1. プラグイン用のモジュール(例:`Droonga::Plugins::FooPlugin`)を定義し、プラグインとして登録する。(必須) + 2. [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinition)を使い、実装しようとしているハンドラーに対応する「single step」を定義する。(必須) + 3. [`Droonga::Handler`](#classes-Droonga-Handler)を継承したハンドラークラス(例:`Droonga::Plugins::FooPlugin::Handler`)を定義する。(必須) + 4. リクエストを処理する操作を[`#handle`](#classes-Droonga-Handler-handle)として定義する。(任意) -See also the [plugin development tutorial](../../../tutorial/plugin-development/handler/). +[プラグイン開発チュートリアル](../../../tutorial/plugin-development/handler/)も併せて参照して下さい。 -### How a handler works? {#how-works} -A handler works like following: +### ハンドラーはどのように操作するか {#how-works} - 1. The Droonga Engine starts. - * Your custom steps are registered. - Your custom handler classes also. - * Then the Droonga Engine starts to wait for request messages. - 2. A request message is transferred from the adaption phase. - Then, the processing phase starts. - * The Droonga Engine finds a step definition from the message type. - * The Droonga Engine builds a "single step" based on the registered definition. - * A "single step" creates an instance of the registered handler class. - Then the Droonga Engine enters to the handling phase. - * The handler's [`#handle`](#classes-Droonga-Handler-handle) is called with a task massage including the request. - * The method can process the given incoming message as you like. - * The method returns a result value, as the output. - * After the handler finishes, the handling phase for the task message (and the request) ends. - * If no "step" is found for the type, nothing happens. - * All "step"s finish their task, the processing phase for the request ends. +ハンドラーは以下のように動作します: -As described above, the Droonga Engine creates an instance of the handler class for each request. + 1. Droonga Engineが起動する。 + * stepとハンドラークラスが登録される。 + * Droonga Engineが起動し、入力メッセージを待ち受ける。 + 2. Adaption Phaseからメッセージが転送されてくる。 + この時点でProcessing Phaseが開始される。 + * Droonga Engineが、メッセージタイプからstepの定義を見つける。 + * Droonga Engineが、登録済みの定義に従ってsingle stepを作成する。 + * single stepが、登録済みのハンドラークラスのインスタンスを作成する。 + この時点でHandling Phaseが開始される。 + * ハンドラーの[`#handle`](#classes-Droonga-Handler-handle)メソッドが、リクエストの情報を含むタスクメッセージを伴って呼ばれる。 + * このメソッドにより、入力メッセージを任意に処理することができる。 + * このメソッドは、処理結果の出力を戻り値として返す。 + * ハンドラーの処理が完了した時点で、そのタスクメッセージ(およびリクエスト)のHandling Phaseが終了する。 + * メッセージタイプからstepが見つからなかった場合は、何も処理されない。 + * すべてのstepが処理を終えた時点で、そのリクエストに対するProcessing Phaseが終了する。 -Any error raised from the handler is handled by the Droonga Engine itself. See also [error handling][]. +上記の通り、Droonga Engineは各リクエストに対してその都度ハンドラークラスのインスタンスを生成します。 + +ハンドラー内で発生したすべてのエラーは、Droonga Engine自身によって処理されます。[エラー処理][error handling]も併せて参照して下さい。 ## 設定 {#config} -`action.synchronous` (boolean, optional, default=`false`) -: Indicates that the request must be processed synchronously. - For example, a request to define a new column in a table must be processed after a request to define the table itself, if the table does not exist yet. - Then handlers for these requests have the configuration `action.synchronous = true`. +`action.synchronous` (真偽値, 省略可能, 初期値=`false`) +: リクエストを同期的に処理する必要があるかどうかを示す。 + 例えば、テーブル内に新しいカラムを追加するリクエストは、テーブルが存在しない場合には必ず、テーブル作成用のリクエストの後で処理する必要がある。このような場合のハンドラーは、 `action.synchronous = true` の指定を伴うことになる。 ## クラスとメソッド {#classes} Modified: reference/plugin/handler/index.md (+1 -1) =================================================================== --- reference/plugin/handler/index.md 2014-03-06 18:13:24 +0900 (cf90ddf) +++ reference/plugin/handler/index.md 2014-03-06 18:51:56 +0900 (ae183e9) @@ -42,7 +42,7 @@ 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 "single step" corresponding to the handler you are going to implement, via [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinition). (required) - 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required) + 3. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required) 4. Define handling logic for requests as [`#handle`](#classes-Droonga-Handler-handle). (optional) See also the [plugin development tutorial](../../../tutorial/plugin-development/handler/). -------------- next part -------------- HTML����������������������������...Descargar