Skip to content

Commit

Permalink
Describe pre and post adaption phase
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 20, 2014
1 parent f2884cc commit 3d40fd5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
37 changes: 19 additions & 18 deletions _po/ja/tutorial/1.0.6/plugin-development/adapter/index.po
Expand Up @@ -51,17 +51,17 @@ msgstr "## 入力メッセージの加工"
msgid ""
"First, let's study basics with a simple logger plugin named `sample-logger` af"
"fects at the adaption phase."
msgstr ""
"まず`sample-logger`という簡単なロガープラグインを使って、適合フェーズ(adaption phase)に作用するプラグインを作りながら、基礎を"
"学びましょう。"
msgstr "まず`sample-logger`という簡単なロガープラグインを使って、適合フェーズに作用するプラグインを作りながら、基礎を学びましょう。"

msgid ""
"We sometime need to modify incoming requests from outside to Droonga Engine.\n"
"We can use a plugin for this purpose.\n"
"Let's see how to create a plugin for the adaption phase, in this section."
msgstr ""
"外部のシステムからDroonga Engineにやってくるリクエストを加工する必要がある場合があります。このようなときに、プラグインを利用できます。このセク"
"ションでは、どのようにして適合フェーズのプラグインをつくるのかをみていきます。"
"We can use a plugin for this purpose."
msgstr "外部のシステムからDroonga Engineにやってくるリクエストを加工する必要がある場合があります。このようなときに、プラグインを利用できます。"

msgid ""
"Let's see how to create a plugin for the *pre adaption phase*, in this section"
"."
msgstr "このセクションでは、どのようにして*前適合フェーズ*のプラグインを作るのかを見てみていきます。"

msgid "### Directory Structure"
msgstr "### ディレクトリの構造"
Expand Down Expand Up @@ -153,14 +153,14 @@ msgid ""
" * The `sample-logger` is the name of the plugin itself. You'll use it in your"
" `catalog.json`, to activate the plugin.\n"
" * As the example above, you must define your plugin as a module.\n"
" * Behaviors at the adaption phase is defined a class called *adapter*.\n"
" * Behaviors at the pre adaption phase is defined a class called *adapter*.\n"
" An adapter class must be defined as a subclass of the `Droonga::Adapter`, u"
"nder the namespace of the plugin module."
msgstr ""
" * `sample-logger`は、このプラグイン自身の名前です。これは`catalog.json`の中で、プラグインを有効化するために使う事になります"
"。\n"
" * 上記の例のように、プラグインはモジュールとして定義する必要があります。\n"
" * 適合フェーズでの振る舞いは、*アダプター*と呼ばれるクラスとして定義します。\n"
" * 前適合フェーズでの振る舞いは、*アダプター*と呼ばれるクラスとして定義します。\n"
" アダプタークラスは必ず、プラグインのモジュールの名前空間の配下で、`Droonga::Adapter`のサブクラスとして定義する必要があります。"

msgid "### Activate the plugin with `catalog.json`"
Expand Down Expand Up @@ -192,12 +192,12 @@ msgstr ""
msgid ""
"Note: you must place `\"sample-logger\"` before `\"search\"`, because the `sample-"
"logger` plugin depends on the `search`. Droonga Engine applies plugins at the "
"adaption phase in the order defined in the `catalog.json`, so you must resolve"
" plugin dependencies by your hand (for now)."
"pre adaption phase in the order defined in the `catalog.json`, so you must res"
"olve plugin dependencies by your hand (for now)."
msgstr ""
"注意:`\"sample-logger\"`は`\"search\"`よりも前に置く必要があります。これは、`sample-logger`プラグインが`search"
"`に依存しているからです。Droonga Engineは適合フェーズにおいて、プラグインを`catalog.json`で定義された順に適用しますので、プラグ"
"イン同士の依存関係は(今のところは)自分で解決しなくてはなりません。"
"`に依存しているからです。Droonga Engineは前適合フェーズにおいて、プラグインを`catalog.json`で定義された順に適用しますので、プラ"
"グイン同士の依存関係は(今のところは)自分で解決しなくてはなりません。"

msgid "### Run and test"
msgstr "### 実行と動作を確認する"
Expand Down Expand Up @@ -614,12 +614,12 @@ msgid "### Modify results in the adaption phase"
msgstr "### 結果を適合フェーズで加工する"

msgid ""
"Let's modify the result.\n"
"Let's modify the result at the *post adaption phase*.\n"
"For example, add `completedAt` attribute that shows the time completed the req"
"uest.\n"
"Update your plugin as follows:"
msgstr ""
"結果を加工してみましょう。\n"
"*後適合フェーズ*において、結果を加工してみましょう。\n"
"例えば、リクエストに対する処理が完了した時刻を示す`completedAt`というアトリビュートを加えるとします。\n"
"プラグインを以下のように更新して下さい:"

Expand Down Expand Up @@ -702,10 +702,11 @@ msgid "## Adaption for both incoming and outgoing messages"
msgstr "## 入出力メッセージの加工"

msgid ""
"We have learned the basics of plugins for the adaption phase so far.\n"
"We have learned the basics of plugins for the pre adaption phase and the post "
"adaption phase so far.\n"
"Let's try to build more practical plugin."
msgstr ""
"ここまでで、適合フェーズで動作するプラグインの基本を学びました。\n"
"ここまでで、前適合フェーズと後適合フェーズで動作するプラグインの基本を学びました。\n"
"それでは、より実践的なプラグインを開発してみることにしましょう。"

msgid ""
Expand Down
12 changes: 7 additions & 5 deletions ja/tutorial/1.0.6/plugin-development/adapter/index.md
Expand Up @@ -31,7 +31,9 @@ Droongaプラグインを自分で開発するための手順を身につけま

まず`sample-logger`という簡単なロガープラグインを使って、アダプション・フェーズに作用するプラグインを作りながら、基礎を学びましょう。

外部のシステムからDroonga Engineにやってくるリクエストを加工する必要がある場合があります。このようなときに、プラグインを利用できます。このセクションでは、どのようにしてアダプション・フェーズのプラグインをつくるのかをみていきます。
外部のシステムからDroonga Engineにやってくるリクエストを加工する必要がある場合があります。このようなときに、プラグインを利用できます。

このセクションでは、どのようにして*前適合フェーズ*のプラグインを作るのかを見てみていきます。

### ディレクトリの構造

Expand Down Expand Up @@ -85,7 +87,7 @@ end

* `sample-logger`は、このプラグイン自身の名前です。これは`catalog.json`の中で、プラグインを有効化するために使う事になります。
* 上記の例のように、プラグインはモジュールとして定義する必要があります。
* アダプション・フェーズでの振る舞いは*アダプター*と呼ばれるクラスとして定義します。
* 前適合フェーズでの振る舞いは*アダプター*と呼ばれるクラスとして定義します。
アダプタークラスは必ず、プラグインのモジュールの名前空間の配下で、`Droonga::Adapter`のサブクラスとして定義する必要があります。


Expand All @@ -105,7 +107,7 @@ catalog.json:
(snip)
~~~

注意:`"sample-logger"``"search"`よりも前に置く必要があります。これは、`sample-logger`プラグインが`search`に依存しているからです。Droonga Engineはアダプション・フェーズにおいて、プラグインを`catalog.json`で定義された順に適用しますので、プラグイン同士の依存関係は(今のところは)自分で解決しなくてはなりません。
注意:`"sample-logger"``"search"`よりも前に置く必要があります。これは、`sample-logger`プラグインが`search`に依存しているからです。Droonga Engineは前適合フェーズにおいて、プラグインを`catalog.json`で定義された順に適用しますので、プラグイン同士の依存関係は(今のところは)自分で解決しなくてはなりません。

### 実行と動作を確認する

Expand Down Expand Up @@ -407,7 +409,7 @@ fluentdのログは以下のようになっているはずです:

### 結果をアダプション・フェーズで加工する

結果を加工してみましょう。
*後適合フェーズ*において、結果を加工してみましょう。
例えば、リクエストに対する処理が完了した時刻を示す`completedAt`というアトリビュートを加えるとします。
プラグインを以下のように更新して下さい:

Expand Down Expand Up @@ -472,7 +474,7 @@ Elapsed time: 0.013983

## 入出力メッセージの加工

ここまでで、アダプション・フェーズで動作するプラグインの基本を学びました
ここまでで、前適合フェーズと後適合フェーズで動作するプラグインの基本を学びました
それでは、より実践的なプラグインを開発してみることにしましょう。

Droongaの`search`コマンドを見た時、目的に対していささか柔軟すぎるという印象を持ったことと思います
Expand Down
11 changes: 6 additions & 5 deletions tutorial/1.0.6/plugin-development/adapter/index.md
Expand Up @@ -24,7 +24,8 @@ First, let's study basics with a simple logger plugin named `sample-logger` affe

We sometime need to modify incoming requests from outside to Droonga Engine.
We can use a plugin for this purpose.
Let's see how to create a plugin for the adaption phase, in this section.

Let's see how to create a plugin for the *pre adaption phase*, in this section.

### Directory Structure

Expand Down Expand Up @@ -78,7 +79,7 @@ This plugin does nothing except registering itself to the Droonga Engine.

* The `sample-logger` is the name of the plugin itself. You'll use it in your `catalog.json`, to activate the plugin.
* As the example above, you must define your plugin as a module.
* Behaviors at the adaption phase is defined a class called *adapter*.
* Behaviors at the pre adaption phase is defined a class called *adapter*.
An adapter class must be defined as a subclass of the `Droonga::Adapter`, under the namespace of the plugin module.


Expand All @@ -98,7 +99,7 @@ catalog.json:
(snip)
~~~

Note: you must place `"sample-logger"` before `"search"`, because the `sample-logger` plugin depends on the `search`. Droonga Engine applies plugins at the adaption phase in the order defined in the `catalog.json`, so you must resolve plugin dependencies by your hand (for now).
Note: you must place `"sample-logger"` before `"search"`, because the `sample-logger` plugin depends on the `search`. Droonga Engine applies plugins at the pre adaption phase in the order defined in the `catalog.json`, so you must resolve plugin dependencies by your hand (for now).

### Run and test

Expand Down Expand Up @@ -402,7 +403,7 @@ This shows that the result of `search` is passed to the `adapt_output` method (a

### Modify results in the adaption phase

Let's modify the result.
Let's modify the result at the *post adaption phase*.
For example, add `completedAt` attribute that shows the time completed the request.
Update your plugin as follows:

Expand Down Expand Up @@ -467,7 +468,7 @@ The results in `fluentd.log` will be like this:

## Adaption for both incoming and outgoing messages

We have learned the basics of plugins for the adaption phase so far.
We have learned the basics of plugins for the pre adaption phase and the post adaption phase so far.
Let's try to build more practical plugin.

You may feel the Droonga's `search` command is too flexible for your purpose.
Expand Down

0 comments on commit 3d40fd5

Please sign in to comment.