[openrtm-commit:02861] r1056 - in branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC: idl src/jp/go/aist/rtm/RTC

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 10月 6日 (金) 16:12:03 JST


Author: kawauchi
Date: 2017-10-06 16:12:02 +0900 (Fri, 06 Oct 2017)
New Revision: 1056

Added:
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CompParam.java
Modified:
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/idl/Manager.idl
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
Log:
[merge] r1048-1055 have been merged from trunk.

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/idl/Manager.idl
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/idl/Manager.idl	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/idl/Manager.idl	2017-10-06 07:12:02 UTC (rev 1056)
@@ -5,9 +5,7 @@
  * @date $Date: 2005-05-12 09:06:18 $
  * @author Noriaki Ando <n-ando at aist.go.jp>
  *
- * Copyright (C) 2003-2005
- *     Task-intelligence Research Group,
- *     Intelligent Systems Research Institute,
+ * Copyright (C) 2003-2017
  *     National Institute of
  *         Advanced Industrial Science and Technology (AIST), Japan
  *     All rights reserved.
@@ -45,25 +43,96 @@
   interface Manager;
   typedef sequence<Manager> ManagerList;
 
+  /*!
+   * @if jp
+   * @interface Manager
+   *
+   * RTコンポーネントのライフサイクルの管理などを行うManagerへの外部イ
+   * ンターフェース。主たる機能としては、以下のものがある。
+   *
+   * - RTCのローダブルモジュールの操作
+   *  - モジュールのロード
+   *  - モジュールのアンロード
+   *  - ロード可能なモジュール一覧の取得
+   *  - ロード済みモジュール一覧の取得
+   *  - ロード済みモジュールのプロファイル一覧の取得
+   * - RTCに関する操作
+   *  - コンポーネントの生成
+   *  - コンポーネントの削除
+   *  - インスタンス化済みのRTC一覧の取得
+   *  - インスタンス化済みのRTCのプロファイル一覧の取得
+   *  - 名前によるコンポーネントの取得
+   * - マネージャに関する操作
+   *  - マネージャのプロファイル情報の取得
+   *  - マネージャのコンフィギュレーション情報の取得
+   *  - マネージャのコンフィギュレーション情報の設定
+   *  - マネージャがマスターかどうか
+   *  - マスターマネージャの取得
+   *  - マスターマネージャの追加
+   *  - マスターマネージャの削除
+   *  - スレーブマネージャの取得
+   *  - スレーブマネージャの追加
+   *  - スレーブマネージャの削除
+   *  - サービスの取得
+   * - プロセス操作
+   *  - フォーク
+   *  - シャットダウン
+   *  - リスタート
+   *
+   * マネージャには、同一ノード内で原則1つしか存在しないマスターマネー
+   * ジャと、マスターマネージャの管理下に0個以上存在するスレーブマネー
+   * ジャが存在する。
+   *
+   * マスターマネージャは通常、デーモン・サービスなどとして常駐し、ノー
+   * ドのOS稼働中は原則として常に動作し続ける。また、マスターマネージャ
+   * は自身の内部にRTCを生成・ホストせず、RTCの生成はスレーブマネージャ
+   * に依頼する。依頼するスレーブマネージャは、すでに起動しているもので
+   * も、マスターマネージャが新規に起動してもよい。どちらの方法でRTCを
+   * 生成するかは、create_component() の引数にて指定する。なお、スレー
+   * ブマネージャは通常、1つ以上のRTCをホストする。デフォルトの設定では、
+   * RTCをホストしていないスレーブマネージャは自動終了する。
+   * 設定項目:
+   * - manager.shutdown_on_nortcs: YES
+   * - manager.shutdown_auto: YES
+   *
+   * <pre>
+   *           1       0..*         1       1..*
+   * [ master ]<>----------[ slave ]<>----------[ RTC ]
+   *
+   * </pre>
+   *
+   * @else
+   * @interface
+   *
+   * @endif
+   */
   interface Manager
   {
-    // module ´ØÏ¢
+    // module 関連
     /*!
      * @if jp
-     * @brief ¥â¥¸¥å¡¼¥ë¤ò¥í¡¼¥É¤¹¤ë
+     * @brief モジュールをロードする
      *
-     * Åö³º¥Þ¥Í¡¼¥¸¥ã¤Ë»ØÄꤵ¤ì¤¿¥â¥¸¥å¡¼¥ë¤ò¥í¡¼¥É¤·¡¢»ØÄꤵ¤ì¤¿½é´ü²½
-     * ´Ø¿ô¤Ç½é´ü²½¤ò¹Ô¤¦¡£
+     * 当該マネージャに指定されたモジュールをロードし、指定された初期化
+     * 関数で初期化を行う。任意の共有オブジェクトファイル (.so, .dll)
+     * をロード可能であり、コンポーネントの共有オブジェクトファイルに限
+     * らない。通常、RTCの生成時は自動的にロードパス上を共有オブジェク
+     * トファイルを探索するため、この操作を呼び出す必要はない。
      *
-     * @param pathname ¥â¥¸¥å¡¼¥ë¤Ø¤Î¥Ñ¥¹
-     * @param initfunc ¥â¥¸¥å¡¼¥ë¤Î½é´ü²½´Ø¿ô
-     * @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+     * @param pathname モジュールへのパス
+     * @param initfunc モジュールの初期化関数
+     * @return リターンコード
      *
      * @else
      * @brief Loading a module
      *
-     * This operation loads a specified loadable module¡¢and perform
-     * initialization with the specified function.
+     * This operation loads a specified loadable module、and perform
+     * initialization with the specified function. Any kind of shared
+     * objects (.so, .dll) not only RT-Component's shared object can
+     * be loadable. Usually, you do not need to call this operation to
+     * create RT-Components, because RTC creation operation
+     * automatically search RTC's loadable module in the specified
+     * load path.
      *
      * @param pathname A path to a loading module.
      * @param initfunc Module initialization function.
@@ -75,17 +144,29 @@
 
     /*!
      * @if jp
-     * @brief ¥â¥¸¥å¡¼¥ë¤ò¥¢¥ó¥í¡¼¥É¤¹¤ë
+     * @brief モジュールをアンロードする
      *
-     * Åö³º¥Þ¥Í¡¼¥¸¥ã¤Ë»ØÄꤵ¤ì¤¿¥â¥¸¥å¡¼¥ë¤ò¥¢¥ó¥í¡¼¥É¤¹¤ë¡£
+     * 当該マネージャに指定されたモジュールをアンロードする。現在のとこ
+     * ろ、OpenRTM-aistのモジュールロード機能は、ロードされたモジュール
+     * により生成されたオブジェクトのリファレンスカウント管理等は行われ
+     * ていないので、安易にモジュールをアンロードすると、メモリアクセス
+     * 違反を引き起こす恐れがある。ただ、多くの動的ライブラリのアンロー
+     * ドの実装では、実際にメモリ上からアンロードされないケースが多く、
+     * したがってこのオペレーションは呼び出すことを推奨しない。
      *
-     * @param pathname ¥â¥¸¥å¡¼¥ë¤Ø¤Î¥Ñ¥¹
-     * @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+     * @param pathname モジュールへのパス
+     * @return リターンコード
      *
      * @else
      * @brief Unloading a module
      *
-     * This operation unloads a specified loadable module.
+     * This operation unloads a specified loadable module. Currently
+     * since OpenRTM-aist's module load function does not manage
+     * object reference count which is created from the loaded shared
+     * object, unloading might cause segmentation fault. However, most
+     * of unload function implementation actually does not unload
+     * shared object from memory space, and it is not recommended to
+     * call this operation in actual use.
      *
      * @param pathname A path to a loading module.
      * @return The return code.
@@ -96,19 +177,114 @@
 
     /*!
      * @if jp
-     * @brief ¥í¡¼¥É²Äǽ¤Ê¥â¥¸¥å¡¼¥ë¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+     * @brief ロード可能なモジュールのプロファイルを取得する
      *
-     * ¥í¡¼¥É²Äǽ¤Ê¥â¥¸¥å¡¼¥ë¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë¡£
+     * ロード可能なモジュールのプロファイルを取得する。ロード可能なRTコ
+     * ンポーネントのモジュールのプロファイルは、あらかじめ設定されたモ
+     * ジュールロードパスに対して、プロファイル取得コマンドを別プロセス
+     * で実行することで取得する。プロファイル取得対象となる言語の種類は、
      *
-     * @return ¥â¥¸¥å¡¼¥ë¥×¥í¥Õ¥¡¥¤¥ë
+     * - manager.supported_language: C++, Python, Java
      *
+     * で設定されている。ここで指定された言語に対して、以下のプロパティ
+     * で言語毎のモジュールロードパス、プロファイル取得コマンド、モジュー
+     * ル拡張子が指定される。
+     *
+     * - manager.modules.<言語>.load_paths: ./ (モジュールロードパス)
+     * - manager.modules.<言語>.profile_cmd: rtcprof等コマンド名
+     * - manager.modules.<言語>.suffixes: モジュール拡張子
+     *
+     * 例えば、C++ 言語の場合は、以下のプロパティがデフォルトで設定されている。
+     *
+     * - manager.modules.C++.load_paths: ./ (モジュールロードパス)
+     * - manager.modules.C++.profile_cmd: rtcprof
+     * - manager.modules.C++.suffixes: so (Linuxの場合), dll (Windowsの場合)
+     *
+     * マスターマネージャは、上記で設定されたすべての言語 (Windowsでは
+     * すべてのVCのバージョンも含む) のモジュールロードパスがあらかじめ
+     * 設定されている必要がある。 この作業は、このオペレーションが呼び
+     * 出されたマネージャ (通常はマスターマネージャ) 上でのみ実行され、
+     * 配下にあるスレーブマネージャ等に再帰的に呼び出されることはない。
+     *
+     * @return モジュールプロファイル。なお、モジュールプロファイルは以
+     *         下のような内容を持つKey-Value形式のリストで返される。
+     * <pre>
+     * implementation_id: ConfigSample
+     * type_name: ConfigSample
+     * description: Configuration example component
+     * version: 1.0
+     * vendor: Noriaki Ando, AIST
+     * category: example
+     * activity_type: DataFlowComponent
+     * max_instance: 10
+     * language: C++
+     * lang_type: compile
+     * conf.default.int_param0: 0
+     * conf.default.int_param1: 1
+     * conf.default.double_param0: 0.11
+     * conf.default.double_param1: 9.9
+     * conf.default.str_param0: hoge
+     * conf.default.str_param1: dara
+     * conf.default.vector_param0: 0.0,1.0,2.0,3.0,4.0
+     * </pre>
+     *
      * @else
      * @brief Getting loadable module profiles
      *
-     * This operation returns loadable module profiles.
+     * This operation returns loadable module profiles.  Loadable
+     * profiles of RT-Components can be obtained by executing profile
+     * obtain commands (ex. rtcprof) into the module load paths that
+     * is specified in the properties. The target kinds of language to
+     * be obtained component profiles are specified the following
+     * property.
      *
-     * @return A module profile list.
+     * - manager.supported_language: C++, Python, Java
      *
+     * For each those languages, module load paths, profile obtain
+     * command and module suffixes are specified in following
+     * properties.
+     *
+     * - manager.modules.<lang>.load_paths: ./ (load paths)
+     * - manager.modules.<lang>.profile_cmd: rtcprof command name
+     * - manager.modules.<lang>.suffixes: module extentions
+     *
+     * For example, the following properties are specified in default
+     * for C++ language.
+     *
+     * - manager.modules.C++.load_paths: ./ (module load pathds)
+     * - manager.modules.C++.profile_cmd: rtcprof
+     * - manager.modules.C++.suffixes: so (for Linux), dll (for Windows)
+     *
+     * The master manager need to be configured module load paths for
+     * all languages (and for all versions of VC in case of Windows)
+     * specified above. This process is performed in only a manager
+     * (master manager in general) in which this operation is called,
+     * and it is not recursively called to slave managers which are
+     * managed by this manager.
+     *
+     * @return A module profile list. The module profiles list
+     *         includes zero or more the following Key-Value format
+     *         RTC profile.
+     * <pre>
+     * implementation_id: ConfigSample
+     * type_name: ConfigSample
+     * description: Configuration example component
+     * version: 1.0
+     * vendor: Noriaki Ando, AIST
+     * category: example
+     * activity_type: DataFlowComponent
+     * max_instance: 10
+     * language: C++
+     * lang_type: compile
+     * conf.default.int_param0: 0
+     * conf.default.int_param1: 1
+     * conf.default.double_param0: 0.11
+     * conf.default.double_param1: 9.9
+     * conf.default.str_param0: hoge
+     * conf.default.str_param1: dara
+     * conf.default.vector_param0: 0.0,1.0,2.0,3.0,4.0
+     * </pre>
+     *
      * @endig
      */
     ModuleProfileList get_loadable_modules();
@@ -115,11 +291,14 @@
 
     /*!
      * @if jp
-     * @brief ¥í¡¼¥ÉºÑ¤ß¤Î¥â¥¸¥å¡¼¥ë¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+     * @brief ロード済みのモジュールのプロファイルを取得する
      *
-     * ¥í¡¼¥ÉºÑ¤ß¤Î¥â¥¸¥å¡¼¥ë¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë¡£
+     * ロード済みのモジュールのプロファイルを取得する。このオペレーショ
+     * ンでは、スレーブマネージャに対しても同じオペレーションが再帰的に
+     * 呼び出され、配下にあるすべてのマネージャがロードしているすべての
+     * モジュールのプロファイルを返す。
      *
-     * @return ¥â¥¸¥å¡¼¥ë¥×¥í¥Õ¥¡¥¤¥ë
+     * @return モジュールプロファイル
      *
      * @else
      * @brief Getting loaded module profiles
@@ -132,15 +311,18 @@
      */
     ModuleProfileList get_loaded_modules();
     
-    // component ´ØÏ¢
+    // component 関連
     /*!
      * @if jp
-     * @brief ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥Õ¥¡¥¯¥È¥ê¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+     * @brief コンポーネントファクトリのプロファイルを取得する
      *
-     * ¥í¡¼¥ÉºÑ¤ß¤Î¥â¥¸¥å¡¼¥ë¤Î¤¦¤Á¡¢RT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥â¥¸¥å¡¼¥ë¤¬»ý¤Ä
-     * ¥Õ¥¡¥¯¥È¥ê¤Î¥×¥í¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+     * ロード済みのモジュールのうち、RTコンポーネントのモジュールが持つ
+     * ファクトリのプロファイルのリストを取得する。このオペレーションで
+     * は、スレーブマネージャに対しても同じオペレーションが再帰的に呼び
+     * 出され、配下にあるすべてのマネージャが保有するRTコンポーネントの
+     * プロファイルを返す。
      *
-     * @return ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥Õ¥¡¥¯¥È¥ê¤Î¥×¥í¥Õ¥¡¥¤¥ë¥ê¥¹¥È
+     * @return コンポーネントファクトリのプロファイルリスト
      *
      * @else
      * @brief Getting component factory profiles
@@ -156,12 +338,79 @@
 
     /*!
      * @if jp
-     * @brief ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÀ¸À®¤¹¤ë
+     * @brief コンポーネントを生成する
      *
-     * °ú¿ô¤Ë»ØÄꤵ¤ì¤¿¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÀ¸À®¤¹¤ë¡£
+     * 引数に指定されたコンポーネントを生成する。マスターマネージャに対
+     * してこのオペレーションが呼び出された場合には、スレーブマネージャ
+     * に対してコンポーネントの生成を依頼する。依頼対象となるスレーブマ
+     * ネージャは、create_component() の引数内パラメータ manager_name
+     * により指定されたマネージャが配下にある場合は、そのマネージャに対
+     * して、create_component() を呼び出すことで生成、manager_name で指
+     * 定されたマネージャがない場合は、新規にスレーブマネージャを起動し
+     * てからコンポーネントを生成する。
      *
-     * @return À¸À®¤µ¤ì¤¿RT¥³¥ó¥Ý¡¼¥Í¥ó¥È
+     * - manager_nameで指定されたスレーブが存在する場合
+     * <pre>
+     *                             (maanger_name = servo)
+     * [ app ]          [ master ]        [ slave ]         [ RTC ]
+     *    |  create_comp()  |                 |                .
+     *    |---------------->|                 |                .
+     *    | manager_name =  |--, search       |                .
+     *    |           servo |  | slaves       |                .
+     *    |                 |<-'              |                .
+     *    |                 |  create_comp()  |                .
+     *    |                 |---------------->|                .
+     *    |                 |                 |--,             .
+     *    |                 |                 |  |createComp() .
+     *    |                 |                 |<-'             .
+     *    |                 |                 |.....create...> .
+     *    |                 |                 |                |
+     *    |                 |                 |                |
+     * </pre>
      *
+     * - manager_nameで指定されたスレーブが存在しない場合
+     * <pre>
+     * [ app ]          [ master ]        [ slave ]         [ RTC ]
+     *    |  create_comp()  |                 .                .
+     *    |---------------->|                 .                .
+     *    | manager_name =  |--, search       .                .
+     *    |      controller |  | slaves       .                .
+     *    |                 |<-'              .                .
+     *    |                 |  launch proc    .                .
+     *    |                 |---------------->|                .
+     *    |                 |  create_comp()  |                .
+     *    |                 |---------------->|                .
+     *    |                 |                 |--,             .
+     *    |                 |                 |  |createComp() .
+     *    |                 |                 |<-'             .
+     *    |                 |                 |.....create...> .
+     *    |                 |                 |                |
+     *    |                 |                 |                |
+     * </pre>
+     *
+     * 指定パラメータ
+     * - manager_name: コンポーネントを起動するスレーブマネージャ名
+     *   - 名前指定: <manager_name>
+     *   - アドレス指定: <hostname>:<port>
+     * - language: 起動対象のコンポーネントの実装言語
+     *
+     * @param module_name 生成対象RTコンポーネントIDおよびコンフィギュ
+     *                    レーション引数。フォーマットは大きく分けて
+     *                    "id" と "configuration" 部分が存在する。
+     *
+     * comp_args:     [id]?[configuration]
+     *                id は必須、configurationはオプション
+     * id:            RTC:[vendor]:[category]:[implementation_id]:[version]
+     *                RTC は固定かつ必須
+     *                vendor, category, version はオプション
+     *                implementation_id は必須
+     *                オプションを省略する場合でも ":" は省略不可
+     * configuration: [key0]=[value0]&[key1]=[value1]&[key2]=[value2].....
+     *                RTCが持つPropertiesの値をすべて上書きすることができる。
+     *                key=value の形式で記述し、"&" で区切る
+     *
+     * @return 生成されたRTコンポーネント
+     *
      * @else
      * @brief Creating an RT-Component
      *
@@ -176,11 +425,15 @@
 
     /*!
      * @if jp
-     * @brief ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºï½ü¤¹¤ë
+     * @brief コンポーネントを削除する
      *
-     * °ú¿ô¤Ë»ØÄꤵ¤ì¤¿¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºï½ü¤¹¤ë¡£
+     * 引数に指定されたコンポーネントを削除する。マスターマネージャに対
+     * してこのオペレーションが呼び出された場合、配下のスレーブコンポー
+     * ネント上の当該コンポーネントを削除する。ただし、通常は対象コンポー
+     * ネントに対して exit() オペレーションを呼び出すことで RTC を終了
+     * させる方法を推奨する。
      *
-     * @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+     * @return リターンコード
      *
      * @else
      * @brief Deleting an RT-Component
@@ -196,11 +449,15 @@
 
     /*!
      * @if jp
-     * @brief µ¯Æ°Ãæ¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë
+     * @brief 起動中のコンポーネントのリストを取得する
      *
-     * ¸½ºßÅö³º¥Þ¥Í¡¼¥¸¥ã¾å¤Çµ¯Æ°Ãæ¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+     * 現在当該マネージャ上で起動中のコンポーネントのリストを返す。マス
+     * ターマネージャに対してこのオペレーションが呼び出された場合、配下
+     * のスレーブコンポーネント上で実行中のRTCのリストを収集して返す。
+     * スレーブマネージャに対して呼び出された場合には、自身が管理する起
+     * 動中のRTCのリストのみを返す。
      *
-     * @return RT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥ê¥¹¥È
+     * @return RTコンポーネントのリスト
      *
      * @else
      * @brief Getting RT-Component list running on this manager
@@ -215,12 +472,16 @@
 
     /*!
      * @if jp
-     * @brief µ¯Æ°Ãæ¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë
+     * @brief 起動中のコンポーネントプロファイルのリストを取得する
      *
-     * ¸½ºßÅö³º¥Þ¥Í¡¼¥¸¥ã¾å¤Çµ¯Æ°Ãæ¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¤Î¥ê¥¹
-     * ¥È¤òÊÖ¤¹¡£
+     * 現在当該マネージャ上で起動中のコンポーネントのプロファイルのリス
+     * トを返す。マスターマネージャに対してこのオペレーションが呼び出さ
+     * れた場合、配下のスレーブコンポーネント上で実行中のRTCのプロファ
+     * イルリストを収集して返す。スレーブマネージャに対して呼び出された
+     * 場合には、自身が管理する起動中のRTCのプロファイルリストのみを返
+     * す。
      *
-     * @return RT¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È
+     * @return RTコンポーネントプロファイルのリスト
      *
      * @else
      * @brief Getting RT-Component's profile list running on this manager
@@ -234,16 +495,37 @@
      */
     RTC::ComponentProfileList get_component_profiles();
 
-    // manager ´ðËÜ
     /*!
      * @if jp
-     * @brief ¥Þ¥Í¡¼¥¸¥ã¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+     * @brief 指定名のRTCオブジェクトリファレンスを取得
      *
-     * ¸½ºßÅö³º¥Þ¥Í¡¼¥¸¥ã¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë¡£
+     * 
      *
-     * @return ¥Þ¥Í¡¼¥¸¥ã¥×¥í¥Õ¥¡¥¤¥ë
+     * @param name RTC名
+     * @return RTCリスト
      *
      * @else
+     * @brief 
+     *
+     *
+     * 
+     * @param name name
+     * @return list of RTC
+     *
+     * @endig
+     */
+    RTC::RTCList get_components_by_name(in string name);
+
+    // manager 基本
+    /*!
+     * @if jp
+     * @brief マネージャのプロファイルを取得する
+     *
+     * 現在当該マネージャのプロファイルを取得する。
+     *
+     * @return マネージャプロファイル
+     *
+     * @else
      * @brief Getting this manager's profile.
      *
      * This operation returns this manager's profile.
@@ -256,11 +538,11 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥Í¡¼¥¸¥ã¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ò¼èÆÀ¤¹¤ë
+     * @brief マネージャのコンフィギュレーションを取得する
      *
-     * ¸½ºßÅö³º¥Þ¥Í¡¼¥¸¥ã¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ò¼èÆÀ¤¹¤ë¡£
+     * 現在当該マネージャのコンフィギュレーションを取得する。
      *
-     * @return ¥Þ¥Í¡¼¥¸¥ã¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó
+     * @return マネージャコンフィギュレーション
      *
      * @else
      * @brief Getting this manager's configuration.
@@ -275,13 +557,13 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥Í¡¼¥¸¥ã¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤òÀßÄꤹ¤ë
+     * @brief マネージャのコンフィギュレーションを設定する
      *
-     * ¸½ºßÅö³º¥Þ¥Í¡¼¥¸¥ã¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤òÀßÄꤹ¤ë¡£
+     * 現在当該マネージャのコンフィギュレーションを設定する。
      *
-     * @param name ¥»¥Ã¥È¤¹¤ë¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤Î¥­¡¼Ì¾
-     * @param value ¥»¥Ã¥È¤¹¤ë¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ÎÃÍ
-     * @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+     * @param name セットするコンフィギュレーションのキー名
+     * @param value セットするコンフィギュレーションの値
+     * @return リターンコード
      *
      * @else
      * @brief Setting manager's configuration
@@ -298,12 +580,12 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥Í¡¼¥¸¥ã¤¬¥Þ¥¹¥¿¡¼¤«¤É¤¦¤«
+     * @brief マネージャがマスターかどうか
      *
-     * ¤³¤Î´Ø¿ô¤Ï¥Þ¥Í¡¼¥¸¥ã¤¬¥Þ¥¹¥¿¡¼¤«¤É¤¦¤«¤òÊÖ¤¹¡£True¤Ê¤é¤Ð¡¢Åö³º¥Þ
-     * ¥Í¡¼¥¸¥ã¤Ï¥Þ¥¹¥¿¡¼¤Ç¤¢¤ê¡¢¤½¤ì°Ê³°¤Ï False ¤òÊÖ¤¹¡£
+     * この関数はマネージャがマスターかどうかを返す。Trueならば、当該マ
+     * ネージャはマスターであり、それ以外は False を返す。
      *
-     * @return ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤«¤É¤¦¤«¤ÎboolÃÍ
+     * @return マスターマネージャかどうかのbool値
      *
      * @else
      * @brief Whether this manager is master or not
@@ -319,13 +601,16 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤Î¼èÆÀ
+     * @brief マスターマネージャの取得
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤Î¾ì¹ç¡¢¥Þ¥¹¥¿¡¼¤È¤Ê¤Ã¤Æ¤¤¤ë¥Þ
-     * ¥Í¡¼¥¸¥ã¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬¥Þ¥¹¥¿¡¼¤Î¾ì¹ç¡¢¶õ¤Î¥ê¥¹
-     * ¥È¤¬Ê֤롣
+     * このマネージャがスレーブマネージャの場合、マスターとなっているマ
+     * ネージャのリストを返す。このマネージャがマスターの場合、空のリス
+     * トが返る。原則としてスレーブマネージャは1つのマスターマネージャ
+     * の配下となるが、実装上はマスターマネージャは唯一となるような制約
+     * はなく、add_master_manager() オペレーションにより複数のマスター
+     * マネージャを登録することが可能である。
      *
-     * @return ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤Î¥ê¥¹¥È
+     * @return マスターマネージャのリスト
      *
      * @else
      * @brief Getting master managers
@@ -342,11 +627,51 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤ÎÄɲÃ
+     * @brief マスターマネージャの追加
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤Î¥Þ¥¹¥¿¤È¤·¤Æ¥Þ¥Í¡¼¥¸¥ã¤ò°ì¤ÄÄɲ乤롣
+     * このマネージャのマスタとしてマネージャを一つ追加する。
      *
-     * @param mgr ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã
+     * マスターマネージャとスレーブマネージャの関係は、以下の図のように、
+     * 一つのノード (node: 1つの独立したコンピュータでありホスト) に対
+     * して、1つのマスター (master) マネージャが対応する。1つのマスター
+     * マネージャの下には0個以上のスレーブ (slave) マネージャが存在し、
+     * RTCは1つのスレーブマネージャに属する。なお、スレーブマネージャは
+     * 通常、1つ以上のRTCをホストする。デフォルトの設定では、RTCをホス
+     * トしていないスレーブマネージャは自動終了する。
+     *
+     * <pre>
+     *          1      1            1    0..*          1    1..*
+     * [ node ]<>--------[ master ]<>--------[ slave ]<>--------[ RTC ]
+     *
+     * </pre>
+     *
+     * マスターとスレーブの関係は、add/remove_master_manager(),
+     * add_remove_slave_manager() オペレーションによって構成される。こ
+     * れらのオペレーションは原則として、すべてスレーブマネージャからア
+     * クションを開始する。マスターマネージャは原則として、
+     * corbaloc://localhost:2810/manager によりオブジェクト参照を取得で
+     * きる一方、スレーブマネージャの参照を知る一般的方法はない。スレー
+     * ブマネージャは、起動時にローカルのマスターマネージャを探して、内
+     * 部的にこのオペレーションを呼び出し、マスターマネージャを追加する
+     * とともに、マスターマネージャに対して、add_slabe_manager() を呼び
+     * 出して、マスターマネージャに対して、スレーブマネージャが配下に入っ
+     * たことを知らせる。
+     *
+     * <pre>
+     *       [ master ]                  [ slave ]
+     *           |                           |
+     *           |                           |--, find master
+     *           |                           |  | by corbaloc:
+     *           |                           |<-'
+     *           |                           |
+     *           |                           |--,
+     *           |                           |  | add_master_manager()
+     *           | add_slave_manager(own_ref)|<-'
+     *           |<--------------------------|
+     *           |                           |
+     * </pre>
+     *
+     * @param mgr マスターマネージャ
      * @return ReturnCode_t
      *
      * @else
@@ -363,11 +688,29 @@
 
     /*!
      * @if jp
-     * @brief ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤Îºï½ü
+     * @brief マスターマネージャの削除
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬ÊÝ»ý¤¹¤ë¥Þ¥¹¥¿¤Î¤¦¤Á¡¢»ØÄꤵ¤ì¤¿¤â¤Î¤òºï½ü¤¹¤ë¡£
+     * このマネージャが保持するマスタのうち、指定されたものを削除する。
+     * 通常このオペレーションは、スレーブマネージャが終了する際に、自身
+     * に対して呼び出される。また、スレーブマネージャ自身がマスターマネー
+     * ジャの配下から外れることを remove_slave_manager() により、マスター
+     * マネージャに対して通知する。
      *
-     * @param mgr ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã
+     * <pre>
+     * [ master ]                      [ slave ]
+     *     |                               |
+     *     |                               |--, shutdown
+     *     |                               |  | slave manager
+     *     |                               |<-'
+     *     |                               |
+     *     |                               |--,
+     *     |                               |  | remove_master_manager()
+     *     | remove_slave_manager(own_ref) |<-'
+     *     |<------------------------------|
+     *     |                               |
+     * </pre>
+     *
+     * @param mgr マスターマネージャ
      * @return ReturnCode_t
      *
      * @else
@@ -384,13 +727,13 @@
 
     /*!
      * @if jp
-     * @brief ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤Î¼èÆÀ
+     * @brief スレーブマネージャの取得
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤Î¾ì¹ç¡¢¥¹¥ì¡¼¥Ö¤È¤Ê¤Ã¤Æ¤¤¤ë¥Þ
-     * ¥Í¡¼¥¸¥ã¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬¥¹¥ì¡¼¥Ö¤Î¾ì¹ç¡¢¶õ¤Î¥ê¥¹
-     * ¥È¤¬Ê֤롣
+     * このマネージャがスレーブマネージャの場合、スレーブとなっているマ
+     * ネージャのリストを返す。このマネージャがスレーブの場合、空のリス
+     * トが返る。
      *
-     * @return ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤Î¥ê¥¹¥È
+     * @return スレーブマネージャのリスト
      *
      * @else
      * @brief Getting slave managers
@@ -404,13 +747,33 @@
      * @endig
      */
     ManagerList get_slave_managers();
+
     /*!
      * @if jp
-     * @brief ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤ÎÄɲÃ
+     * @brief スレーブマネージャの追加
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤Î¥Þ¥¹¥¿¤È¤·¤Æ¥Þ¥Í¡¼¥¸¥ã¤ò°ì¤ÄÄɲ乤롣
+     * このマネージャのマスタとしてマネージャを一つ追加する。通常、スレー
+     * ブマネージャは、起動時にローカルのマスターマネージャを探して、内
+     * 部的に、add_master_manager() を呼び出し、マスターマネージャを追
+     * 加するとともに、マスターマネージャに対して、この
+     * add_slave_manager() を呼び出して、マスターマネージャに対して、ス
+     * レーブマネージャが配下に入ったことを知らせる。
      *
-     * @param mgr ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã
+     * <pre>
+     *       [ master ]                  [ slave ]
+     *           |                           |
+     *           |                           |--, find master
+     *           |                           |  | by corbaloc:
+     *           |                           |<-'
+     *           |                           |
+     *           |                           |--,
+     *           |                           |  | add_master_manager()
+     *           | add_slave_manager(own_ref)|<-'
+     *           |<--------------------------|
+     *           |                           |
+     * </pre>
+     *
+     * @param mgr スレーブマネージャ
      * @return ReturnCode_t
      *
      * @else
@@ -417,7 +780,7 @@
      * @brief Getting a slave manager
      *
      * This operation add a slave manager to this manager.
-     *  
+     * 
      * @param mgr A slave manager
      * @return ReturnCode_t
      *
@@ -427,11 +790,30 @@
 
     /*!
      * @if jp
-     * @brief ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã¤Îºï½ü
+     * @brief スレーブマネージャの削除
      *
-     * ¤³¤Î¥Þ¥Í¡¼¥¸¥ã¤¬ÊÝ»ý¤¹¤ë¥Þ¥¹¥¿¤Î¤¦¤Á¡¢»ØÄꤵ¤ì¤¿¤â¤Î¤òºï½ü¤¹¤ë¡£
+     * このマネージャが保持するマスタのうち、指定されたものを削除する。
+     * 通常このオペレーションは、スレーブマネージャが終了する際に、自身
+     * に対して remove_master_manager() を呼び出した後、スレーブマネー
+     * ジャ自身がマスターマネージャの配下から外れることを知らせるための、
+     * この remove_slave_manager() をマスターマネージャに対して呼ぶこと
+     * で通知する。
      *
-     * @param mgr ¥¹¥ì¡¼¥Ö¥Þ¥Í¡¼¥¸¥ã
+     * <pre>
+     * [ master ]                      [ slave ]
+     *     |                               |
+     *     |                               |--, shutdown
+     *     |                               |  | slave manager
+     *     |                               |<-'
+     *     |                               |
+     *     |                               |--,
+     *     |                               |  | remove_master_manager()
+     *     | remove_slave_manager(own_ref) |<-'
+     *     |<------------------------------|
+     *     |                               |
+     * </pre>
+     *
+     * @param mgr スレーブマネージャ
      * @return ReturnCode_t
      *
      * @else
@@ -438,44 +820,78 @@
      * @brief Removing a slave manager
      *
      * This operation removes a slave manager from this manager.
-     * 
+     *
      * @param mgr A slave manager
-     * @return ReturnCode_t 
+     * @return ReturnCode_t
      *
      * @endig
      */
     RTC::ReturnCode_t remove_slave_manager(in Manager mgr);
 
+    // プロセス操作関係
+    /*!
+     * @if jp
+     * @brief マネージャプロセスをforkする
+     *
+     * @return Return Code
+     *
+     * @else
+     * @brief fork the manager process
+     *
+     * @return Return Code
+     *
+     * @endig
+     */
     RTC::ReturnCode_t fork();
+
+    /*!
+     * @if jp
+     * @brief マネージャプロセスをshutdownする
+     *
+     * @return Return Code
+     *
+     * @else
+     * @brief shutdown the manager process
+     *
+     * @return Return Code
+     *
+     * @endig
+     */
     RTC::ReturnCode_t shutdown();
+
+    /*!
+     * @if jp
+     * @brief マネージャプロセスを再起動する
+     *
+     * @return Return Code
+     *
+     * @else
+     * @brief restart maanger process
+     *
+     * @return Return Code
+     *
+     * @endig
+     */
     RTC::ReturnCode_t restart();
 
-
-     /*!
+    /*!
      * @if jp
-     * @brief »ØÄê̾¤ÎRTC¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹¤ò¼èÆÀ
+     * @brief サービスのオブジェクト参照を取得する
      *
-     * 
+     * 仕様未確定
      *
-     * @param name RTC̾
-     * @return RTC¥ê¥¹¥È
+     * @return Return Code
      *
      * @else
-     * @brief 
+     * @brief obtaining the object reference of a service
      *
+     * @return Return Code
      *
-     * 
-     * @param name name
-     * @return list of RTC
-     *
      * @endig
      */
-    RTC::RTCList get_components_by_name(in string name);
-
     Object get_service(in string name);
     //    ServiceProfileList get_service_profiles();
   };
-  
 }; // end of namespace RTM
 
 #endif // __MANAGER_IDL__

Copied: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CompParam.java (from rev 1055, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CompParam.java)
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CompParam.java	                        (rev 0)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CompParam.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -0,0 +1,119 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Arrays;
+
+
+/**
+ * {@.ja CompParam クラス}
+ * {@.en CompParam class}
+ * <p>
+ * {@.ja RTCのベンダ名、カテゴリ名、ID、言語、バージョンを格納するクラス。}
+ * {@.en This class stores a vendor name of RTC, a category name, 
+ * ID, a language and the version.}
+ *
+ */
+public class CompParam {
+
+    public static final List<String> prof_list = 
+            Collections.unmodifiableList(Arrays.asList(
+                "RTC",
+                "vendor",
+                "category",
+                "implementation_id",
+                "language",
+                "version"
+            ));
+
+    /**
+     * {@.ja コンストラクタ}
+     * {@.en Constructor}
+     * @param module_name
+     *   {@.ja モジュール名}
+     *   {@.en Module Name}
+     *
+     */
+    public CompParam(String module_name){
+        String modulename = module_name.split("\\?")[0];
+        String[] param_list = modulename.split(":",-1);
+        if(param_list.length < prof_list.size()){
+            m_type = "RTC";
+            m_vendor = "";
+            m_category = "";
+            m_impl_id = modulename;
+            m_language = "Java";
+            m_version = "";
+        }
+        else{
+            m_type = param_list[0];
+            m_vendor = param_list[1];
+            m_category = param_list[2];
+            m_impl_id = param_list[3];
+            if(!param_list[4].isEmpty()){
+                m_language = param_list[4];
+            }
+            else{
+                m_language = "Java";
+            }
+            m_version = param_list[5];
+        }
+    }
+    /**
+     * {@.ja ベンダ名取得}
+     * {@.en Gets the vendor name.}
+     * @return 
+     *   {@.ja ベンダ名}
+     *   {@.en Vendor Name}
+     */
+    public String vendor(){
+        return m_vendor;
+    }
+    /**
+     * {@.ja カテゴリ名取得}
+     * {@.en Gets the category name.}
+     * @return 
+     *   {@.ja カテゴリ名取}
+     *   {@.en Category Name}
+     */
+    public String category(){
+        return m_category;
+    }
+    /**
+     * {@.ja ID取得}
+     * {@.en Gets the ID.}
+     * @return 
+     *   {@.ja ID}
+     *   {@.en ID}
+     */
+    public String impl_id(){
+        return m_impl_id;
+    }
+    /**
+     * {@.ja 言語取得}
+     * {@.en Gets the language.}
+     * @return 
+     *   {@.ja 言語}
+     *   {@.en language}
+     */
+    public String language(){
+        return m_language;
+    }
+    /**
+     * {@.ja バージョン取得}
+     * {@.en Gets the version.}
+     * @return 
+     *   {@.ja バージョン}
+     *   {@.en version}
+     */
+    public String version(){
+        return m_version;
+    }
+  
+    private String m_type;
+    private String m_vendor;
+    private String m_category;
+    private String m_impl_id;
+    private String m_language;
+    private String m_version;
+}

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -597,13 +597,8 @@
                         Object obj, final boolean force)
         throws SystemException, NotFound, CannotProceed, InvalidName {
 
-
         try {
-            if( isNamingContext(obj) ) {
-                m_rootContext.rebind(name, NamingContextExtHelper.narrow(obj));
-            } else {
-                m_rootContext.rebind(name, obj);
-            }
+            m_rootContext.rebind(name, obj);
         } catch(NotFound ex) {
             if( force ) {
                 rebindRecursive(m_rootContext, name, obj);
@@ -1877,6 +1872,24 @@
                 name[intIdx].kind = "";
             }
         }
+/*
+        NameComponent[] nametest = m_rootContext.to_name(sname);
+        if(name.length!=nametest.length){
+            System.out.println("\u001b[00;32m"+"CorbaNaming:toName():");
+            System.out.println("length:"+name.length+","+nametest.length);
+        }
+        else{
+            for(int ic=0;ic<name.length;++ic){
+                if(!name[ic].id.equals(nametest[ic].id) 
+                || !name[ic].kind.equals(nametest[ic].kind)){ 
+                    System.out.println("\u001b[00;32m"+"CorbaNaming:toName():");
+                    System.out.println(ic+":"+name[ic].id+","+name[ic].kind);
+                    System.out.println(
+                            ic+":"+nametest[ic].id+","+nametest[ic].kind);
+                }
+            }
+        }
+*/
         return name;
     }
 

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -48,6 +48,8 @@
         "corba.nameservers",      "localhost",
         "corba.master_manager",   "localhost:2810",
         "corba.nameservice.replace_endpoint", "NO",
+        "corba.update_master_manager.enable", "YES",
+        "corba.update_master_manager.interval", "10.0",
         "exec_cxt.periodic.type", "jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
         "exec_cxt.periodic.rate", "1000",
         "exec_cxt.sync_transition",              "YES",
@@ -63,6 +65,7 @@
         "manager.name",                     "manager",
         "manager.command",                  "rtcd",
         "manager.nameservers",              "default",
+        "manager.language",                 "Java",
         "manager.components.naming_policy", "process_unique",
         "manager.modules.C++.manager_cmd", "rtcd",
         "manager.modules.Python.manager_cmd", "rtcd_python",
@@ -70,9 +73,16 @@
         "sdo.service.provider.enabled_services",  "ALL",
         "sdo.service.consumer.enabled_services",  "ALL",
         "manager.local_service.enabled_services","ALL",
-        "manager.modules.C++.load_paths",  "./",
+        "manager.modules.C++.load_paths",     "./",
         "manager.modules.Python.load_paths",  "./",
-        "manager.modules.Java.load_paths",  "./",
+        "manager.modules.Java.load_paths",    "./",
+        "manager.supported_languages",        "C++, Python, Java",
+        "manager.modules.C++.suffixes",       "",
+        "manager.modules.Python.suffixes",    "py",
+        "manager.modules.Java.suffixes",      "class",
+        "manager.modules.C++.profile_cmd",    "rtcprof",
+        "manager.modules.Python.profile_cmd", "rtcprof_python",
+        "manager.modules.Java.profile_cmd",   "rtcprof_java",
         ""
     };
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -1083,7 +1083,9 @@
      * "Manager.components.precreate".}
      */
     private void precreateComponent() {
-        rtcout.println(Logbuf.TRACE, "Components pre-creation: " + m_config.getProperty("manager.components.precreate").split(","));
+        rtcout.println(Logbuf.TRACE, 
+           "Components pre-creation: " 
+           + m_config.getProperty("manager.components.precreate").split(","));
         String[] comp 
             = m_config.getProperty("manager.components.precreate").split(",");
         for (int i=0; i < comp.length; ++i) {
@@ -1672,9 +1674,9 @@
      *         部分が存在する。
      * comp_args:     [id]?[configuration] <br>
      *                id は必須、configurationはオプション<ul>
-     * <li>id:            RTC:[vendor]:[category]:[implementation_id]:[version]
+     * <li>id: RTC:[vendor]:[category]:[implementation_id]:[language]:[version]
      *                RTC は固定かつ必須
-     *                vendor, category, version はオプション
+     *                vendor, category,language,version はオプション
      *                implementation_id は必須
      *                オプションを省略する場合でも ":" は省略不可</li>
      * <li>configuration: [key0]=[value0]&[key1]=[value1]&[key2]=[value2].....
@@ -1683,13 +1685,13 @@
      * </ul>
      *
      * 例えば、<br>
-     * RTC:jp.go.aist:example:ConfigSample:1.0?conf.default.str_param0=munya
+     * RTC:jp.go.aist:example:ConfigSample::1.0?conf.default.str_param0=munya
      * RTC::example:ConfigSample:?conf.default.int_param0=100}
      *
      *   {@.en Target RT-Component names for the creation.<br>
      *   comp_args:     [id]?[configuration] <br>
      *   for examples,<br> 
-     * RTC:jp.go.aist:example:ConfigSample:1.0?conf.default.str_param0=munya
+     * RTC:jp.go.aist:example:ConfigSample::1.0?conf.default.str_param0=munya
      * RTC::example:ConfigSample:?conf.default.int_param0=100}
      * @return
      *   {@.ja 生成したRTコンポーネントのインスタンス}
@@ -1696,7 +1698,6 @@
      *   {@.en Created RT-Component's instances}
      */
     public RTObject_impl createComponent(final String comp_args) {
-        
         rtcout.println(Logbuf.TRACE, 
                             "Manager.createComponent(" + comp_args + ")");
         
@@ -1703,7 +1704,6 @@
         if( comp_args == null || comp_args.equals("") ) {
             return null;
         }
-        m_listeners.rtclifecycle_.preCreate(comp_args);
 
         //------------------------------------------------------------
         // extract "comp_type" and "comp_prop" from comp_arg
@@ -1713,6 +1713,22 @@
             return null;
         }
 
+        rtcout.println(Logbuf.PARANOID, 
+                "comp_prop.getProperty(\"instance_name\"):" 
+                + comp_prop.getProperty("instance_name"));
+        if(!comp_prop.getProperty("instance_name").equals("")){
+            RTObject_impl comp = 
+                    getComponent(comp_prop.getProperty("instance_name"));
+            if(comp!=null){
+                rtcout.println(Logbuf.PARANOID, 
+                    "A RTC with the instance name ("
+                    + comp_prop.getProperty("instance_name")
+                    +") has started already.");
+                return comp;
+            }
+        }
+        m_listeners.rtclifecycle_.preCreate(comp_args);
+
         //------------------------------------------------------------
         // Because the format of port-name had been changed from <port_name> 
         // to <instance_name>.<port_name>, the following processing was added. 
@@ -2096,33 +2112,38 @@
                 "Invalid arguments. Two or more '?' in arg : " + comp_arg);
             return false;
         }
+        /*
+        final String[] prof = {
+          "RTC",
+          "vendor",
+          "category",
+          "implementation_id",
+          "language",
+          "version"
+        };
+        */
+        String[] prof = (String[])CompParam.prof_list.toArray(new String[0]);
+        int param_num = prof.length;
+
         if (id_and_conf[0].indexOf(":") == -1) {
-            id_and_conf[0] = "RTC:::".concat(id_and_conf[0]);
-            id_and_conf[0] = id_and_conf[0].concat(":");
+            id_and_conf[0] = prof[0] + ":::" + id_and_conf[0];
+            id_and_conf[0] = id_and_conf[0].concat("::");
         }
         String[] id = id_and_conf[0].split(":",-1);
 
-        // id should be devided into 1 or 5 elements
-        // RTC:[vendor]:[category]:impl_id:[version] => 5
-        if (id.length != 5) {
+        // id should be devided into 1 or 6 elements
+        // RTC:[vendor]:[category]:impl_id:[language]:[version] => 6
+        if (id.length != param_num) {
             rtcout.println(Logbuf.ERROR, 
                     "Invalid RTC id format.: " + id_and_conf[0]);
             return false;
         }
 
-        final String[] prof = {
-          "RTC",
-          "vendor",
-          "category",
-          "implementation_id",
-          "version"
-        };
-
         if (id[0].trim().equals(prof[0]) == false) {
             rtcout.println(Logbuf.ERROR, "Invalid id type: " + id[0]);
             return false;
         }
-        for (int i = 1; i < 5; ++i) {
+        for (int i = 1; i < param_num; ++i) {
             comp_id.setProperty(prof[i], id[i].trim());
             rtcout.println(Logbuf.TRACE, 
                 "RTC basic propfile " + prof[i] + ":" + id[i].trim());
@@ -3832,10 +3853,70 @@
             return true;
         }
         m_mgrservant = new ManagerServant();
+        Properties prop = m_config.getNode("manager");
+        String[] names = prop.getProperty("naming_formats").split(",");
+    
+        if(StringUtil.toBool(prop.getProperty("is_master"), 
+                                                    "YES", "NO", true)) {
+            for(int ic=0;ic<names.length;++ic){
+                String mgr_name = formatString(names[ic], prop);
+                m_namingManager.bindObject(mgr_name, m_mgrservant);
+            }
+        }
+        if(StringUtil.toBool(
+                m_config.getProperty("corba.update_master_manager.enable"), 
+                "YES", "NO", true) && 
+           !StringUtil.toBool(
+                m_config.getProperty("manager.is_master"), "YES", "NO", false)
+        ) {
+            TimeValue tm = new TimeValue(10, 0);
+            if(m_config.findNode("corba.update_master_manager.interval")!=null){
+                String interval = m_config.getProperty(
+                                      "corba.update_master_manager.interval");
+                try{
+                    double duration = Double.parseDouble(interval);
+                    tm.convert(duration);
+                }
+                catch(Exception ex){
+                }
+            }
+            if(m_timer != null){
+                m_updateMasterManager 
+                            = new updateMasterManager(m_mgrservant);
+                m_timer.registerListenerObj(m_updateMasterManager,tm);
+            }
+        }
         return true;
     }
-    
     /**
+     * {@.ja タイマー処理用リスナー}
+     * {@.en Listener for timer processing}
+     */
+    updateMasterManager m_updateMasterManager;
+    /**
+     * {@.ja Manager の更新のためのリスナークラス}
+     * {@.en Listener Class for update of Manager}
+     */
+    class updateMasterManager implements CallbackFunction {
+        private ManagerServant m_mgrser;
+        /**
+         * {@.ja コンストラクタ}
+         * {@.en Constructor}
+         *
+         */
+        public updateMasterManager(ManagerServant mgrser) {
+            m_mgrser = mgrser;
+        }
+        /**
+         * {@.ja コールバックメソッド}
+         * {@.en Callback method}
+         */
+        public void doOperate() {
+            m_mgrser.update_master_manager();
+        }
+    }
+
+    /**
      * {@.ja ManagerServantをバインドする。}
      * {@.en Binds ManagerServant.}
      *
@@ -4608,6 +4689,11 @@
                 !str.equals(prop.getProperty("category"))) { 
                 return false; 
             }
+            str = m_prop.getProperty("language");
+            if (str!=null &&  !str.equals("") &&
+                !str.equals(prop.getProperty("language"))) {
+                return false; 
+            }
             str = m_prop.getProperty("version");
             if (str!=null &&  !str.equals("") &&
                 !str.equals(prop.getProperty("version"))) {

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -397,6 +397,7 @@
      * <li> os.arch    : OSアーキテクチャ
      * <li> os.hostname: ホスト名
      * <li> manager.pid        : プロセスID
+     * <li> manager.modules.C++.suffixes: ライブラリの拡張子
      * </ul>}
      * {@.en Get the following system info. and set them to Manager's 
      * properties.
@@ -407,6 +408,7 @@
      * <li> os.arch    : OS architecture
      * <li> os.hostname: Hostname
      * <li> manager.pid        : process ID
+     * <li> manager.modules.C++.suffixes: The suffix of library
      * </ul>}
      *
      * 
@@ -423,6 +425,7 @@
         String osArch = "UNKNOWN";
         String hostName = "UNKNOWN";
         String pid = "UNKNOWN";
+        String suffix = "UNKNOWN";
         
         try {
             java.util.Properties sysInfo = System.getProperties();
@@ -429,6 +432,15 @@
             
             // OS名
             osName = sysInfo.getProperty("os.name");
+            if(osName.toLowerCase().startsWith("windows")){
+                suffix = "dll";
+            }
+            else if(osName.toLowerCase().startsWith("linux")){
+                suffix = "so";
+            }
+            else{
+                suffix = "dylib";
+            }
             
             // OSバージョン
             osVersion = sysInfo.getProperty("os.version");
@@ -457,6 +469,7 @@
         properties.setProperty("os.arch", osArch);
         properties.setProperty("os.hostname", hostName);
         properties.setProperty("manager.pid", pid);
+        properties.setProperty("manager.modules.C++.suffixes", suffix);
 
     }
 

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -320,6 +320,7 @@
         rtcout.println(Logbuf.TRACE, "get_loadable_modules()");
         // copy local module profiles
         Vector<Properties> prof = m_mgr.getLoadableModules();
+        rtcout.println(Logbuf.PARANOID, "prof.size():"+prof.size());
         RTM.ModuleProfile[] cprof = new RTM.ModuleProfile[prof.size()];
         for (int i=0, len=prof.size(); i < len; ++i) {
             String dumpString = new String();
@@ -364,6 +365,7 @@
                 }
             }
         }
+        rtcout.println(Logbuf.PARANOID, "cprof.length:"+cprof.length);
         return cprof;
 
 /*
@@ -572,6 +574,9 @@
         get_parameter_by_modulename("manager_address",temp);
         String manager_name = new String();
         manager_name = get_parameter_by_modulename("manager_name",temp);
+
+        CompParam comp_param = new CompParam(temp[0]);
+
         rtcout.println(Logbuf.PARANOID, "m_isMaster:"+m_isMaster);
         if(m_isMaster){
             synchronized(m_slaveMutex) {
@@ -579,11 +584,20 @@
                                 "m_slaves.length:"+m_slaves.length);
                 for (int ic=0; ic < m_slaves.length; ++ic) {
                     try {
-                        rtc = m_slaves[ic].create_component(module_name);
-                        rtcout.println(Logbuf.PARANOID, 
+                        _SDOPackage.NameValue[] prof 
+                            = m_slaves[ic]. get_configuration();
+                        NVListHolder nvholder = new NVListHolder(prof);
+                        Properties prop = new Properties();
+                        NVUtil.copyToProperties(prop, nvholder);
+                        String slave_lang
+                            = prop.getProperty("manager.language");
+                        if(slave_lang.equals(comp_param.language())){
+                            rtc = m_slaves[ic].create_component(module_name);
+                            rtcout.println(Logbuf.PARANOID, 
                                 "m_slaves[ic].create_component():" +rtc);
-                        if(rtc != null){
-                            return rtc;
+                            if(rtc != null){
+                                return rtc;
+                            }
                         }
                     }
                     catch (org.omg.CORBA.SystemException ex) {
@@ -590,6 +604,11 @@
                         rtcout.println(Logbuf.ERROR, 
                                     "Unknown exception cought.");
                         rtcout.println(Logbuf.DEBUG, ex.toString());
+                        RTM.ManagerListHolder holder 
+                                    = new RTM.ManagerListHolder(m_slaves);
+                        CORBA_SeqUtil.erase(holder, ic); 
+                        --ic;
+                        m_slaves = holder.value;
                     }
                 }
             }
@@ -1355,6 +1374,10 @@
     public String get_parameter_by_modulename(String param_name, 
                     String[] module_name){
         
+        rtcout.println(Logbuf.PARANOID, 
+                        "get_parameter_by_modulename("
+                        +param_name
+                        +")");
         String arg = module_name[0];
         int pos = arg.indexOf("&"+param_name+"=");
         if(pos == -1){
@@ -1453,22 +1476,26 @@
                             +mgrobj);
         }
 
-        tmp[0] = arg;
-        String language = get_parameter_by_modulename("language",tmp);
-        arg = tmp[0];
+        CompParam comp_param = new CompParam(arg);
 
-        if(language==null){
-            language = "Java";
-        }
-        if(language.isEmpty()){
-            language = "Java";
-        }
-  
         if(mgrobj == null){
             rtcout.println(Logbuf.WARN, mgrstr +" cannot be found.");
             Properties config = m_mgr.getConfig();
             String rtcd_cmd = 
-                config.getProperty("manager.modules."+language+".manager_cmd");
+                config.getProperty("manager.modules."
+                                   +comp_param.language()
+                                   +".manager_cmd");
+            rtcout.println(Logbuf.PARANOID, 
+                                   "comp_param.language():"
+                                   +comp_param.language());
+            rtcout.println(Logbuf.PARANOID, 
+                                   "manager.modules."
+                                   +comp_param.language()
+                                   +".manager_cmd:"
+                                   +config.getProperty("manager.modules."
+                                                       +comp_param.language()
+                                                       +".manager_cmd"));
+
             if(rtcd_cmd.isEmpty()){
                 rtcd_cmd = "rtcd_java";
             }
@@ -1476,11 +1503,16 @@
             String load_path = config.getProperty("manager.modules.load_path");
             String load_path_language = config.getProperty(
                                          "manager.modules."
-                                         +language
+                                         +comp_param.language()
                                          +".load_paths");
             load_path = load_path + "," + load_path_language;
 
             List<String> cmd = new ArrayList();
+            String osname = System.getProperty("os.name").toLowerCase();
+            if(osname.startsWith("windows")){
+                cmd.add("cmd");
+                cmd.add("/c");
+            }
             cmd.add(rtcd_cmd);
             cmd.add("-o");
             cmd.add("manager.is_master:NO");
@@ -1497,21 +1529,13 @@
             cmd.add("-o");
             cmd.add("manager.modules.load_path:"+load_path);
             cmd.add("-o");
+            cmd.add("manager.supported_languages:"+ comp_param.language());
+            cmd.add("-o");
             cmd.add("manager.shutdown_auto:YES");
-/*
-            String cmd = rtcd_cmd;
-            cmd += " -o " + "manager.is_master:NO";
-            cmd += " -o " + "manager.corba_servant:YES";
-            cmd += " -o " + "corba.master_manager:" 
-                + config.getProperty("corba.master_manager");
-            cmd += " -o " + "manager.name:" + config.getProperty("manager.name");
-            cmd += " -o " + "manager.instance_name:" + mgrstr;
-*/
 
             rtcout.println(Logbuf.DEBUG, "Invoking command: "+ cmd + ".");
             try{
                 ProcessBuilder pb = new ProcessBuilder(cmd);
-                pb.redirectErrorStream(true);
                 Process p = pb.start();
             }
             catch(Exception ex){
@@ -1532,6 +1556,7 @@
                 = java.util.regex.Pattern.compile(
                "^manager_[0-9]+$");
             
+            rtcout.println(Logbuf.PARANOID, "mgrstr:"+mgrstr);
             if(mgrstr.equals("manager_%p")){
                 synchronized (m_slaveMutex) {
                     for (int ic=0; ic < m_slaves.length; ++ic) {
@@ -1551,9 +1576,13 @@
                 }
             }
 
+            rtcout.println(Logbuf.PARANOID, 
+                           "slaves_name.size():"+slaves_name.size());
             while (mgrobj == null) {
                 if(mgrstr.equals("manager_%p")){
                     synchronized (m_slaveMutex) {
+                        rtcout.println(Logbuf.PARANOID, 
+                                        "m_slaves.length:"+m_slaves.length);
                         for (int ic=0; ic < m_slaves.length; ++ic) {
                             _SDOPackage.NameValue[] prof 
                                 = m_slaves[ic]. get_configuration();
@@ -1563,7 +1592,13 @@
                             NVUtil.copyToProperties(proper, nvholder);
                             String i_name 
                                 = proper.getProperty("manager.instance_name");
+                            rtcout.println(Logbuf.PARANOID, "i_name:"+i_name);
                             Matcher matcher = pattern.matcher(i_name);
+                            rtcout.println(Logbuf.PARANOID, 
+                                        "matcher.matches():"+matcher.matches());
+                            rtcout.println(Logbuf.PARANOID, 
+                                        "slaves_name.contains(i_name):"
+                                        +slaves_name.contains(i_name));
                             if(matcher.matches() && 
                                         !slaves_name.contains(i_name)){
                                 mgrobj = m_slaves[ic];
@@ -1585,11 +1620,11 @@
                     //do nothing
                 }
             }
-            if (mgrobj == null) {
-                rtcout.println(Logbuf.WARN, "Manager cannot be found.");
-                return null;
-            }
         }
+        if (mgrobj == null) {
+            rtcout.println(Logbuf.WARN, "Manager cannot be found.");
+            return null;
+        }
         rtcout.println(Logbuf.DEBUG, "Creating component on "+mgrstr);
         rtcout.println(Logbuf.DEBUG, "arg: "+arg);
         try {
@@ -1650,21 +1685,14 @@
 
         RTM.Manager mgrobj = findManager(mgrstr);
         
-        tmp[0] = arg;
-        String language = get_parameter_by_modulename("language",tmp);
-        arg = tmp[0];
+        CompParam comp_param = new CompParam(arg);
 
-        if(language==null){
-            language = "Java";
-        }
-        if(language.isEmpty()){
-            language = "Java";
-        }
-
         if(mgrobj == null){
             Properties config = m_mgr.getConfig();
             String rtcd_cmd = 
-                config.getProperty("manager.modules."+language+".manager_cmd");
+                config.getProperty("manager.modules."
+                                   +comp_param.language()
+                                   +".manager_cmd");
 
             if(rtcd_cmd.isEmpty()){
                 rtcd_cmd = "rtcd_java";
@@ -1673,12 +1701,17 @@
             String load_path = config.getProperty("manager.modules.load_path");
             String load_path_language = config.getProperty(
                                          "manager.modules."
-                                         +language
+                                         +comp_param.language()
                                          +".load_paths");
             load_path = load_path + "," + load_path_language;
 
 
             List<String> cmd = new ArrayList();
+            String osname = System.getProperty("os.name").toLowerCase();
+            if(osname.startsWith("windows")){
+                cmd.add("cmd");
+                cmd.add("/c");
+            }
             cmd.add(rtcd_cmd);
             cmd.add("-p");
             cmd.add(mgrvstr[1]);
@@ -1735,7 +1768,68 @@
         }
     }
 
+    /**
+     * {@.ja マスターマネージャの有無を確認してリストを更新する}
+     * {@.en Confirms the presence of a master manager and renews a list.}
+     * 
+     * void update_master_manager()
+     */
+    public void update_master_manager() {
+        rtcout.println(Logbuf.PARANOID, 
+                        "update_master_manager()");
+        if(!m_isMaster && m_objref!=null){
+            synchronized (m_masterMutex) {
+                if (m_masters.length > 0){
+                    RTM.Manager m_masters[] = new RTM.Manager[0];
+                    ArrayList<RTM.Manager> masters 
+                                    = new ArrayList<RTM.Manager>();
+                    for (int ic=0; ic < m_masters.length; ++ic) {
+                        try{
+                            if(m_masters[ic]._non_existent()){
+                            }
+                            else{
+                                masters.add(m_masters[ic]);
+                            }
+                        }
+                        catch(Exception ex){
+                            String crlf = System.getProperty("line.separator");
+                            rtcout.println(Logbuf.ERROR, 
+                                            "Unknown exception cought."
+                                            + crlf
+                                            + ex.toString());
+                        }
+                    }
+                    m_masters 
+                        = (RTM.Manager[])masters.toArray(new RTM.Manager[0]);
+                }
+            }
+            if (m_masters.length == 0){
+                try{
+                    Properties config = m_mgr.getConfig();
+                    RTM.Manager owner = findManager(
+                            config.getProperty("corba.master_manager"));
+                    if(owner == null){
+                        rtcout.println(Logbuf.INFO,
+                                        "Master manager not found");
+                        return;
+                    }
+                    add_master_manager(owner);
+                    owner.add_slave_manager(m_objref);
+              
+                    return;
+                }
+                catch(Exception ex){
+                    String crlf = System.getProperty("line.separator");
+                    rtcout.println(Logbuf.ERROR, 
+                                    "Unknown exception cought."
+                                    + crlf
+                                    + ex.toString());
+                }
+            }
+        }
+    }
 
+
     /**
      * <p></p>
      */

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java	2017-10-05 05:37:25 UTC (rev 1055)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java	2017-10-06 07:12:02 UTC (rev 1056)
@@ -1,6 +1,10 @@
 package jp.go.aist.rtm.RTC;
 
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.File;
+import java.io.FilenameFilter;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -8,8 +12,13 @@
 import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
@@ -606,24 +615,392 @@
      */
     public Vector<Properties> getLoadableModules() {
         rtcout.println(Logbuf.TRACE, "getLoadableModules()");
-        Vector<String> dlls = new Vector<String>();
-        String separator =  System.getProperty("file.separator");
-        for (int i=0; i < m_loadPath.size(); ++i) {
-            String loadpath = m_loadPath.elementAt(i);
-            if(loadpath==null || loadpath.equals("")){
+        //# getting loadable module file path list.
+
+        String[] langs = 
+            m_properties.getProperty("manager.supported_languages").split(",");
+        rtcout.println(Logbuf.DEBUG, 
+                   "manager.supported_languages:"
+                   +m_properties.getProperty("manager.supported_languages"));
+
+        for(int ic=0;ic<langs.length;++ic) {
+            String lang = langs[ic].trim();
+
+            ArrayList<String> modules = new ArrayList<String>();
+            getModuleList(lang, modules);
+            rtcout.println(Logbuf.TRACE, lang + ":" +modules.toString());
+
+            ArrayList<Properties> tmpprops = new ArrayList<Properties>();
+            getModuleProfiles(lang, modules, tmpprops);
+            rtcout.println(Logbuf.TRACE, 
+                           "Modile profile size: "
+                           +tmpprops.size()
+                           +" (newly founded modules)");
+            m_modprofs.addAll(tmpprops);
+        }
+
+        rtcout.println(Logbuf.DEBUG, 
+                       "Modile profile size: "
+                       + m_modprofs.size());
+                       
+        removeInvalidModules();
+        rtcout.println(Logbuf.DEBUG, 
+                       "Modile profile size: "
+                       + m_modprofs.size()
+                       + " (invalid mod-profiles deleted)");
+        
+        return new Vector<Properties>(m_modprofs);
+    }
+    /**
+     * {@.ja 無効なモジュールプロファイルを削除する}
+     * {@.en Removing incalid module profile}
+     */
+    protected void removeInvalidModules(){
+
+        Iterator it = m_modprofs.iterator();
+        while (it.hasNext()) {
+            Properties prop = (Properties)it.next();
+            File file = new File(prop.getProperty("module_file_path"));
+            if(!file.exists()){
+                it.remove();
+            }
+        }
+
+    }
+    /**
+     * {@.ja 指定言語におけるロードパス上のローダブルなファイルリストを返す}
+     * {@.en loadable file list on the loadpath for given language}
+     *
+     * void getModuleList(const std::string& lang, coil::vstring& modules);
+     */
+    protected void getModuleList(final String lang, ArrayList<String> modules) {
+        rtcout.println(Logbuf.PARANOID,
+                       "getModuleList("+lang+","+modules.toString()+")");
+        String l = "manager.modules." + lang;
+        Properties lprop = Manager.instance().getConfig().getNode(l);
+
+        //load path: manager.modules.<lang>.load_path 
+        //           + manager.modules.load_path
+        rtcout.println(Logbuf.PARANOID,
+                               "load_paths :"+lprop.getProperty("load_paths"));
+        String[] vstr = lprop.getProperty("load_paths").split(",");
+        ArrayList<String> paths = new ArrayList(Arrays.asList(vstr));
+
+        rtcout.println(Logbuf.PARANOID,
+                               "m_loadPath :"+m_loadPath.toString());
+
+        paths.addAll(m_loadPath);
+        paths = deleteSamePath(paths);
+        rtcout.println(Logbuf.PARANOID,
+                               "paths :"+paths.toString());
+
+        String[] vstr2 = lprop.getProperty("suffixes").split(",");
+        ArrayList<String> suffixes = new ArrayList(Arrays.asList(vstr2));
+        rtcout.println(Logbuf.DEBUG, 
+                       "suffixes: "
+                       + suffixes.toString());
+
+        // for each load path list
+        for (String path : paths) {
+            if (path.isEmpty()) {
+                rtcout.println(Logbuf.WARN,"Given load path is empty");
                 continue;
             }
-            java.io.File dir = new java.io.File(loadpath);
-            String[] flist = dir.list(new FileFilter());
-            if(flist == null) {
+            rtcout.println(Logbuf.DEBUG,"Module load path: "+path);
+
+            // get file list for each suffixes
+            ArrayList<String> flist = new ArrayList<String>();
+            File dir = new File(path);
+            rtcout.println(Logbuf.PARANOID,"dir:"+dir);
+            if(!dir.exists()){
                 continue;
             }
-            for (int ic=0; ic < flist.length; ++ic) {
-                dlls.add(loadpath+separator+flist[ic]);
-            }  
+            for (String suffix: suffixes) {
+                String  glob = ".*\\."; 
+                glob += suffix.trim();
+                rtcout.println(Logbuf.PARANOID,"glob: "+glob);
+                String[] files = dir.list(new FilePathFilter(glob));
+                rtcout.println(Logbuf.PARANOID,"files.length:"+files.length);
+                ArrayList<String> tmp 
+                    = new ArrayList<String>(Arrays.asList(files));
+                rtcout.println(Logbuf.DEBUG,
+                                   "File list (path:"
+                                   +path
+                                   +", ext:"
+                                   +suffix
+                                   +"): "
+                                   +tmp.toString());
+                flist.addAll(tmp);
+            }
+        
+            // reformat file path and remove cached files
+            for (String file : flist) {
+                if (!path.endsWith("/")) { 
+                    path += "/"; 
+                }
+                String fpath = path + file;
+                addNewFile(fpath, modules);
+            }
         }
+    }
+    /**
+     * {@.ja 同じパスを削除}
+     * {@.en Deletes the same path.}
+     * <p>
+     * {@.ja 指定されたリスト内を走査して重複しているパス名を削除する。}
+     * {@.en Deletes the path a list overlaps.}
+     */
+    private ArrayList<String> deleteSamePath(ArrayList<String> paths){
+        rtcout.println(Logbuf.PARANOID,
+                        "deleteSamePath("+paths.toString()+")");
 
-        Vector<Properties> props = new Vector<Properties>();
+        ArrayList<String> tmp_paths = new ArrayList<String>();
+        for(String path_str : paths){
+            rtcout.println(Logbuf.PARANOID,
+                        "path_str:"+path_str);
+            if(!path_str.isEmpty()){
+                Path path = Paths.get(path_str);
+                path = path.normalize();
+                Path absolutePath = path.toAbsolutePath();
+                rtcout.println(Logbuf.PARANOID,
+                        "absolutePath:"+absolutePath);
+                
+                ArrayList<Path> abs_tmp_paths = new ArrayList<Path>();
+                for(String tmp_path : tmp_paths){
+                    Path abs_tmp_path = Paths.get(tmp_path);
+                    abs_tmp_path = abs_tmp_path.normalize();
+                    abs_tmp_paths.add(abs_tmp_path);
+                }
+                if(abs_tmp_paths.indexOf(absolutePath) == -1){
+                    tmp_paths.add(path_str);
+                }
+            }
+        }
+        rtcout.println(Logbuf.PARANOID,
+                        "tmp_paths:"+tmp_paths.toString());
+
+        return tmp_paths;
+    }
+    /**
+     * {@.ja キャッシュに無いパスだけmodulesに追加する}
+     * {@.en Adding file path not existing cache}
+     */
+    protected void addNewFile(final String fpath,
+                                  ArrayList<String> modules) {
+        rtcout.println(Logbuf.PARANOID, 
+                               "addNewFile("+fpath+")");
+        boolean exists = false;
+        for (Properties modprof : m_modprofs) {
+            rtcout.println(Logbuf.PARANOID, 
+                               "module_file_path:"
+                               +modprof.getProperty("module_file_path"));
+            if (modprof.getProperty("module_file_path").equals(fpath)) {
+                exists = true;
+                rtcout.println(Logbuf.DEBUG, 
+                               "Module "+fpath+" already exists in cache.");
+                break;
+            }
+        }
+        if (!exists) {
+            rtcout.println(Logbuf.DEBUG, "New module: "+fpath);
+            modules.add(fpath);
+        }
+    }
+
+    /**
+     * {@.ja ファイルフィルタ用関数}
+     * {@.en The function for file filters}
+     * <p>
+     * {@.ja ファイル名にフィルタをかけるために使用される。}
+     * {@.en This class is used to filter directory listings 
+     * in the list method of class File.}
+     */
+    private class FilePathFilter implements FilenameFilter{
+        private String m_regex = new String();
+        public FilePathFilter(String str) {
+            m_regex = str;
+        }
+        @Override
+        public boolean accept(File dir, String name) {
+            if(m_regex.isEmpty()){
+                 return false;
+            }
+         
+            if(name.matches(m_regex)){
+                return true;
+            }
+            return false;
+        }
+    }  
+
+
+    /**
+     * {@.ja 指定言語、ファイルリストからモジュールのプロパティを返す}
+     * {@.en Getting module properties from given language and file list}
+     *
+     */
+    protected void getModuleProfiles(final String lang,
+                                     final ArrayList<String> modules,
+                                     final ArrayList<Properties> modprops) {
+        rtcout.println(Logbuf.PARANOID, 
+                       "getModuleProfiles("+lang+","+modules.toString()+")");
+
+        String  l = "manager.modules." + lang;
+        Properties lprop = Manager.instance().getConfig().getNode(l);
+
+        String[] paths = lprop.getProperty("load_paths").split(",");
+
+        Properties prop = new Properties();
+
+        for (String module : modules) {
+            if(lang.equals("Java")){
+                prop = getRtcProfile(module);
+                if(prop!=null){
+                    prop.setProperty("module_file_name",
+                                     new File(module).getName());
+                    prop.setProperty("module_file_path", module);
+                    modprops.add(prop);
+                }
+            }
+            else{
+                prop = new Properties();
+                String cmd = lprop.getProperty("profile_cmd");
+                rtcout.println(Logbuf.PARANOID, 
+                       "profile_cmd: "+cmd);
+                List<String> cmdlist = new ArrayList();
+                String osname = System.getProperty("os.name").toLowerCase();
+                if(osname.startsWith("windows")){
+                    cmdlist.add("cmd");
+                    cmdlist.add("/c");
+                }
+                cmdlist.add(cmd);
+                cmdlist.add(module);
+                Process process;
+                InputStream input;
+                try{
+                    rtcout.println(Logbuf.PARANOID, 
+                                   "cmdlist :"+cmdlist.toString());
+                    ProcessBuilder pb = new ProcessBuilder(cmdlist);
+                    process = pb.start();
+                    input = process.getInputStream();
+                    process.waitFor();
+                }
+                catch(Exception ex){
+                    rtcout.println(Logbuf.DEBUG, cmd + ": failed");
+                    String crlf = System.getProperty("line.separator");
+                    rtcout.println(Logbuf.PARANOID, crlf + ex.toString());
+                    continue;
+                }
+      
+                try{
+                    BufferedReader br = new BufferedReader( 
+                                        new InputStreamReader(input));
+ 
+                    String line;
+ 
+                    rtcout.println(Logbuf.PARANOID, "-----");
+                    for (;;) {
+                        line = br.readLine();
+                        rtcout.println(Logbuf.PARANOID, line);
+                        if(line == null){
+                            break;
+                        }
+                        String[] vstr = line.split(":");
+                        if(vstr.length != 1){
+                            prop.setProperty(vstr[0],vstr[1]);
+                        }
+                    }
+                    rtcout.println(Logbuf.PARANOID, "-----");
+ 
+                    br.close();
+                    input.close();
+                }
+                catch(Exception ex){
+                    String crlf = System.getProperty("line.separator");
+                    rtcout.println(Logbuf.DEBUG, crlf + ex.toString());
+                    continue;
+                }
+                rtcout.println(Logbuf.PARANOID, "prop.size():"+prop.size());
+                if(!prop.getProperty("implementation_id").isEmpty()){
+                    prop.setProperty("module_file_name",
+                                     new File(module).getName());
+                    prop.setProperty("module_file_path", module);
+                    rtcout.println(Logbuf.PARANOID, 
+                            "module_file_name:"
+                            +prop.getProperty("module_file_name"));
+                    rtcout.println(Logbuf.PARANOID, 
+                            "module_file_path:"
+                            +prop.getProperty("module_file_path"));
+                    modprops.add(prop);
+                }
+            }
+        }
+        return;
+    }
+
+    private Properties getRtcProfile(String loadpath){
+        if(loadpath==null || loadpath.equals("")){
+            return null;
+        }
+        Properties prop = new Properties();
+        Class target = null;
+        File file = new File(loadpath);
+        if(file.isAbsolute()) {
+            URLClassLoader url = createURLClassLoader(file.getParent());
+            if(url!=null){
+                String name = file.getName();
+                name = getModuleName(name);
+                StringHolder packageModuleName = new StringHolder();
+                target = getClassFromName(url,name,packageModuleName);
+            }
+        }
+        else{
+            String separator =  System.getProperty("file.separator");
+            String str[] = loadpath.split("\\.class");
+            str[0] = str[0].replace(separator,".");
+            str[0] = str[0].replace("..",".");
+            try {
+                target = Class.forName(str[0],
+                                     true,
+                                     this.getClass().getClassLoader());
+            }
+            catch(Exception e){
+                return null;
+            }
+        }
+        try {
+            if(target == null){
+                return null;
+            }
+            Field field = target.getField("component_conf");
+            String[] data = (String[])field.get(null);
+            java.util.ArrayList al 
+                = new java.util.ArrayList(java.util.Arrays.asList(data));
+        
+            prop = new Properties((String[])al.toArray(new String[]{}));
+            rtcout.println(Logbuf.TRACE, 
+                                "loadabe module:"+loadpath);
+        } 
+        catch(Exception e){
+            return null;
+        }
+     
+        return prop;
+    }
+/*
+        ArrayList<String> dlls = new ArrayList<String>();
+        String separator =  System.getProperty("file.separator");
+        java.io.File dir = new java.io.File(loadpath);
+
+        String[] flist = dir.list(new FileFilter());
+        if(flist == null) {
+            return;
+        }
+        for (int ic=0; ic < flist.length; ++ic) {
+            dlls.add(loadpath+separator+flist[ic]);
+        }  
+
+        ArrayList<Properties> props = new ArrayList<Properties>();
         for (int ic=0; ic < dlls.size(); ++ic) {
             Class target = null;
             File file = new File(dlls.elementAt(ic));
@@ -658,10 +1035,10 @@
                 java.util.ArrayList al 
                     = new java.util.ArrayList(java.util.Arrays.asList(data));
             
-                al.add(0,"module_file_name");
-                al.add(1,file.getName());
-                al.add(2,"module_file_path");
-                al.add(3,dlls.elementAt(ic));
+                //al.add(0,"module_file_name");
+                //al.add(1,file.getName());
+                //al.add(2,"module_file_path");
+                //al.add(3,dlls.elementAt(ic));
                 props.add(new Properties((String[])al.toArray(new String[]{})));
                 rtcout.println(Logbuf.TRACE, 
                                     "loadabe module:"+dlls.elementAt(ic));
@@ -672,7 +1049,7 @@
         }  
          
         return props;
-    }
+*/
     
     /**
      * {@.ja モジュールの絶対パス指定許可。}
@@ -795,4 +1172,5 @@
         }
     }
     private Logbuf rtcout;
+    private ArrayList<Properties> m_modprofs = new ArrayList<Properties>();
 }



More information about the openrtm-commit mailing list