[openrtm-commit:01629] r732 - in branches/RELENG_1_1: . jp.go.aist.rtm.RTC jp.go.aist.rtm.RTC/idl jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext

openrtm @ openrtm.org openrtm @ openrtm.org
2015年 10月 28日 (水) 10:44:04 JST


Author: kawauchi
Date: 2015-10-28 10:44:04 +0900 (Wed, 28 Oct 2015)
New Revision: 732

Added:
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java
Removed:
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java
Modified:
   branches/RELENG_1_1/
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
   branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
Log:
[compat,merge] r661,663,670,672,673 merged from trunk.


Property changes on: branches/RELENG_1_1
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658
   + /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/DesignChangeOfEC:648-660
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658,661,663,670,672-673


Property changes on: branches/RELENG_1_1/jp.go.aist.rtm.RTC
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658
   + /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/DesignChangeOfEC/jp.go.aist.rtm.RTC:648-660
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658,661,663,670,672-673

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml	2015-10-28 01:44:04 UTC (rev 732)
@@ -115,6 +115,8 @@
 
 	<property name="idl.ComponentObserver" value="${idl.path}/ComponentObserver.idl" />
 
+	<property name="idl.Logger" value="${idl.path}/Logger.idl" />
+
 	<property name="idl.test.CorbaConsumer" value="${idl.path.tests}/CorbaConsumer/Hello.idl" />
 
 	<property name="idl.test.CorbaPort" value="${idl.path.tests}/CorbaPort/MyService.idl" />
@@ -472,6 +474,12 @@
 
 		</exec>
 
+		<exec executable="${java.home}\..\bin\idlj">
+
+			<arg line="-v -fall -td ${source} -i ${idl.path} -emitAll ${idl.Logger}"/>
+
+		</exec>
+
 	</target>
 
 
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl (from rev 670, trunk/jp.go.aist.rtm.RTC/idl/Logger.idl)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,388 @@
+// -*- IDL -*-
+/*!
+ * @file Logger.idl
+ * @brief Component logger SDO service
+ * @date $Date$
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2011
+ *     Noriaki Ando
+ *     Intelligent Systems Research Institute,
+ *     National Institute of
+ *         Advanced Industrial Science and Technology (AIST), Japan
+ *     All rights reserved.
+ *
+ * $Id$
+ *
+ */
+
+#include <BasicDataType.idl>
+#include <SDOPackage.idl>
+/*!
+ * @if jp
+ * @brief コンポーネントログ収集サービスインターフェース
+ *
+ * コンポーネントのログ情報を外部から取得するためのインターフェース。コ
+ * ンポーネントに対して、本SDOサービスオブジェクトをアタッチすることで、
+ * コンポーネントが出力するログを外部から取得することができる。
+ * 
+ * @since 1.1
+ *
+ * @else
+ * @brief Component logging service interface
+ *
+ * This interface defines logging service of an RT-Component from
+ * outside. Attaching this service interface to an RT-Component, you
+ * can get logging information from the RT-Component.
+ *
+ * @since 1.1
+ * @endif
+ *
+ */
+module OpenRTM
+{
+  /*!
+   * @if jp
+   *
+   * @brief ログレベル
+   * 
+   * ログレベル。ログレベルは9段階あり、それぞれ以下の意味を持つ。
+   * 
+   *  - SILENT  : ロギング機能をオフにするための疑似レベル
+   *  - ERROR   : エラーが発生したことを意味するログレベル
+   *  - WARN    : エラーではないが注意すべき警告を意味するログレベル
+   *  - INFO    : 付加的な情報を提供するためのログレベル
+   *  - NORMAL  : 通常の情報を提供するためのログレベル
+   *  - DEBUG   : デバッグ情報を提供する際のログレベル
+   *  - TRACE   : トレースレベルの情報を提供する際のログレベル
+   *  - VERBOSE : トレース情報以上に詳細な情報を提供する際のログレベル
+   *  - PARANOID: リアルタイム周期処理実行時等の情報を提供するログレベル
+   * 
+   * @else
+   *
+   * @brief Log level
+   * 
+   * This enumeration defines log levels. The log level consists of
+   * nine levels, and each level means the following meaning.
+   * 
+   *  - SILENT  : Pseudo log level to stop logging function.
+   *  - ERROR   : This log level means that an error event is occurring.
+   *  - WARN    : This log level means that a warning event is occurring.
+   *  - INFO    : This log level used to notify information.
+   *  - NORMAL  : This log level means that an event is normal thing.
+   *  - DEBUG   : This log level used to notify debugging information.
+   *  - TRACE   : This log level used to notify trace information.
+   *  - VERBOSE : This log level used to notify more detailed information.
+   *  - PARANOID: This is used only to notify information in real-time loop.
+   *
+   * @endif
+   */
+  enum LogLevel
+  {
+    SILENT,
+    ERROR,
+    WARN,
+    INFO,
+    NORMAL,
+    DEBUG,
+    TRACE,
+    VERBOSE,
+    PARANOID
+  };
+
+  /*!
+   * @if jp
+   * @brief ログレコード構造体
+   *
+   * ログメッセージを含むログ情報を保持する構造体
+   *
+   * @else
+   * @brief Log record structure
+   *
+   * This struct defines logging information including log message.
+   *
+   * @endif
+   *
+   */
+  struct LogRecord
+  {
+    /*!
+     * @if jp
+     * @brief 時刻
+     * タイムスタンプ
+     * @else
+     * @brief Time
+     * Time stump.
+     * @endif
+     */
+    RTC::Time   time;
+
+    /*!
+     * @if jp
+     * @brief ロガー名
+     * ログを書きこんだロガーオブジェクト名
+     * @else
+     * @brief logger name
+     * The logger name which writes this record.
+     * @endif
+     */
+    string loggername;
+
+    /*!
+     * @if jp
+     * @brief ログレベル
+     * このレコードのログレベル
+     * @else
+     * @brief Log level
+     * The log level of this record
+     * @endif
+     */
+    LogLevel  level;
+
+    /*!
+     * @if jp
+     * @brief メッセージ
+     * ログメッセージ
+     * @else
+     * @brief Message
+     * Log message.
+     * @endif
+     */
+    string message;
+  };
+
+
+  /*!
+   * @if jp
+   *
+   * @interface Logger インターフェース
+   *
+   * 個別のRTCのログ情報を取得するためのサービスインターフェース。SDO
+   * Service として対象となるRTC/SDOに対してアタッチされ、RTC/SDOのログ
+   * 情報を外部から取得する。実際の処理シーケンスは以下の通りである。
+   *
+   * -# SDO::get_configuration() により Configuration オブジェクトを取得
+   * -# Configuration::add_service_profile() によりTool側の
+   *     Logger を ServiceProfile により RTC に与える。
+   *     ServiceProfile のメンバーは以下のように設定すること
+   *   - id: UUID など一意なIDを設定する。削除時にも必要になるので、Tool
+   *     側ではIDを保持しておかなければならない。
+   *   - interface_type: 当該サービスのIFRのIDを文字列として指定。RTC側で
+   *     はこの文字列により当該サービスオブジェクトを受け入れるか決定す
+   *     るため指定は必須となる。
+   *   - properties: RTC側のサービスの受け入れ側に通知するプロパティを設
+   *     定する。このサービスでは、下記のログレベル関連のプロパティを
+   *     指定する。
+   *    - service: SDOService オブジェクトの参照を指定する。
+   * -# RTC側でロガーへの書き込みが有った場合には publish() オペレーション
+   *     が LogRecord 構造体としてログメッセージやタイムスタンプをサー
+   *     ビス側に通知する。サービスを保持する側では、LogRecord内の情報
+   *     をファイルに書き込む、表示する等の方法で利用することができる。
+   * -# RTC側が終了するときには、close() オペレーションが呼び出されるの
+   *    で、サービス提供側は適切な終了処理を行う必要がある。close()が呼
+   *    ばれた場合は、remove_service_profile() により明示的にサービスを
+   *    削除する必要はない。またRTC側ではclose() を呼んだ後は、当該サー
+   *    ビスに関する情報やリソースを適切に開放しなければならない。
+   * -# ツール等のサービス提供側が終了する場合などは、
+   *    remove_service_profile() オペレーションを呼び出し、当該RTC上の
+   *    リソースを適切に開放する必要がある。RTC側は、
+   *    remove_service_profile() が呼び出された際には、当該ロギングに関
+   *    するリソースを適切に開放する必要がある。
+   *
+   * 上記のプロセスを下記シーケンス図に示す。
+   *
+   * <pre>
+   * 
+   *   [RTC]    [Configuration]           [Logger]      [Tool]
+   *     |            |                       |            |
+   *     |            | get_configuration()   |            |
+   *     |<------------------------------------------------|
+   *     |            |                       |            |
+   *     |            | add_service_profile(prof)          |
+   *     |            |<-----------------------------------|
+   *     |            |                       |            |
+   *     |            | publish(logrecord)    |            |
+   *     |----------------------------------->|            |
+   *     |            | publish(logrecord)    |            |
+   *     |----------------------------------->|            |
+   *     |            |       :               |            |
+   *     |            |       :               |            |
+   *     |            | 1) RTCが先に終了するとき           |
+   *     |            |       :               |            |
+   *     |            | [close()]             |            |
+   *     |----------------------------------->|            |
+   *     |            |       :               |            |
+   *     |            | 2) ツールがロギングを終了するとき  |
+   *     |            |       :               |            |
+   *     |            | remove_service_profile(id)         |
+   *     |            |<-----------------------------------|
+   *     |            |                       |            |
+   *     |            |                       x            x
+   *
+   * </pre>
+   *
+   * なお、ServiceProfile::properties に指定するプロパティとしては、
+   *
+   * - logger.log_level: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE,
+   *                     PARANOID)
+   * - logger.filter: logger name or "ALL"
+   *
+   * がある、
+   *
+   * - logger.log_level: ERROR, WARN, INFO, NORMAL, DEBUG, TRACE,
+   *   VERBOSE またはPARANOID のうち一つを指定する。無指定の場合は
+   *   NORMAL と同等となる。指定されたレベルと同等あるいはそれより重要
+   *   な情報がロギングされる。すなわち、それぞれのログレベルを指定した
+   *   際に出力されるログは以下の関係になる。
+   *   - ERROR   : (ERROR)
+   *   - WARN    : (ERROR, WARN)
+   *   - INFO    : (ERROR, WARN, INFO)
+   *   - NORMAL  : (ERROR, WARN, INFO, NORMAL)
+   *   - DEBUG   : (ERROR, WARN, INFO, NORMAL, DEBUG)
+   *   - TRACE   : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE)
+   *   - VERBOSE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE)
+   *   - PARANOID: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARA)
+   * - logger.filter: RTC内部は、RTC本体、データポート、サービスポート
+   *   等それぞれのオブジェクトにロガーオブジェクトが存在する。このプロ
+   *   パティはロギングする対象のロガーオブジェクトをカンマ区切りで指定
+   *   する。または、ALLを指定することでRTC配下のすべてのロギングオブジェ
+   *   クトからのメッセージを受信する。無指定の場合はALLと同等になる。
+   *
+   * @else
+   * @class
+   *
+   * @interface Logger interface
+   *
+   * This interface defines logging service for each RT-Component.
+   * This service would be attached to a target RTC/SDO, and provides
+   * functionality to collect log information from remote
+   * applications.  Actual process sequences are the following.
+   *
+   * -# Get configuration object by SDO::get_configuration() 
+   * -# Attach Logger object with ServiceProfile by
+   *    Configuration::add_service_profile(). ServiceProfile should be
+   *    set as follows.
+   *   - id: An unique ID like UUID. This ID is used when this service
+   *         is removed. Tools or applications should keep the ID for
+   *         this.
+   *   - interface_type: Specify this service's IFR ID in string. This
+   *         string is used to search available service in the RTC,
+   *         and if it matches with available SDO services, this
+   *         service is accepted.
+   *   - properties: This member specifies properties to notify
+   *         information to the target RTC.  The following properties
+   *         for log level and others would be specified in this
+   *         properties.
+   *
+   *   - service: A SDOService object reference is specified.
+   * -# When logging occurs in the RTC side, the "publish()" operation
+   *    notifies a log message, time stump and so on to the service
+   *    provider as a LogRecord structure. The service provider can
+   *    use notified information for example writing to files and
+   *    showing them on the display.
+   * -# When RTC is terminated, the "close()" operation is called, and
+   *    the service provider has to terminate the logging service
+   *    properly.  In this case, tools and applications that have
+   *    service provider do not need to call remove_service_profile()
+   *    and remove the service explicitly. After calling close()
+   *    operation, the RTC has to release the service profile and
+   *    resources.
+   * -# When tools and applications terminate services, they have to
+   *    call remove_service_profile() operation, and have to release
+   *    resources in the target RTC. When remove_service_profile() is
+   *    called, the RTC have to release service profile and resources
+   *    for this service.
+   *
+   * The following diagram shows above mentioned sequence.
+   *
+   * <pre>
+   * 
+   *   [RTC]    [Configuration]           [Logger]      [Tool]
+   *     |            |                       |            |
+   *     |            | get_configuration()   |            |
+   *     |<------------------------------------------------|
+   *     |            |                       |            |
+   *     |            | add_service_profile(prof)          |
+   *     |            |<-----------------------------------|
+   *     |            |                       |            |
+   *     |            | publish(logrecord)    |            |
+   *     |----------------------------------->|            |
+   *     |            | publish(logrecord)    |            |
+   *     |----------------------------------->|            |
+   *     |            |       :               |            |
+   *     |            |       :               |            |
+   *     |            | 1) When RTC is terminated          |
+   *     |            |       :               |            |
+   *     |            | [close()]             |            |
+   *     |----------------------------------->|            |
+   *     |            |       :               |            |
+   *     |            | 2) When tool terminates logging    |
+   *     |            |       :               |            |
+   *     |            | remove_service_profile(id)         |
+   *     |            |<-----------------------------------|
+   *     |            |                       |            |
+   *     |            |                       x            x
+   *
+   * </pre>
+   *
+   * So far, the following properties for ServiceProfile::properties
+   * are available.
+   *
+   * - logger.log_level: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE,
+   *                     PARANOID)
+   * - logger.filter: logger name or "ALL"
+   *
+   *
+   * - logger.log_level: One of ERROR, WARN, INFO, NORMAL, DEBUG,
+   *     TRACE, VERBOSE or PARANOID can be specified.  If no
+   *     properties are specified, it will be NORMAL.  Log messages
+   *     equals and/or more important specified log level would be
+   *     published.  The following list shows the relation between
+   *     specified level and published level.
+   *   - ERROR   : (ERROR)
+   *   - WARN    : (ERROR, WARN)
+   *   - INFO    : (ERROR, WARN, INFO)
+   *   - NORMAL  : (ERROR, WARN, INFO, NORMAL)
+   *   - DEBUG   : (ERROR, WARN, INFO, NORMAL, DEBUG)
+   *   - TRACE   : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE)
+   *   - VERBOSE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE)
+   *   - PARANOID: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARA)
+   * - logger.filter: Some logger objects exist in some object of an
+   *     RTC such as RTC body, data port, service port and so on.
+   *     Some logger objects exist in some object of an RTC such as
+   *     RTC body, data port, service port and so on.  This properties
+   *     specify target logger names separated with commas.  If ALL is
+   *     specified, all the logger's messages under the target RTC's
+   *     logger would be published.  If no property is specified, all
+   *     the messages will be published.
+   *
+   * @endif
+   *
+   */
+  interface Logger
+    : SDOPackage::SDOService
+  {
+    /*!
+     * @if jp
+     * @brief ログメッセージ配信
+     * ログメッセージを配信する
+     * @else
+     * @brief Publish log message
+     * This operation publishes log message.
+     * @endif
+     */
+    oneway void publish(in LogRecord record);
+
+    /*!
+     * @if jp
+     * @brief サービスの終了
+     * ロギングサービスの終了を通知する
+     * @else
+     * @brief Terminate service
+     * This operation notifies logging service.
+     * @endif
+     */
+    void close();
+  };
+};
+

Deleted: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -1,81 +0,0 @@
-package jp.go.aist.rtm.RTC;
-
-import jp.go.aist.rtm.RTC.executionContext.ExecutionContextBase;
-
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.POAPackage.ObjectNotActive;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
-import org.omg.PortableServer.POAPackage.ServantNotActive;
-import org.omg.PortableServer.POAPackage.WrongPolicy;
-
-import RTC.ExecutionContextServiceHelper;
-import RTC.RTObjectHelper;
-
-
-/**
- * <p>CorbaObjectManagerクラスです。
- * CORBA オブジェクトをアクティブ化、非アクティブ化します。</p>
- */
-class CorbaObjectManager {
-    /**
-     * <p>コンストラクタです。</p>
-     *
-     * @param orb ORB
-     * @param poa POA
-     */
-    public CorbaObjectManager(ORB orb, POA poa) {
-        m_pPOA = poa;
-    }
-
-    /**
-     * <p>CORBA オブジェクト(RTObjct)をアクティブ化します。</p>
-     *
-     * @param comp  アクティブ化対象RTObject
-     *
-     * @exception ServantAlreadyActive 対象Servantがすでにactivate済み
-     * @exception WrongPolicy POA でサポートされていないポリシーを使用
-     * @exception ObjectNotActive 指定された oid を持つオブジェクトが Active Object Map にない場合 
-     */
-    public void activate(RTObject_impl comp) 
-            throws ServantAlreadyActive, WrongPolicy, ObjectNotActive {
-        if( comp.m_objref==null ) {
-            byte[] id = m_pPOA.activate_object(comp);
-            comp.setObjRef(RTObjectHelper.narrow(m_pPOA.id_to_reference(id)));
-        }
-    }
-
-    /**
-     * <p>CORBA オブジェクト(ExecutionContext)をアクティブ化します。</p>
-     *
-     * @param comp  アクティブ化対象ExecutionContext
-     *
-     * @exception ServantAlreadyActive 対象Servantがすでにactivate済み
-     * @exception WrongPolicy POA でサポートされていないポリシーを使用
-     * @exception ObjectNotActive 指定された oid を持つオブジェクトが Active Object Map にない場合 
-     */
-    public void activate(ExecutionContextBase comp) throws ServantAlreadyActive, WrongPolicy, ObjectNotActive {
-        byte[] id = m_pPOA.activate_object(comp);
-        comp.setObjRef(ExecutionContextServiceHelper.narrow(m_pPOA.id_to_reference(id)));
-    }
-    /**
-     * <p>CORBA オブジェクトを非アクティブ化します。</p>
-     *
-     * @param comp  非アクティブ化対象オブジェクト
-     *
-     * @exception ServantAlreadyActive 対象Servantがactivate化されていない
-     * @exception WrongPolicy POA でサポートされていないポリシーを使用
-     * @exception ObjectNotActive 指定された oid を持つオブジェクトが Active Object Map にない場合
-     * 
-     */
-    public void deactivate(Servant comp) throws ServantNotActive, WrongPolicy, ObjectNotActive {
-        byte[] id = m_pPOA.servant_to_id(comp);
-        m_pPOA.deactivate_object(id);
-    }
-
-    /**
-     * POA
-     */
-    private POA m_pPOA;
-}

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -50,7 +50,9 @@
         "corba.nameservice.replace_endpoint", "NO",
         "exec_cxt.periodic.type", "jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
         "exec_cxt.periodic.rate", "1000",
-        "exec_cxt.evdriven.type", "jp.go.aist.rtm.RTC.executionContext.EventDrivenExecutionContext",
+        "exec_cxt.sync_transition",              "YES",
+        "exec_cxt.transition_timeout",           "0.5",
+        //"exec_cxt.evdriven.type", "jp.go.aist.rtm.RTC.executionContext.EventDrivenExecutionContext",
         "manager.modules.load_path",        "./",
         "manager.modules.abs_path_allowed", "YES",
         "manager.is_master",                "NO",

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -2,6 +2,7 @@
 
 import java.lang.reflect.Constructor;
 
+import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -187,6 +188,7 @@
      *  {@.en Map of FactoryEntry}
      */
     protected HashMap<IDENTIFIER, FactoryEntry> m_creators = new HashMap<IDENTIFIER, FactoryEntry>();
+    private HashMap<ABSTRACTCLASS, FactoryEntry> m_objects = new HashMap<ABSTRACTCLASS, FactoryEntry>();
 
     /**
      * {@.ja Identifierがマップに存在するかチェックする。}
@@ -233,7 +235,7 @@
         if (m_creators.containsKey(id)){
             return ReturnCode.ALREADY_EXISTS;
         }
-        FactoryEntry f = new FactoryEntry(creator, destructor);
+        FactoryEntry f = new FactoryEntry(id, creator, destructor);
         m_creators.put(id,f);
         return ReturnCode.FACTORY_OK;
     }
@@ -278,7 +280,9 @@
         if (!m_creators.containsKey(id)){
             return null;
         }
-        return m_creators.get(id).creator_.creator_();
+        ABSTRACTCLASS obj = m_creators.get(id).creator_.creator_();
+        m_objects.put(obj, m_creators.get(id));
+        return obj;
     }
     /**
      * {@.ja オブジェクト削除。}
@@ -296,11 +300,13 @@
      *   {@.en Deleteed object.}
      * 
      */
-    public void deleteObject(final IDENTIFIER id, ABSTRACTCLASS obj) {
+    public ReturnCode deleteObject(final IDENTIFIER id, ABSTRACTCLASS obj) {
         if (!m_creators.containsKey(id)){
-            return ;
+            return deleteObject(obj);
         }
         m_creators.get(id).destructor_.destructor_(obj);
+        m_objects.remove(obj);
+        return ReturnCode.FACTORY_OK;
     }
     /**
      * {@.ja オブジェクト削除。}
@@ -314,15 +320,127 @@
      *   {@.ja 削除するオブジェクト}
      *   {@.en Deleteed object.}
      */
-    public void deleteObject(ABSTRACTCLASS obj) {
-        Iterator it = m_creators.keySet().iterator();
+    public ReturnCode deleteObject(ABSTRACTCLASS obj) {
+        if(!m_objects.containsKey(obj)) {
+            return ReturnCode.NOT_FOUND; 
+        }
+        m_objects.get(obj).destructor_.destructor_(obj);
+        m_objects.remove(obj);
 
+        return ReturnCode.FACTORY_OK;
+    }
+
+    /**
+     * {@.ja 生成済みオブジェクトリストの取得}
+     * {@.en Getting created objects}
+     * <p>
+     * {@.ja このファクトリで生成されたオブジェクトのリストを取得する。}
+     * {@.en This operation returns a list of created objects by the factory.}
+     *
+     * @return 
+     *   {@.ja 生成済みオブジェクトリスト}
+     *   {@.en created object list}
+     *
+     */
+    public ArrayList<ABSTRACTCLASS> createdObjects() {
+        ArrayList<ABSTRACTCLASS> objects = new ArrayList<ABSTRACTCLASS>();
+        Iterator it = m_objects.keySet().iterator();
         while (it.hasNext()) {
-            m_creators.get(it.next()).destructor_.destructor_(obj);
+            objects.add((ABSTRACTCLASS)it.next());
         }
+        return objects;
     }
 
     /**
+     * {@.ja オブジェクトがこのファクトリの生成物かどうか調べる}
+     * {@.en Whether a object is a product of this factory}
+     * <p>
+     * @param obj 
+     *   {@.ja 対象オブジェクト}
+     *   {@.en A target object}
+     * @return 
+     *   {@.ja true: このファクトリの生成物
+     *         false: このファクトリの生成物ではない}
+     *   {@.en true: The object is a product of the factory
+     *         false: The object is not a product of the factory}
+     *
+     */
+    public boolean isProducerOf(ABSTRACTCLASS obj) {
+        return m_objects.containsKey(obj);
+    }
+
+    /**
+     * {@.ja オブジェクトからクラス識別子(ID)を取得する}
+     * {@.en Getting class identifier (ID) from a object}
+     * <p>
+     * {@.ja 当該オブジェクトのクラス識別子(ID)を取得する。}
+     * {@.en This operation returns a class identifier (ID) from a object.}
+     *
+     * @param obj [in] 
+     *   {@.ja クラス識別子(ID)を取得したいオブジェクト}
+     *   {@.en An object to investigate its class ID.}
+     * @param id [out] 
+     *   {@.ja クラス識別子(ID)}
+     *   {@.en Class identifier (ID)}
+     * @return 
+     *   {@.ja リターンコード NOT_FOUND: 識別子が存在しない
+     *                        FACTORY_OK: 正常終了}
+     *   {@.en Return code NOT_FOUND: ID not found
+     *                        FACTORY_OK: normal return}
+     */
+    public ReturnCode objectToIdentifier(ABSTRACTCLASS obj, IDENTIFIER id) {
+        if (!m_objects.containsKey(obj)) { 
+            return ReturnCode.NOT_FOUND; 
+        }
+        id = m_objects.get(obj).id_;
+        return ReturnCode.FACTORY_OK;
+    }
+
+    /**
+     * {@.ja オブジェクトのコンストラクタを取得する}
+     * {@.en Getting destructor of the object}
+     * <p>
+     * {@.ja このファクトリで生成されたオブジェクトのコンストラクタを取得する。
+     * obj はこのファクトリで生成されたものでなければならない。予め
+     * isProducerOf() 関数で当該オブジェクトがこのファクトリの生成物で
+     * あるかどうかをチェックしなければならない。}
+     * {@.en This operation returns a constructor of the object created by
+     * the factory.  obj must be a product of the factory.  User must
+     * check if the object is a product of the factory by using
+     * isProducerOf()-function, before using this function.}
+     *
+     * @return 
+     *   {@.ja オブジェクトのデストラクタ}
+     *   {@.en destructor of the object}
+     *
+     */
+    public ObjectCreator objectToCreator(ABSTRACTCLASS obj) {
+        return m_objects.get(obj).creator_;
+    }
+
+    /**
+     * {@.ja オブジェクトのデストラクタを取得する}
+     * {@.en Getting destructor of the object}
+     * <p>
+     * {@.ja このファクトリで生成されたオブジェクトのデストラクタを取得する。
+     * obj はこのファクトリで生成されたものでなければならない。予め
+     * isProducerOf() 関数で当該オブジェクトがこのファクトリの生成物で
+     * あるかどうかをチェックしなければならない。}
+     * {@.en This operation returns a destructor of the object created by
+     * the factory.  obj must be a product of the factory.  User must
+     * check if the object is a product of the factory by using
+     * isProducerOf()-function, before using this function.}
+     *
+     * @return 
+     *   {@.ja オブジェクトのデストラクタ}
+     *   {@.en destructor of the object}
+     *
+     */
+    public ObjectDestructor objectToDestructor(ABSTRACTCLASS obj) {
+        return m_objects.get(obj).destructor_;
+    }
+
+    /**
      * {@.ja 生成/削除インターフェース管理用クラス}
      * {@.en Class for creation/destruction interface management}
      */
@@ -343,8 +461,10 @@
          *   {@.ja 削除インターフェース}    
          *   {@.en Destruction interface}    
          */
-        public FactoryEntry(ObjectCreator creator, 
-                                                ObjectDestructor destructor) {
+        public FactoryEntry(IDENTIFIER id,
+                            ObjectCreator creator, 
+                            ObjectDestructor destructor) {
+          id_ = id;
           creator_ = creator;
           destructor_ = destructor;
         }
@@ -358,6 +478,11 @@
          * {@.en Destruction interface variable}
          */
         public ObjectDestructor destructor_;
+        /**
+         * {@.ja }
+         * {@.en }
+         */
+        public IDENTIFIER id_;
     };
     /**
      * {@.ja リターンコード}

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java (from rev 670, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,118 @@
+package jp.go.aist.rtm.RTC;
+
+import OpenRTM.Logger;
+import OpenRTM.LoggerHelper;
+
+import _SDOPackage.NVListHolder;
+
+import jp.go.aist.rtm.RTC.port.CorbaConsumer;
+import jp.go.aist.rtm.RTC.util.CallbackFunction;
+import jp.go.aist.rtm.RTC.util.NVUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+  /**
+   * 
+   * 
+   * 
+   */
+public class LoggerConsumer implements SdoServiceConsumerBase, CallbackFunction, ObjectCreator<SdoServiceConsumerBase>, ObjectDestructor{
+    /**
+     * {@.ja ctor of LoggerConsumer}
+     * {@.en ctor of LoggerConsumer}
+     */
+    public LoggerConsumer(){
+        m_rtobj = null;
+    }
+
+
+    /**
+     * {@.ja 初期化}
+     * {@.en Initialization}
+     */
+    public boolean init(RTObject_impl rtobj,
+                      final _SDOPackage.ServiceProfile profile){
+
+        if (!m_observer.setObject(LoggerHelper.narrow(profile.service))) {
+          // narrowing failed
+          return false;
+        }
+
+        m_rtobj = rtobj;
+        m_profile = profile;
+        //
+        NVListHolder nvholder = 
+                new NVListHolder(profile.properties);
+        Properties prop = new Properties();
+        NVUtil.copyToProperties(prop, nvholder);
+        return true;
+    }
+
+    /**
+     * {@.ja 再初期化}
+     * {@.en Re-initialization}
+     */
+    public boolean reinit(final _SDOPackage.ServiceProfile profile){
+        if (!m_observer._ptr()._is_equivalent(profile.service)) {
+            CorbaConsumer<Logger> tmp = new CorbaConsumer<Logger>();
+            if (!tmp.setObject(profile.service)) {
+                return false;
+            }
+            m_observer.releaseObject();
+            m_observer.setObject(profile.service);
+        }
+        m_profile= profile;
+        //
+        NVListHolder nvholder = 
+                new NVListHolder(profile.properties);
+        Properties prop = new Properties();
+        NVUtil.copyToProperties(prop, nvholder);
+        return true;
+    }
+
+    /**
+     * {@.ja ServiceProfile を取得する}
+     * {@.en getting ServiceProfile}
+     */
+    public final _SDOPackage.ServiceProfile getProfile() {
+        return m_profile;
+    }
+    
+    /**
+     * {@.ja 終了処理}
+     * {@.en Finalization}
+     */
+    public void finalize(){
+    }
+    //============================================================
+    // Heartbeat related functions
+    /**
+     * {@.ja }
+     * {@.en }
+     */
+    public void doOperate(){
+    }
+
+    /**
+     * <p> creator_ </p>
+     * 
+     * @return Object Created instances
+     *
+     */
+    public SdoServiceConsumerBase creator_() {
+        return new ComponentObserverConsumer();
+    }
+    /**
+     * <p> destructor_ </p>
+     * 
+     * @param obj    The target instances for destruction
+     *
+     */
+    public void destructor_(Object obj) {
+        obj = null;
+    }
+    private RTObject_impl m_rtobj;
+    private _SDOPackage.ServiceProfile m_profile;
+    private CorbaConsumer<OpenRTM.Logger> m_observer =
+            new CorbaConsumer<OpenRTM.Logger>(OpenRTM.Logger.class);
+
+};
+

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -963,6 +963,14 @@
             "exec_cxt.periodic.type",
             "exec_cxt.periodic.rate",
             "exec_cxt.evdriven.type",
+            "exec_cxt.sync_transition",
+            "exec_cxt.sync_activation",
+            "exec_cxt.sync_deactivation",
+            "exec_cxt.sync_reset",
+            "exec_cxt.transition_timeout",
+            "exec_cxt.activation_timeout",
+            "exec_cxt.deactivation_timeout",
+            "exec_cxt.reset_timeout",
             "logger.enable",
             "logger.log_level",
             "naming.enable",
@@ -972,8 +980,11 @@
         };
 
         for (int ic=0; inherit_prop[ic].length() != 0; ++ic) {
-            prop.setProperty(inherit_prop[ic], 
-                                m_config.getProperty(inherit_prop[ic]));
+            
+            String key = inherit_prop[ic];
+            if (m_config.findNode(key) != null) {
+                prop.setProperty(key,m_config.getProperty(key));
+            }
         }
 
         comp = factory.create(this);
@@ -2048,7 +2059,7 @@
             
             // Get the POAManager
             m_pPOAManager = m_pPOA.the_POAManager();
-            m_objManager = new CorbaObjectManager(m_pORB, m_pPOA);
+            //m_objManager = new CorbaObjectManager(m_pORB, m_pPOA);
             
         } catch (Exception ex) {
             rtcout.println(Logbuf.DEBUG, 
@@ -2546,7 +2557,8 @@
         
         for (int i=0, len=m_ecs.size(); i < len; ++i) {
             try {
-                m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_ecs.elementAt(i)));
+                //m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_ecs.elementAt(i).getObjRef()));
+                m_pPOA.deactivate_object(m_pPOA.servant_to_id((RTC.ExecutionContextServicePOA)m_ecs.get(i)));
                 
             } catch (Exception e) {
                 rtcout.println(Logbuf.DEBUG, "Exception: Caught unknown Exception in Manager.shutdownComponents().");
@@ -2671,7 +2683,7 @@
             Properties temp = m_config.getNode(category + "." + type_name);
             Vector<String> keys = temp.propertyNames();
             int length = keys.size();
-            if (!(length == 1 && keys.get(length).equals("config_file"))) {
+            if (!(length == 1 && keys.get(length-1).equals("config_file"))) {
                 type_prop.merge(m_config.getNode(category + "." + type_name));
                 rtcout.println(Logbuf.INFO,
                         "Component type conf exists in rtc.conf. Merged.");
@@ -3105,7 +3117,7 @@
      * {@.ja CORBA Object Manager}
      * {@.en CORBA Object Manager}
      */
-    protected CorbaObjectManager m_objManager;
+    //protected CorbaObjectManager m_objManager;
     /**
      * {@.ja Timer Object}
      * {@.en Timer Object}

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java (from rev 673, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,436 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.log.Logbuf;
+
+import RTC.ComponentAction;
+import RTC.ComponentActionHelper;
+import RTC.DataFlowComponentAction;
+import RTC.DataFlowComponentActionHelper;
+import RTC.FsmParticipantAction;
+import RTC.FsmParticipantActionHelper;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.MultiModeComponentAction;
+import RTC.MultiModeComponentActionHelper;
+import RTC.ReturnCode_t;
+
+public class RTObjectStateMachine {
+    private static final int NUM_OF_LIFECYCLESTATE = 4;
+    /**
+     * {@.ja コンストラクタ}
+     * {@.en Constructor}
+     *
+     */
+    public RTObjectStateMachine(int id, LightweightRTObject comp){
+        m_id = id;
+        m_rtobj = (LightweightRTObject)comp._duplicate();
+        m_sm = new StateMachine<LifeCycleState,
+                            RTObjectStateMachine>(NUM_OF_LIFECYCLESTATE);
+        m_ca = false;
+        m_dfc = false;
+        m_fsm = false;
+        m_mode = false;
+        m_caVar   = null;
+        m_dfcVar  = null;
+        m_fsmVar  = null;
+        m_modeVar = null;
+        // Setting Action callback objects
+        setComponentAction(comp);
+        setDataFlowComponentAction(comp);
+        setFsmParticipantAction(comp);
+        setMultiModeComponentAction(comp);
+        // Setting callback functions to StateMachine
+        m_sm.setListener(this);
+        m_sm.setEntryAction (LifeCycleState.ACTIVE_STATE,
+                             new onActivated());
+        m_sm.setDoAction    (LifeCycleState.ACTIVE_STATE,
+                             new onExecute());
+        m_sm.setPostDoAction(LifeCycleState.ACTIVE_STATE,
+                             new onStateUpdate());
+        m_sm.setExitAction  (LifeCycleState.ACTIVE_STATE,
+                             new onDeactivated());
+        m_sm.setEntryAction (LifeCycleState.ERROR_STATE,
+                             new onAborting());
+        m_sm.setDoAction    (LifeCycleState.ERROR_STATE,
+                             new onError());
+        m_sm.setExitAction  (LifeCycleState.ERROR_STATE,
+                             new onReset());
+        // Setting inital state
+        StateHolder<LifeCycleState> st = new StateHolder<LifeCycleState>();
+        st.prev = LifeCycleState.INACTIVE_STATE;
+        st.curr = LifeCycleState.INACTIVE_STATE;
+        st.next = LifeCycleState.INACTIVE_STATE;
+        m_sm.setStartState(st);
+        m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+    }
+    private RTObjectStateMachine(final RTObjectStateMachine rtobjsm){
+    }
+    /**
+     * {@.ja onActivatedアクション定義用抽象クラス}
+     */
+    private class onActivated implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_ca) { 
+                return; 
+            }
+            if (m_caVar.on_activated(m_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+    }
+    /**
+     * {@.ja onExecuteアクション定義用抽象クラス}
+     */
+    private class onExecute implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_dfc) { 
+                return; 
+            }
+            if (m_dfcVar.on_execute(m_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+    }
+    /**
+     * {@.ja onStateUpdateアクション定義用抽象クラス}
+     */
+    private class onStateUpdate implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_dfc) { 
+                return; 
+            }
+            if (m_dfcVar.on_state_update(m_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+    }
+    /**
+     * {@.ja onDeactivatedアクション定義用抽象クラス}
+     */
+    private class onDeactivated implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_ca) { 
+                return; 
+            }
+            m_caVar.on_deactivated(m_id);
+        }
+    }
+    /**
+     * {@.ja onAbortingアクション定義用抽象クラス}
+     */
+    private class onAborting implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_ca) { 
+                return; 
+            }
+            m_caVar.on_error(m_id);
+        }
+    }
+    /**
+     * {@.ja onErrorアクション定義用抽象クラス}
+     */
+    private class onError implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_ca) { 
+                return; 
+            }
+            m_caVar.on_error(m_id);
+        }
+    }
+    /**
+     * {@.ja onResetアクション定義用抽象クラス}
+     */
+    private class onReset implements StateAction {
+        public void doAction(StateHolder state) {
+            if (!m_ca) { 
+                return; 
+            }
+            if (m_caVar.on_reset(m_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+    }
+
+
+    // functions for stored RTObject reference
+    /**
+     *
+     */
+    public LightweightRTObject getRTObject() {
+        return (LightweightRTObject)m_rtobj._duplicate();
+    }
+    /**
+     *
+     */
+    public boolean isEquivalent(LightweightRTObject comp) {
+        return m_rtobj._is_equivalent(comp);
+    }
+    /**
+     *
+     */
+    public int getExecutionContextHandle() {
+        return m_id;
+    }
+
+    // RTC::ComponentAction operations
+    /**
+     *
+     */
+    public void onStartup(){
+        if (!m_ca) { 
+            return; 
+        }
+        m_caVar.on_startup(m_id);
+    }
+    /**
+     *
+     */
+    public void onShutdown(){
+        if (!m_ca) { 
+            return; 
+        }
+        m_caVar.on_shutdown(m_id);
+    }
+    /**
+     *
+     */
+    public void onActivated(final StateHolder<LifeCycleState> st) {
+        if (!m_ca) { 
+            return; 
+        }
+        if (m_caVar.on_activated(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+    /**
+     *
+     */
+    public void onDeactivated(final StateHolder<LifeCycleState> st) {
+        if (!m_ca) { 
+            return; 
+        }
+        m_caVar.on_deactivated(m_id);
+    }
+    /**
+     *
+     */
+    public void onAborting(final StateHolder<LifeCycleState> st) {
+        if (!m_ca) { 
+            return; 
+        }
+        m_caVar.on_error(m_id);
+    }
+    /**
+     *
+     */
+    public void onError(final StateHolder<LifeCycleState> st){
+        if (!m_ca) { 
+            return; 
+        }
+        m_caVar.on_error(m_id);
+    }
+    /**
+     *
+     */
+    public void onReset(final StateHolder<LifeCycleState> st){
+        if (!m_ca) { 
+            return; 
+        }
+        if (m_caVar.on_reset(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+
+    }
+
+    // RTC::DataflowComponentAction
+    /**
+     *
+     */
+    public void onExecute(final StateHolder<LifeCycleState> st){
+        if (!m_dfc) { 
+            return; 
+        }
+        if (m_dfcVar.on_execute(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+    /**
+     *
+     */
+    public void onStateUpdate(final StateHolder<LifeCycleState> st){
+        if (!m_dfc) { 
+            return; 
+        }
+        if (m_dfcVar.on_state_update(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+    /**
+     *
+     */
+    public void onRateChanged(){
+        if (!m_dfc) { 
+            return; 
+        }
+        if (m_dfcVar.on_rate_changed(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+
+    // FsmParticipantAction
+    /**
+     *
+     */
+    public void onAction(final StateHolder<LifeCycleState> st){
+        if (!m_fsm) { 
+            return; 
+        }
+        if (m_fsmVar.on_action(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+
+    // MultiModeComponentAction
+    /**
+     *
+     */
+    public void onModeChanged(final StateHolder<LifeCycleState> st){
+        if (!m_mode) { 
+            return; 
+        }
+        if (m_modeVar.on_mode_changed(m_id) != ReturnCode_t.RTC_OK) {
+            m_sm.goTo(LifeCycleState.ERROR_STATE);
+            return;
+        }
+        return;
+    }
+
+    // Getting state of the context
+    /**
+     *
+     */
+    public LifeCycleState getState(){
+        return m_sm.getState();
+    }
+    /**
+     *
+     */
+    public StateHolder<LifeCycleState> getStates(){
+        return m_sm.getStates();
+    }
+    /**
+     *
+     */
+    public boolean isCurrentState(LifeCycleState state){
+        if(getState() == state){
+            return true;
+        }
+        return false;
+    }
+    /**
+     *
+     */
+    public boolean isNextState(LifeCycleState state){
+        if(m_sm.getStates().next == state){
+            return true;
+        }
+        return false;
+    }
+    /**
+     *
+     */
+    public void goTo(LifeCycleState state){
+        m_sm.goTo(state);
+    }
+    
+    // Workers
+    /**
+     *
+     */
+    public void workerPreDo(){
+        m_sm.worker_pre();
+    }
+    /**
+     *
+     */
+    public void workerDo(){
+        m_sm.worker_do();
+    }
+    /**
+     *
+     */
+    public void workerPostDo(){
+        m_sm.worker_post();
+    }
+
+    protected void setComponentAction(final LightweightRTObject comp) {
+        m_caVar = ComponentActionHelper.narrow(comp);
+        if (m_caVar!=null) { 
+            m_ca = true; 
+        }
+    }
+    protected void setDataFlowComponentAction(final LightweightRTObject comp){
+        m_dfcVar = DataFlowComponentActionHelper.narrow(comp);
+        if (m_dfcVar!=null) { 
+            m_dfc = true; 
+        }
+    }
+    protected void setFsmParticipantAction(final LightweightRTObject comp){
+        m_fsmVar = FsmParticipantActionHelper.narrow(comp);
+        if (m_fsmVar!=null) { 
+            m_fsm = true; 
+        }
+    }
+    protected void setMultiModeComponentAction(final LightweightRTObject comp){
+        m_modeVar = MultiModeComponentActionHelper.narrow(comp);
+        if (m_modeVar!=null) { 
+            m_mode = true; 
+        }
+    }
+
+    /**
+     * {@.ja ロガーストリーム}
+     * {@.en Logger stream}
+     */
+    private Logbuf rtcout;
+    // ExecutionContext id
+    private int m_id;
+    // Associated RTObject reference
+    private LightweightRTObject m_rtobj;
+    // State machine
+    private StateMachine<LifeCycleState,
+                            RTObjectStateMachine> m_sm;
+    private boolean m_ca;
+    private boolean m_dfc;
+    private boolean m_fsm;
+    private boolean m_mode;
+    private ComponentAction          m_caVar;
+    private DataFlowComponentAction  m_dfcVar;
+    private FsmParticipantAction     m_fsmVar;
+    private MultiModeComponentAction m_modeVar;
+
+    //    char dara[1000];
+    // Component action invoker
+    
+}
+

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -1,10 +1,12 @@
 package jp.go.aist.rtm.RTC;
 
 import java.util.Vector;
+import java.util.Set;
 import java.lang.reflect.Method;
 
 import jp.go.aist.rtm.RTC.SDOPackage.Configuration_impl;
 import jp.go.aist.rtm.RTC.executionContext.ExecutionContextBase;
+import jp.go.aist.rtm.RTC.executionContext.ExecutionContextFactory;
 import jp.go.aist.rtm.RTC.port.CorbaPort;
 import jp.go.aist.rtm.RTC.port.InPort;
 import jp.go.aist.rtm.RTC.port.InPortBase;
@@ -657,22 +659,53 @@
       
         String ec_args = new String();
 
+        String ec_type = m_properties.getProperty("exec_cxt.periodic.type");
         ec_args += m_properties.getProperty("exec_cxt.periodic.type");
         ec_args += "?";
         ec_args += "rate=" + m_properties.getProperty("exec_cxt.periodic.rate");
 
+        ExecutionContextFactory<ExecutionContextBase,String> factory 
+                                        = ExecutionContextFactory.instance();
         ExecutionContextBase ec;
+        ec = factory.createObject(ec_type);
+        if (ec == null) {
+            rtcout.println(Logbuf.ERROR,"EC ("
+                                            + ec_type
+                                            + ") creation failed.");
+            Set ecs = ExecutionContextFactory.instance().getIdentifiers();
+            rtcout.println(Logbuf.DEBUG,"Available EC list: "
+                                            + ecs.toString() );
+            return ReturnCode_t.RTC_ERROR;
+/*
+            coil::vstring ecs;
+            ecs = RTC::ExecutionContextFactory::instance().getIdentifiers();
+            RTC_DEBUG(("Available EC list: %s",
+                       coil::flatten(ecs).c_str()));
+            return RTC::RTC_ERROR;
+*/
+        }
+        rtcout.println(Logbuf.DEBUG,"EC (" + ec_type + ") created.");
+//        RTC_DEBUG(("EC (%s) created.", ec_type.c_str()));
+/*
         ec = Manager.instance().createContext(ec_args);
         if (ec == null) {
             return ReturnCode_t.RTC_ERROR;
         }
-        ec.set_rate(Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue());
+*/
+        //ec.getObjRef().set_rate(Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue());
         m_eclist.add(ec);
         ExecutionContextService ecv;
         ecv = ec.getObjRef();
         if (ecv == null) {
+            rtcout.println(Logbuf.ERROR,
+                                    "Getting object reference of ec failed.");
             return ReturnCode_t.RTC_ERROR;
         }
+        double ec_rate = Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue();
+        ecv.set_rate(ec_rate);
+        rtcout.println(Logbuf.DEBUG,"Execution context rate is set to " 
+                                            + ec_rate + ".");
+
         ec.bindComponent(this);
 
         ReturnCode_t ret;
@@ -685,6 +718,7 @@
         // -- entering alive state --
         // at least one EC must be attached
         if (m_ecMine.value.length == 0) {
+            rtcout.println(Logbuf.ERROR, "No EC of this RTC.");
             return ReturnCode_t.PRECONDITION_NOT_MET;
         }
         for(int intIdx=0; intIdx < m_ecMine.value.length; ++intIdx) {
@@ -3915,10 +3949,16 @@
         rtcout.println(Logbuf.TRACE, "RTObject_impl.finalizeContexts()");
 
         for(int i=0, len=m_eclist.size(); i < len; ++i) {
+            m_eclist.get(i).getObjRef().stop();
             try {
-                m_eclist.elementAt(i).stop();
-		m_eclist.elementAt(i).finalizeExecutionContext();
-                m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_eclist.elementAt(i)));
+                RTC.ExecutionContextServicePOA servant;
+                servant = (RTC.ExecutionContextServicePOA)m_eclist.get(i);
+//                m_eclist.elementAt(i).getObjRef().stop();
+//                m_eclist.elementAt(i).finalizeExecutionContext();
+//                m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_eclist.elementAt(i).getObjRef()));
+                rtcout.println(Logbuf.DEBUG, "Deactivating Execution Context.");
+                m_pPOA.deactivate_object(m_pPOA.servant_to_id(servant));
+                rtcout.println(Logbuf.DEBUG, "Deactivating EC done.");
             }
             catch(Exception ex) {
             }

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -412,6 +412,25 @@
     }
 
     /**
+     * {@.ja 状態を取得する}
+     * {@.en Gets states}
+     * <p>
+     * {@.ja 状態情報を取得する。
+     * 現在の状態、1つ前の状態、遷移予定の状態を取得することができる。}
+     * {@.en Get state information.
+     * Get the current state, the previous state and the next state to
+     * be expected to transfer.}
+     *
+     * @return 
+     *   {@.ja 状態情報}
+     *   {@.en State information}
+     *
+     */
+    public StateHolder<STATE> getStates() {
+        return m_states;
+    }
+    
+    /**
      * {@.ja 現在の状態を取得する}
      * {@.en Get current state}
      *
@@ -527,7 +546,66 @@
             }
         }
     }
+    //============================================================
+    // divided worker functions
+    // The following divided worker functions have to be used together.
+    // - worker_pre()
+    // - worker_do()
+    // - worker_post()
+    //
+    public void worker_pre() {
+        StateHolder state;
+        
+        synchronized (m_states) {
+            state = new StateHolder(m_states);
+        }
+        if (state.curr == state.next) {
+            if( m_predo.get(state.curr) != null ) {
+                m_predo.get(state.curr).doAction(state);
+            }
+            return;
+        }
 
+        // State changed
+        if( m_exit.get(state.curr) != null ) {
+            m_exit.get(state.curr).doAction(state);
+        }
+
+        synchronized (m_states) {
+            state = new StateHolder(m_states);
+        }
+        if( state.curr != state.next ) {
+            state.curr = state.next;
+            if( m_entry.get(state.curr)!=null ) {
+                m_entry.get(state.curr).doAction(state);
+            }
+            update_curr((STATE)state.curr);
+        }
+    }
+
+    public void worker_do() {
+        StateHolder state;
+        
+        synchronized (m_states) {
+            state = new StateHolder(m_states);
+        }
+        if( m_do.get(state.curr) != null ) {
+            m_do.get(state.curr).doAction(state);
+        }
+
+    }
+
+    public void worker_post() {
+        StateHolder state;
+        
+        synchronized (m_states) {
+            state = new StateHolder(m_states);
+        }
+        if( m_postdo.get(state.curr) != null ) {
+            m_postdo.get(state.curr).doAction(state);
+        }
+    }
+
     private boolean need_trans() {
         synchronized (m_states) {
             return m_states.curr != m_states.next;

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -6,28 +6,47 @@
 import OpenRTM.ExtTrigExecutionContextServicePOA;
 
 import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+import RTC.ExecutionKind;
 import RTC.ReturnCode_t;
 
 /**
  * <p>Periodic Sampled Data Processing(周期実行用)ExecutionContextのベースとなる
  * 抽象クラスです。</p>
  */
-public abstract class ExecutionContextBase extends
-        ExtTrigExecutionContextServicePOA implements ECNewDeleteFunc {
+//public abstract class ExecutionContextBase 
+// implements ECNewDeleteFunc {
+public interface ExecutionContextBase extends ECNewDeleteFunc {
 
     /**
-     * <p>ExecutionContextの処理を1周期分進めます。</p>
+     * {@.ja ExecutionContextクラスの初期化関数}
+     * {@.en Initialization function of ExecutionContext class}
      */
-    public void tick() throws SystemException {
+    public void init(Properties props);
+/* 
+    public void init(Properties props) {
     }
-    
+*/
     /**
-     * <p>本オブジェクトのExecutionContextServiceとしてのCORBAオブジェクト参照を設定します。</p>
-     * 
-     * @param ref CORBAオブジェクト参照
+     * {@.ja CORBA オブジェクトの設定}
+     * {@.en Sets the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クトを設定する。}
+     * {@.en Sets the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @param ref 
+     *   {@.ja オブジェクトリファレンス}
+     *   {@.en The object reference}
+     *
      */
+    public void setObjRef(final ExecutionContextService ref);
+/* 
     public void setObjRef(final ExecutionContextService ref) {
+        m_profile.setObjRef(ref);
     }
+*/
     
     /**
      * <p> bindComponent </p>
@@ -36,16 +55,114 @@
      * @return ReturnCode_t
      * 
      */
-    public abstract ReturnCode_t bindComponent(RTObject_impl rtc);
+    public ReturnCode_t bindComponent(RTObject_impl rtc);
+//    public abstract ReturnCode_t bindComponent(RTObject_impl rtc);
 
     /**
-     * <p> getObjRef </p>
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
      *
-     * @return ExecutionContextService
-     * 
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
      */
-    public abstract ExecutionContextService getObjRef();
+    public ExecutionContextService getObjRef();
+/* 
+    public ExecutionContextService getObjRef() {
+      return m_profile.getObjRef();
+    }
+*/
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を設定する}
+     * {@.en Set execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を設定す
+     * る。実行周期の変更は、DataFlowComponentAction の
+     * on_rate_changed によって各RTコンポーネントに伝達される。}
+     * {@.en This operation shall set the rate (in hertz) at which this
+     * context’s Active participating RTCs are being called.  If the
+     * execution kind of the context is PERIODIC, a rate change shall
+     * result in the invocation of on_rate_changed on any RTCs
+     * realizing DataFlowComponentAction that are registered with any
+     * RTCs participating in the context.}
+     *
+     * @param rate
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード
+     *         RTC_OK: 正常終了
+     *         BAD_PARAMETER: 設定値が負の値}
+     *   {@.en The return code of ReturnCode_t type
+     *         RTC_OK: Succeed
+     *         BAD_PARAMETER: Invalid value. The value might be negative.}
+     *
+     */
+    public ReturnCode_t setRate(double rate);
+/*
+    public ReturnCode_t setRate(double rate) {
+      return m_profile.setRate(rate);
+    }
+*/
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を取得する}
+     * {@.en Get execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を取得す
+     * る。}
+     * {@.en This operation shall return the rate (in hertz) at which its
+     * Active participating RTCs are being invoked.}
+     *
+     * @return 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     */
+    public double getRate();
+/*  
+    public double getRate()  {
+      return m_profile.getRate();
+    }
+*/
+    /**
+     * {@.ja ExecutionKind を文字列化する}
+     * {@.en Converting ExecutionKind enum to string}
+     * <p>
+     * {@.ja RTC::ExecutionKind で定義されている PERIODIC, EVENT_DRIVEN,
+     * OTHER を文字列化する。}
+     * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+     * OTHER) defined in RTC::ExecutionKind to string.}
+     *
+     * @param kind 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     * @return 
+     *   {@.ja 文字列化されたExecutionKind}
+     *   {@.en String of ExecutionKind}
+     *
+     */
+    public String getKindString(ExecutionKind kind);
+/*
+    public final String getKindString(ExecutionKind kind) {
+      return m_profile.getKindString(kind);
+    }
+*/
+    public boolean finalizeExecutionContext();
+//    public abstract boolean finalizeExecutionContext();
+/*
+    public ExecutionContextProfile m_profile 
+                                    = new ExecutionContextProfile();
+*/
+/*
+    protected ExecutionContextProfile m_profile 
+                                    = new ExecutionContextProfile();
+*/
 
-    public abstract boolean finalizeExecutionContext();
-
 }

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,34 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import jp.go.aist.rtm.RTC.FactoryGlobal;
+/**
+ * {@.ja ExecutionContext用ファクトリの実装}
+ * {@.en Implement of factory for ExecutionContext} 
+ */
+
+public class ExecutionContextFactory<ABSTRACTCLASS,IDENTIFIER> extends FactoryGlobal<ABSTRACTCLASS,IDENTIFIER> {
+
+    /**
+     * {@.ja コンストラクタ。}
+     * {@.en Constructor}
+     */
+    private ExecutionContextFactory() {
+
+    }
+    /**
+     * {@.ja インスタンス生成。}
+     * {@.en Create instance}
+     *
+     * <p>
+     * {@.ja インスタンスを生成する。}
+     *
+     * @return 
+     *   {@.ja インスタンス}
+     *   {@.en ExecutionContextFactory object}
+     *
+     */
+    public static ExecutionContextFactory instance() {
+        return (ExecutionContextFactory)instance("jp.go.aist.rtm.RTC.executionContext.ExecutionContextFactory");
+    }
+}
+

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,571 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
+import jp.go.aist.rtm.RTC.util.equalFunctor;
+import jp.go.aist.rtm.RTC.util.NVUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.TimeValue;
+import RTC.ExecutionContextService;
+//import RTC.ExecutionContextProfile;
+import RTC.ExecutionKind;
+import RTC.ExecutionKindHolder;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
+import RTC.RTCListHolder;
+import RTC.RTObject;
+import RTC.RTObjectHelper;
+import _SDOPackage.NVListHolder;
+  /**
+   * {@.ja ExecutionContextProfile クラス}
+   * {@.en ExecutionContextProfile class}
+   * <p>
+   * {@.ja Periodic Sampled Data Processing(周期実行用)ExecutionContextクラス。}
+   * {@.en Periodic Sampled Data Processing (for the execution cycles)
+   * ExecutionContext class}
+   */
+public class ExecutionContextProfile {
+    public static final double DEEFAULT_PERIOD = 0.000001;
+
+    /**
+     * {@.ja デフォルトコンストラクタ}
+     * {@.en Default Constructor}
+     * <p>
+     * {@.ja デフォルトコンストラクタ
+     * プロファイルに以下の項目を設定する。
+     *  - kind : PERIODIC
+     *  - rate : 0.0}
+     * {@.en Default Constructor
+     * Set the following items to profile.
+     *  - kind : PERIODIC
+     *  - rate : 0.0}
+     */
+    public ExecutionContextProfile(ExecutionKind kind) {
+        rtcout = new Logbuf("periodic_ecprofile");
+        m_period = new TimeValue(DEEFAULT_PERIOD);
+        m_ref = null;
+        rtcout.println(Logbuf.TRACE, "ExecutionContextProfile()");
+        rtcout.println(Logbuf.DEBUG, "Actual rate: "
+                                    + m_period.sec()
+                                    + " [sec], "
+                                    + m_period.usec()
+                                    + " [usec]");
+        // profile initialization
+        m_profile.kind = kind;
+        m_profile.rate = 1.0 / m_period.toDouble();
+        m_profile.owner = null;
+        m_profile.participants = new RTObject[0];
+        m_profile.properties = new _SDOPackage.NameValue[0];
+    }
+    public ExecutionContextProfile(){
+        this(ExecutionKind.PERIODIC);
+    }
+    /**
+     * {@.ja CORBA オブジェクトの設定}
+     * {@.en Sets the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クトを設定する。}
+     * {@.en Sets the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @param ec_ptr 
+     *   {@.ja オブジェクトリファレンス}
+     *   {@.en The object reference}
+     */
+    public void setObjRef(ExecutionContextService ec_ptr){
+        rtcout.println(Logbuf.TRACE, "setObjRef()");
+        synchronized (m_profile){
+            m_ref = (ExecutionContextService)ec_ptr._duplicate();
+        }
+    }
+
+    /**
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
+     */
+    public ExecutionContextService getObjRef(){
+        rtcout.println(Logbuf.TRACE, "getObjRef()");
+        synchronized (m_profile){
+            return (ExecutionContextService)m_ref._duplicate();
+        }
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を設定する}
+     * {@.en Set execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を設定す
+     * る。実行周期の変更は、DataFlowComponentAction の
+     * on_rate_changed によって各RTコンポーネントに伝達される。}
+     * {@.en This operation shall set the rate (in hertz) at which this
+     * context’s Active participating RTCs are being called.  If the
+     * execution kind of the context is PERIODIC, a rate change shall
+     * result in the invocation of on_rate_changed on any RTCs
+     * realizing DataFlowComponentAction that are registered with any
+     * RTCs participating in the context.}
+     *
+     * @param rate 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード
+     *         RTC_OK: 正常終了
+     *         BAD_PARAMETER: 設定値が負の値}
+     *   {@.en The return code of ReturnCode_t type
+     *         RTC_OK: Succeed
+     *         BAD_PARAMETER: Invalid value. The value might be negative.}
+     *
+     */
+    public ReturnCode_t setRate(double rate) {
+        rtcout.println(Logbuf.TRACE, "set_rate("+rate+")");
+        if (rate < 0.0) { 
+            return ReturnCode_t.BAD_PARAMETER; 
+        }
+
+        synchronized (m_profile){
+            m_profile.rate = rate;
+            m_period = new TimeValue(1.0/rate);
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    public ReturnCode_t setPeriod(double period) {
+        rtcout.println(Logbuf.TRACE, "setPeriod("+period+" [sec])");
+        if (period < 0.0) { 
+            return ReturnCode_t.BAD_PARAMETER; 
+        }
+
+        synchronized (m_profile){
+            m_profile.rate = 1.0 / period;
+            m_period = new TimeValue(period);
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    public ReturnCode_t setPeriod(TimeValue period) {
+        rtcout.println(Logbuf.TRACE, "setPeriod("+period.toDouble()+" [sec])");
+        if (period.toDouble() < 0.0) { 
+            return ReturnCode_t.BAD_PARAMETER; 
+        }
+
+        synchronized (m_profile){
+            m_profile.rate = 1.0 / period.toDouble();
+            m_period = period;
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を取得する}
+     * {@.en Get execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を取得す
+     * る。}
+     * {@.en This operation shall return the rate (in hertz) at which its
+     * Active participating RTCs are being invoked.}
+     *
+     * @return 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     */
+    public double getRate() {
+        rtcout.println(Logbuf.TRACE, "get_rate()");
+        synchronized (m_profile){
+            return m_profile.rate;
+        }
+    }
+    public TimeValue getPeriod(){
+        rtcout.println(Logbuf.TRACE, "getPeriod()");
+        synchronized (m_profile){
+            return m_period;
+        }
+    }
+
+    /**
+     * {@.ja ExecutionKind を文字列化する}
+     * {@.en Converting ExecutionKind enum to string }
+     * <p>
+     * {@.ja ExecutionKind で定義されている PERIODIC, EVENT_DRIVEN,
+     * OTHER を文字列化する。}
+     * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+     * OTHER) defined in RTC::ExecutionKind to string.}
+     *
+     * @param kind 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     * @return 
+     *   {@.en 文字列化されたExecutionKind}
+     *   {@.en String of ExecutionKind}
+     *
+     */
+    public final String getKindString(ExecutionKind kind){
+        ExecutionKindHolder ekh = new ExecutionKindHolder(kind);
+        try {
+            return ekh._type().name();
+        }
+        catch(Exception ex) {
+            return "";
+        }
+    }
+    public final String getKindString() {
+      return getKindString(m_profile.kind);
+    }
+
+    /**
+     * {@.ja ExecutionKind を設定する}
+     * {@.en Set the ExecutionKind}
+     * <p>
+     * {@.ja この ExecutionContext の ExecutionKind を設定する}
+     * {@.en This operation sets the kind of the execution context.}
+     *
+     * @param kind 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     *
+     */
+    public ReturnCode_t setKind(ExecutionKind kind) {
+        rtcout.println(Logbuf.TRACE, "setKind("+getKindString(kind)+")");
+        synchronized (m_profile){
+            m_profile.kind = kind;
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+
+    /**
+     * {@.ja ExecutionKind を取得する}
+     * {@.en Get the ExecutionKind}
+     * <p>
+     * {@.ja 本 ExecutionContext の ExecutionKind を取得する}
+     * {@.en This operation shall report the execution kind of the execution
+     * context.}
+     *
+     * @return 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     */
+    public ExecutionKind getKind() {
+        rtcout.println(Logbuf.TRACE, getKindString(m_profile.kind)
+                                        + " = getKind()");
+        return m_profile.kind;
+    }
+
+    /**
+     * {@.ja Ownerコンポーネントをセットする。}
+     * {@.en Setting owner component of the execution context}
+     * <p>
+     * {@.ja このECのOwnerとなるRTCをセットする。}
+     * {@.en This function sets an RT-Component to be owner of the 
+     * execution context.}
+     *
+     * @param comp 
+     *   {@.ja OwnerとなるRTコンポーネント}
+     *   {@.en an owner RT-Component of this execution context}
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     */
+    public ReturnCode_t setOwner(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE, "setOwner()");
+        if (comp==null) {
+            rtcout.println(Logbuf.ERROR,"nil reference is given.");
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+        RTObject rtobj;
+        rtobj = RTObjectHelper.narrow(comp);
+        if (rtobj==null) {
+            rtcout.println(Logbuf.ERROR,"Narrowing failed.");
+            return ReturnCode_t.RTC_ERROR;
+        }
+        m_profile.owner = (RTObject)rtobj._duplicate();
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja Ownerコンポーネントの参照を取得する}
+     * {@.en Getting a reference of the owner component}
+     * <p>
+     * {@.ja このECのOwnerであるRTCの参照を取得する。}
+     * {@.en This function returns a reference of the owner RT-Component of
+     * this execution context}
+     *
+     * @return 
+     *   {@.ja OwnerRTコンポーネントの参照}
+     *   {@.en a reference of the owner RT-Component}
+     */
+    public final RTObject getOwner() {
+        rtcout.println(Logbuf.TRACE, "getOwner()");
+        return (RTObject)m_profile.owner._duplicate();
+    }
+
+    /**
+     * {@.ja RTコンポーネントを追加する}
+     * {@.en Add an RT-component}
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストに追加する。追加されたRTコ
+     * ンポーネントは attach_context が呼ばれ、Inactive 状態に遷移する。
+     * 指定されたRTコンポーネントがnullの場合は、BAD_PARAMETER が返され
+     * る。指定されたRTコンポーネントが DataFlowComponent 以外の場合は、
+     * BAD_PARAMETER が返される。}
+     * {@.en The operation causes the given RTC to begin participating in
+     * the execution context.  The newly added RTC will receive a call
+     * to LightweightRTComponent::attach_context and then enter the
+     * Inactive state.  BAD_PARAMETER will be invoked, if the given
+     * RT-Component is null or if the given RT-Component is other than
+     * DataFlowComponent.}
+     *
+     * @param comp 
+     *   {@.ja 追加対象RTコンポーネント}
+     *   {@.en The target RT-Component for add}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     */
+    public ReturnCode_t addComponent(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE,"addComponent()");
+        if (comp==null) {
+            rtcout.println(Logbuf.ERROR,"A nil reference was given.");
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+        RTObject rtobj = RTObjectHelper.narrow(comp);
+        if (rtobj==null) {
+            rtcout.println(Logbuf.ERROR,"Narrowing was failed.");
+            return ReturnCode_t.RTC_ERROR;
+        }
+        RTCListHolder holder = new RTCListHolder(m_profile.participants);
+        CORBA_SeqUtil.push_back(holder, rtobj);
+        m_profile.participants = holder.value;
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja RTコンポーネントを参加者リストから削除する}
+     * {@.en Remove the RT-Component from participant list}
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストから削除する。削除された
+     * RTコンポーネントは detach_context が呼ばれる。指定されたRTコンポー
+     * ネントが参加者リストに登録されていない場合は、BAD_PARAMETER が返
+     * される。}
+     * {@.en This operation causes a participant RTC to stop participating 
+     * in the execution context.
+     * The removed RTC will receive a call to
+     * LightweightRTComponent::detach_context.
+     * BAD_PARAMETER will be returned, if the given RT-Component is not
+     * participating in the participant list.}
+     *
+     * @param comp 
+     *   {@.ja 削除対象RTコンポーネント}
+     *   {@.en The target RT-Component for delete}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t removeComponent(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE,"removeComponent()");
+        if (comp==null) {
+            rtcout.println(Logbuf.ERROR,"A nil reference was given.");
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+        RTObject rtobj = RTObjectHelper.narrow(comp);
+        if (rtobj==null) {
+            rtcout.println(Logbuf.ERROR,"Narrowing was failed.");
+            return ReturnCode_t.RTC_ERROR;
+        }
+        synchronized (m_profile) {
+            RTCListHolder holder = new RTCListHolder(m_profile.participants); 
+            int index;
+            index = CORBA_SeqUtil.find(holder,
+                                  new find_participant(rtobj));
+            if (index < 0) {
+                rtcout.println(Logbuf.ERROR,
+                            "The given RTObject does not exist in the EC.");
+                return ReturnCode_t.BAD_PARAMETER;
+            }
+            CORBA_SeqUtil.erase(holder, index);
+            m_profile.participants = holder.value;
+        }
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja RTコンポーネントの参加者リストを取得する}
+     * {@.en Getting participant RTC list}
+     * <p>
+     * {@.ja 現在登録されている参加者RTCのリストを取得する。}
+     * {@.en This function returns a list of participant RTC of the 
+     * execution context.}
+     *
+     * @return 
+     *   {@.ja 参加者RTCのリスト}
+     *   {@.en Participants RTC list}
+     *
+     */
+    public final RTObject[] getComponentList() {
+        rtcout.println(Logbuf.TRACE,"getComponentList("
+                                    + m_profile.participants.length
+                                    +")");
+        return m_profile.participants;
+    }
+
+    /**
+     * {@.ja Propertiesをセットする}
+     * {@.en Setting Properties}
+     * <p>
+     * {@.ja ExecutionContextProfile::properties をセットする。}
+     * {@.en This function sets ExecutionContextProfile::properties by
+     * Properties.}
+     *
+     * @param props 
+     *   {@.ja ExecutionContextProfile::properties にセットするプロパティー}
+     *   {@.en Properties to be set to ExecutionContextProfile::properties.}
+     */
+    public void setProperties(Properties props) {
+        rtcout.println(Logbuf.TRACE,"setProperties()");
+        String str = new String();
+        str = props._dump(str,props,0);
+        rtcout.println(Logbuf.TRACE,str);
+        synchronized (m_profile) {
+            NVListHolder holder = new NVListHolder(m_profile.properties);
+            NVUtil.copyFromProperties(holder, props);
+            m_profile.properties = holder.value;
+        }
+    }
+
+    /**
+     * {@.ja Propertiesを取得する}
+     * {@.en Setting Properties}
+     * <p>
+     * {@.ja ExecutionContextProfile::properties を取得する。}
+     *
+     * @return
+     *   {@.ja Propertiesに変換されたExecutionContextProfile::properties}
+     *   {@.en This function sets ExecutionContextProfile::properties by
+     * Properties.}
+     *
+     */
+    public final Properties getProperties() {
+        rtcout.println(Logbuf.TRACE,"getProperties()");
+        Properties props  = new Properties(); 
+        synchronized (m_profile) {
+            NVListHolder holder = new NVListHolder(m_profile.properties);
+            NVUtil.copyToProperties(props, holder);
+            String str = new String();
+            str = props._dump(str,props,0);
+            rtcout.println(Logbuf.TRACE,str);
+        }
+        return props;
+    }
+
+    /**
+     * {@.ja Profileを取得する}
+     * {@.en Getting Profile}
+     * <p>
+     * {@.ja RTC::ExecutionContextProfile を取得する。取得した
+     * ExecutionContextProfile の所有権は呼び出し側にある。取得されたオ
+     * ブジェクトが不要になった場合、呼び出し側が開放する責任を負う。}
+     * {@.en This function gets RTC::ExecutionContextProfile.  The ownership
+     * of the obtained ExecutionContextProfile is given to caller. The
+     * caller should release obtained object when it is unneccessary
+     * anymore.}
+     *
+     * @return 
+     *   {@.ja RTC::ExecutionContextProfile}
+     *   {@.en RTC::ExecutionContextProfile}
+     *
+     */
+    public RTC.ExecutionContextProfile getProfile() {
+        rtcout.println(Logbuf.TRACE,"getProfile()");
+        RTC.ExecutionContextProfile p;
+        synchronized (m_profile){
+            p = new RTC.ExecutionContextProfile(m_profile.kind,
+                                                m_profile.rate,
+                                                m_profile.owner,
+                                                m_profile.participants,
+                                                m_profile.properties);
+        }
+        return p;
+    
+    }
+
+
+    /**
+     * {@.ja ExecutionContextProfileをロックする}
+     * {@.en Getting a lock of RTC::ExecutionContextProfile}
+     * <p>
+     * {@.ja このオブジェクトが管理する RTC::ExecutionContextProfile をロックする。
+     * ロックが不要になった際にはunlock()でロックを解除しなければならない。}
+     * {@.en This function locks  RTC::ExecutionContextProfile in the object.
+     * The lock should be released when the lock is unneccessary.}
+     *
+     */
+    public void lock() {
+        //m_profileMutex.lock();
+    } 
+
+    /**
+     * {@.ja ExecutionContextProfileをアンロックする}
+     * {@.en Release a lock of the RTC::ExecutionContextProfile}
+     * <p>
+     * {@.ja このオブジェクトが管理する RTC::ExecutionContextProfile をアンロッ
+     * クする。}
+     * {@.en This function release the lock of RTC::ExecutionContextProfile
+     * in the object.}
+     *
+     */
+    public void unlock() {
+        //m_profileMutex.unlock();
+    }
+
+    /**
+     * {@.ja Logger}
+     * {@.en Logger}
+     */
+    private Logbuf rtcout;
+    /**
+     * {@.ja ECProfile}
+     * {@.en ECProfile}
+     */
+    private RTC.ExecutionContextProfile m_profile 
+                                        = new RTC.ExecutionContextProfile();
+
+    /**
+     * {@.ja mutex of ExecutionContextProfile}
+     * {@.en mutex ExecutionContextProfile}
+     */
+    //private String m_profileMutex = new String();
+
+    /**
+     * {@.ja ExecutionContext の実行周期}
+     * {@.en Execution cycle of ExecutionContext}
+     */
+    private TimeValue m_period;
+
+    /**
+     * {@.ja ExecutionContextService オブジェクトへの参照}
+     * {@.en Reference to ExecutionContextService object}
+     */
+    private ExecutionContextService m_ref;
+
+    private class find_participant  implements equalFunctor {
+        private RTObject m_comp;
+        public find_participant(RTObject comp) {
+            m_comp = (RTObject)comp._duplicate();
+        }
+        public boolean equalof(final java.lang.Object comp) {
+            return m_comp._is_equivalent((RTObject)comp);
+        }
+    };
+}; // class ExecutionContextProfile

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java (from rev 673, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,700 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.RTObjectStateMachine;
+import jp.go.aist.rtm.RTC.util.TimeValue;
+import jp.go.aist.rtm.RTC.log.Logbuf;
+
+import RTC.ExecutionContextService;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
+  /**
+   * {@.ja PeriodicExecutionContext クラス}
+   * {@.en PeriodicExecutionContext class}
+   * <p>
+   * {@.ja Periodic Sampled Data Processing(周期実行用)ExecutionContextクラス。}
+   * {@.en Periodic Sampled Data Processing (for the execution cycles)
+   * ExecutionContext class}
+   */
+public class ExecutionContextWorker {
+
+    /**
+     * {@.ja デフォルトコンストラクタ}
+     * {@.en Default Constructor}
+     * <p>
+     * {@.ja デフォルトコンストラクタ
+     * プロファイルに以下の項目を設定する。
+     *  - kind : PERIODIC
+     *  - rate : 0.0}
+     * {@.en Default Constructor
+     * Set the following items to profile.
+     *  - kind : PERIODIC
+     *  - rate : 0.0}
+     */
+    public ExecutionContextWorker() {
+        rtcout = new Logbuf("ec_worker");
+        m_running = false;
+        rtcout.println(Logbuf.TRACE, "ExecutionContextWorker()");
+    }
+    //============================================================
+    // Object reference to EC
+    //============================================================
+    public void setECRef(ExecutionContextService ref) {
+        m_ref = (ExecutionContextService)ref._duplicate();
+    }
+    public ExecutionContextService getECRef(){
+        return (ExecutionContextService)m_ref._duplicate();
+    }
+
+    //============================================================
+    // ExecutionContext
+    //============================================================
+    /**
+     * {@.ja ExecutionContext 実行状態確認関数}
+     * {@.en Check for ExecutionContext running state}
+     * <p>
+     * {@.ja この操作は ExecutionContext が Runnning 状態の場合に true を返す。
+     * Executioncontext が Running の間、当該 Executioncontext に参加し
+     * ている全てのアクティブRTコンポーネントが、ExecutionContext の実
+     * 行種類に応じて実行される。}
+     * {@.en This operation shall return true if the context is in the
+     * Running state.  While the context is Running, all Active RTCs
+     * participating in the context shall be executed according to the
+     * context’s execution kind.}
+     *
+     * @return 
+     *   {@.ja 状態確認関数(動作中:true、停止中:false)}
+     *   {@.en  Check state function (Running:true、Stopping:false)}
+     *
+     */
+    public boolean isRunning() {
+        rtcout.println(Logbuf.TRACE, "isRunning()");
+        return m_running;
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行を開始}
+     * {@.en Start the ExecutionContext}
+     * <p>
+     * {@.ja ExecutionContext の実行状態を Runnning とするためのリクエストを
+     * 発行する。ExecutionContext の状態が遷移すると
+     * ComponentAction::on_startup が呼び出される。参加しているRTコンポー
+     * ネントが、初期化されるまで ExecutionContext を開始することはでき
+     * ない。ExecutionContext は複数回開始/停止を繰り返すことができる。}
+     * {@.en Request that the context enter the Running state.  Once the
+     * state transition occurs, the ComponentAction::on_startup
+     * operation will be invoked.  An execution context may not be
+     * started until the RT-Components that participate in it have
+     * been initialized.  An execution context may be started and
+     * stopped multiple times.}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t start() {
+        rtcout.println(Logbuf.TRACE, "start()");
+        synchronized (m_mutex){
+            if (m_running) {
+                rtcout.println(Logbuf.WARN, 
+                                        "ExecutionContext is already running.");
+                return ReturnCode_t.PRECONDITION_NOT_MET;
+            }
+            // invoke ComponentAction::on_startup for each comps.
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                m_comps.get(ic).onStartup();
+            }
+            rtcout.println(Logbuf.DEBUG, m_comps.size()
+                                        + " components started.");
+            // change EC thread state
+            m_running = true;
+    
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行を停止}
+     * {@.en Stop the ExecutionContext}
+     * <p>
+     * {@.ja ExecutionContext の状態を Stopped とするためのリクエストを発行す
+     * る。遷移が発生した場合は、ComponentAction::on_shutdown が呼び出
+     * される。参加しているRTコンポーネントが終了する前に
+     * ExecutionContext を停止する必要がある。ExecutionContext は複数回
+     * 開始/停止を繰り返すことができる。}
+     * {@.en Request that the context enter the Stopped state.  Once the
+     * transition occurs, the ComponentAction::on_shutdown operation
+     * will be invoked.  An execution context must be stopped before
+     * the RT components that participate in it are finalized.  An
+     * execution context may be started and stopped multiple times.}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t stop(){
+        rtcout.println(Logbuf.TRACE, "stop()");
+        synchronized (m_mutex){
+            if (!m_running) {
+                rtcout.println(Logbuf.WARN, 
+                                "ExecutionContext is already stopped.");
+                return ReturnCode_t.PRECONDITION_NOT_MET;
+              }
+            // stop thread
+            m_running = false;
+
+            // invoke on_shutdown for each comps.
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                m_comps.get(ic).onShutdown();
+            }
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+
+    /**
+     * {@.ja RTコンポーネントをアクティブ化する}
+     * {@.en Activate an RT-component}
+     * <p>
+     * {@.ja Inactive 状態にあるRTコンポーネントをActive に遷移させ、アクティ
+     * ブ化する。この操作が呼ばれた結果、on_activate が呼び出される。指
+     * 定したRTコンポーネントが参加者リストに含まれない場合は、
+     * BAD_PARAMETER が返される。指定したRTコンポーネントの状態が
+     * Inactive 以外の場合は、PRECONDITION_NOT_MET が返される。}
+     * {@.en The given participant RTC is Inactive and is therefore not
+     * being invoked according to the execution context’s execution
+     * kind. This operation shall cause the RTC to transition to the
+     * Active state such that it may subsequently be invoked in this
+     * execution context.  The callback on_activate shall be called as
+     * a result of calling this operation. This operation shall not
+     * return until the callback has returned, and shall result in an
+     * error if the callback does.}
+     *
+     * @param comp 
+     *   {@.ja アクティブ化対象RTコンポーネント}
+     *   {@.en The target RT-Component for activation}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t activateComponent(LightweightRTObject comp,
+                                        RTObjectStateMachine rtobj) {
+        rtcout.println(Logbuf.TRACE, "activateComponent()");
+        synchronized (m_mutex){
+            RTObjectStateMachine obj = findComponent(comp);
+            if (obj == null) {
+                rtcout.println(Logbuf.ERROR, 
+                                "Given RTC is not participant of this EC.");
+                return ReturnCode_t.BAD_PARAMETER;
+            }
+            rtcout.println(Logbuf.DEBUG, "Component found in the EC.");
+            if (!(obj.isCurrentState(LifeCycleState.INACTIVE_STATE))) {
+                rtcout.println(Logbuf.ERROR, 
+                                "State of the RTC is not INACTIVE_STATE.");
+                return ReturnCode_t.PRECONDITION_NOT_MET;
+            }
+            rtcout.println(Logbuf.DEBUG,
+                    "Component is in INACTIVE state. Going to ACTIVE state.");
+            obj.goTo(LifeCycleState.ACTIVE_STATE);
+            rtobj = obj;
+            rtcout.println(Logbuf.DEBUG,"activateComponent() done.");
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+                                           TimeValue timeout,
+                                           long cycle) {
+        return ReturnCode_t.RTC_OK;
+    }
+    public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj) {
+        return waitActivateComplete(rtobj,new TimeValue(1.0),1000);
+    }
+    public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+                                           TimeValue timeout ) {
+        return waitActivateComplete(rtobj,timeout,1000);
+    };
+    public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+                                           long cycle) {
+        return waitActivateComplete(rtobj,new TimeValue(1.0),cycle);
+    }
+    /**
+     * {@.ja RTコンポーネントを非アクティブ化する}
+     * {@.en Deactivate an RT-component}
+     * <p>
+     * {@.ja Inactive 状態にあるRTコンポーネントを非アクティブ化し、Inactive
+     * に遷移させる。この操作が呼ばれた結果、on_deactivate が呼び出され
+     * る。指定したRTコンポーネントが参加者リストに含まれない場合は、
+     * BAD_PARAMETER が返される。指定したRTコンポーネントの状態が
+     * Active 以外の場合は、PRECONDITION_NOT_MET が返される。}
+     * {@.en The given RTC is Active in the execution context. Cause it to
+     * transition to the Inactive state such that it will not be
+     * subsequently invoked from the context unless and until it is
+     * activated again.  The callback on_deactivate shall be called as
+     * a result of calling this operation. This operation shall not
+     * return until the callback has returned, and shall result in an
+     * error if the callback does.}
+     *
+     * @param comp 
+     *   {@.ja 非アクティブ化対象RTコンポーネント}
+     *   {@.en The target RT-Component for deactivate}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t deactivateComponent(LightweightRTObject comp,
+                                          RTObjectStateMachine rtobj){
+        rtcout.println(Logbuf.TRACE, "deactivateComponent()");
+        synchronized (m_mutex){
+            rtobj = findComponent(comp);
+            if (rtobj == null) {
+                rtcout.println(Logbuf.ERROR, 
+                                "Given RTC is not participant of this EC.");
+                return ReturnCode_t.BAD_PARAMETER;
+            }
+            if (!(rtobj.isCurrentState(LifeCycleState.ACTIVE_STATE))) {
+                rtcout.println(Logbuf.ERROR, 
+                                "State of the RTC is not ACTIVE_STATE.");
+                return ReturnCode_t.PRECONDITION_NOT_MET;
+              }
+            rtobj.goTo(LifeCycleState.INACTIVE_STATE);
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+                                             TimeValue timeout,
+                                             long cycle) {
+        return ReturnCode_t.RTC_OK;
+    }
+    public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+                                             TimeValue timeout) {
+        return waitDeactivateComplete(rtobj,timeout,1000);
+    }
+    public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+                                             long cycle){
+        return waitDeactivateComplete(rtobj,new TimeValue(1.0),cycle);
+    }
+    public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj){
+        return waitDeactivateComplete(rtobj, new TimeValue(1.0),1000);
+    }
+
+    /**
+     * {@.ja RTコンポーネントをリセットする}
+     * {@.en Reset the RT-component}
+     * <p>
+     * {@.ja Error 状態のRTコンポーネントの復帰を試みる。この操作が呼ばれた結
+     * 果、on_reset が呼び出される。指定したRTコンポーネントが参加者リ
+     * ストに含まれない場合は、BAD_PARAMETER が返される。指定したRTコン
+     * ポーネントの状態が Error 以外の場合は、PRECONDITION_NOT_MET が返
+     * される。}
+     * {@.en Attempt to recover the RTC when it is in Error.  The
+     * ComponentAction::on_reset callback shall be invoked. This
+     * operation shall not return until the callback has returned, and
+     * shall result in an error if the callback does. If possible, the
+     * RTC developer should implement that callback such that the RTC
+     * may be returned to a valid state.}
+     *
+     * @param comp 
+     *   {@.ja リセット対象RTコンポーネント}
+     *   {@.en The target RT-Component for reset}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t resetComponent(LightweightRTObject comp,
+                                     RTObjectStateMachine rtobj) {
+        rtcout.println(Logbuf.TRACE, "resetComponent()");
+        synchronized (m_mutex){
+
+            rtobj = findComponent(comp);
+            if (rtobj == null) {
+                rtcout.println(Logbuf.ERROR, 
+                                "Given RTC is not participant of this EC.");
+                return ReturnCode_t.BAD_PARAMETER;
+              }
+            if (!(rtobj.isCurrentState(LifeCycleState.ERROR_STATE))) {
+                rtcout.println(Logbuf.ERROR, 
+                                "State of the RTC is not ERROR_STATE.");
+                return ReturnCode_t.PRECONDITION_NOT_MET;
+              }
+            rtobj.goTo(LifeCycleState.INACTIVE_STATE);
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+                                        TimeValue timeout,
+                                        long cycle) {
+        return ReturnCode_t.RTC_OK;
+    }
+    public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+                                        TimeValue timeout){
+        return waitResetComplete(rtobj, timeout, 1000);
+    }
+    public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+                                        long cycle) {
+        return waitResetComplete(rtobj, new TimeValue(1.0), cycle);
+    }
+    public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj) {
+        return waitResetComplete(rtobj, new TimeValue(1.0), 1000);
+    }
+
+    /**
+     * {@.ja RTコンポーネントの状態を取得する}
+     * {@.en Get RT-component's state}
+     * <p>
+     * {@.ja 指定したRTコンポーネントの状態(LifeCycleState)を取得する。指定し
+     * たRTコンポーネントが参加者リストに含まれない場合は、
+     * UNKNOWN_STATE が返される。}
+     * {@.en This operation shall report the LifeCycleState of the given
+     * participant RTC.  UNKNOWN_STATE will be returned, if the given
+     * RT-Component is not inclued in the participant list.}
+     *
+     * @param comp 
+     *   {@.ja 状態取得対象RTコンポーネント}
+     *   {@.en The target RT-Component to get the state}
+     *
+     * @return 
+     *   {@.ja 現在の状態(LifeCycleState)}
+     *   {@.en The current state of the target RT-Component(LifeCycleState)}
+     *
+     */
+    public LifeCycleState getComponentState(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE, "getComponentState()");
+        synchronized (m_mutex){
+            RTObjectStateMachine rtobj = findComponent(comp);
+            if (rtobj == null) {
+                rtcout.println(Logbuf.WARN,
+                                "Given RTC is not participant of this EC.");
+                return LifeCycleState.CREATED_STATE;
+            }
+            LifeCycleState state = rtobj.getState();
+            rtcout.println(Logbuf.DEBUG,
+                                "getComponentState() = "
+                                 + getStateString(state) 
+                                 + " done" );
+            return state;
+        }
+    }
+    public final String getStateString(LifeCycleState state) {
+      final String st[] = {
+        "CREATED_STATE",
+        "INACTIVE_STATE",
+        "ACTIVE_STATE",
+        "ERROR_STATE"
+      };
+        return st[state.value()]; 
+    }
+    /**
+     * {@.ja RTコンポーネントを追加する}
+     * {@.en Add an RT-component}
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストに追加する。追加されたRTコ
+     * ンポーネントは attach_context が呼ばれ、Inactive 状態に遷移する。
+     * 指定されたRTコンポーネントがnullの場合は、BAD_PARAMETER が返され
+     * る。指定されたRTコンポーネントが DataFlowComponent 以外の場合は、
+     * BAD_PARAMETER が返される。}
+     * {@.en The operation causes the given RTC to begin participating in
+     * the execution context.  The newly added RTC will receive a call
+     * to LightweightRTComponent::attach_context and then enter the
+     * Inactive state.  BAD_PARAMETER will be invoked, if the given
+     * RT-Component is null or if the given RT-Component is other than
+     * DataFlowComponent.}
+     *
+     * @param comp 
+     *   {@.ja 追加対象RTコンポーネント}
+     *   {@.en The target RT-Component for add}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t addComponent(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE, "addComponent()");
+        if (comp==null) {
+            rtcout.println(Logbuf.ERROR, "nil reference is given.");
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+        try {
+            synchronized (m_mutex){
+                ExecutionContextService ec = getECRef();
+                int id = comp.attach_context(ec);
+                m_addedComps.add(new RTObjectStateMachine(id, comp));
+            }
+        }
+        catch (Exception ex) {
+            rtcout.println(Logbuf.ERROR, "addComponent() failed.");
+            return ReturnCode_t.RTC_ERROR;
+        }
+        rtcout.println(Logbuf.DEBUG, "addComponent() succeeded.");
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja コンポーネントをバインドする。}
+     * {@.en Bind the component.}
+     * <p>
+     * {@.ja コンポーネントをバインドする。}
+     * {@.en Bind the component.}
+     *
+     * @param rtc 
+     *   {@.ja RTコンポーネント}
+     *   {@.en RT-Component's instances}
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     */
+    public ReturnCode_t bindComponent(RTObject_impl rtc) {
+        rtcout.println(Logbuf.TRACE, "bindComponent()");
+        synchronized (m_mutex){
+            if (rtc == null) {
+                rtcout.println(Logbuf.ERROR, "NULL pointer is given.");
+                return ReturnCode_t.BAD_PARAMETER;
+            }
+            ExecutionContextService ec = getECRef();
+            int id = rtc.bindContext(ec);
+            if (id < 0 || id > RTObject_impl.ECOTHER_OFFSET) {
+                // id should be owned context id < ECOTHER_OFFSET
+                rtcout.println(Logbuf.ERROR, 
+                                "bindContext returns invalid id: "+id);
+                return ReturnCode_t.RTC_ERROR;
+            }
+            rtcout.println(Logbuf.DEBUG,
+                                "bindContext returns id = "+id);
+    
+            // rtc is owner of this EC
+            LightweightRTObject comp
+              = (LightweightRTObject)rtc.getObjRef()._duplicate();
+            //    RTObjectStateMachine o(id, comp);
+            m_comps.add(new RTObjectStateMachine(id, comp));
+            rtcout.println(Logbuf.DEBUG,"bindComponent() succeeded.");
+            return ReturnCode_t.RTC_OK;
+        }
+    }
+    /**
+     * {@.ja RTコンポーネントを参加者リストから削除する}
+     * {@.en Remove the RT-Component from participant list}
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストから削除する。削除された
+     * RTコンポーネントは detach_context が呼ばれる。指定されたRTコンポー
+     * ネントが参加者リストに登録されていない場合は、BAD_PARAMETER が返
+     * される。}
+     * {@.en This operation causes a participant RTC to stop participating 
+     * in the execution context.
+     * The removed RTC will receive a call to
+     * LightweightRTComponent::detach_context.
+     * BAD_PARAMETER will be returned, if the given RT-Component is not 
+     * participating in the participant list.}
+     *
+     * @param comp 
+     *   {@.ja 削除対象RTコンポーネント}
+     *   {@.en The target RT-Component for delete}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t removeComponent(LightweightRTObject comp) {
+        rtcout.println(Logbuf.TRACE,"removeComponent()");
+        if (comp==null) {
+            rtcout.println(Logbuf.ERROR,"nil reference is given.");
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+
+        synchronized (m_mutex){
+            RTObjectStateMachine rtobj = findComponent(comp);
+    
+            if (rtobj == null) {
+                rtcout.println(Logbuf.ERROR,
+                                "no RTC found in this context.");
+                return  ReturnCode_t.BAD_PARAMETER;
+            }
+            synchronized (m_removedMutex){
+                m_removedComps.add(rtobj);
+
+                return ReturnCode_t.RTC_OK;
+            }
+        }
+    }
+    public RTObjectStateMachine findComponent(LightweightRTObject comp) {
+        for (int ic=0; ic < m_comps.size() ; ++ic) {
+            if(m_comps.get(ic).isEquivalent(comp)) {
+                return m_comps.get(ic);
+            }
+        }
+        return null;
+    }
+
+    public boolean isAllCurrentState(LifeCycleState state) {
+        synchronized (m_mutex){
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                if (!m_comps.get(ic).isCurrentState(state)) { 
+                    return false; 
+                }
+            }
+            return true; 
+        }
+    }
+    public boolean isAllNextState(LifeCycleState state){
+        synchronized (m_mutex){
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                if (!m_comps.get(ic).isNextState(state)) { 
+                    return false; 
+                }
+            }
+            return true;
+        }
+    }
+    public boolean isOneOfCurrentState(LifeCycleState state){
+        synchronized (m_mutex){
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                if (m_comps.get(ic).isCurrentState(state)) { 
+                    return true; 
+                }
+            }
+            return false; 
+        }
+    }
+    public boolean isOneOfNextState(LifeCycleState state){
+        synchronized (m_mutex){
+            for (int ic=0; ic < m_comps.size(); ++ic) {
+                if (m_comps.get(ic).isNextState(state)) { 
+                    return true; 
+                }
+            }
+            return false;
+        }
+    }
+
+    public void invokeWorker(){
+        rtcout.println(Logbuf.PARANOID,"invokeWorker()");
+        // m_comps never changes its size here
+        int  len = m_comps.size();
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerPreDo();  
+        }
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerDo();     
+        }
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerPostDo(); 
+        }
+        updateComponentList();
+    }
+    public void invokeWorkerPreDo(){
+        rtcout.println(Logbuf.PARANOID,"invokeWorkerPreDo()");
+        // m_comps never changes its size here
+        int len = m_comps.size();
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerPreDo();  
+        }
+    }
+    public void invokeWorkerDo(){
+        rtcout.println(Logbuf.PARANOID,"invokeWorkerDo()");
+        // m_comps never changes its size here
+        int len = m_comps.size();
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerDo();     
+        }
+    }
+    public void invokeWorkerPostDo(){
+        rtcout.println(Logbuf.PARANOID,"invokeWorkerPostDo()");
+        // m_comps never changes its size here
+        int len = m_comps.size();
+        for (int ic=0; ic < len; ++ic) { 
+            m_comps.get(ic).workerPostDo(); 
+        }
+        // m_comps might be changed here
+        updateComponentList();
+    }
+ 
+    
+    
+    protected void updateComponentList() {
+        synchronized (m_mutex) {
+            synchronized (m_addedMutex) {// adding component
+                for (int ic=0; ic < m_addedComps.size(); ++ic) {
+                    m_comps.add(m_addedComps.get(ic));
+                    rtcout.println(Logbuf.TRACE,"Component added.");
+                }
+                m_addedComps.clear();
+            }
+            synchronized (m_removedMutex) {// removing component
+                for (int ic=0; ic < m_removedComps.size(); ++ic) {
+                    RTObjectStateMachine rtobj = m_removedComps.get(ic);
+                    LightweightRTObject lwrtobj = rtobj.getRTObject();
+                    lwrtobj.detach_context(rtobj.getExecutionContextHandle());
+                    Iterator it = m_comps.iterator();
+                    while (it.hasNext()) {
+                        if(rtobj == (RTObjectStateMachine)it.next()){
+                            m_comps.remove(it);
+                        }
+                    }
+                    rtobj = null;
+                    rtcout.println(Logbuf.TRACE,"Component deleted.");
+                }
+                m_removedComps.clear();
+            }
+        }
+    }
+
+
+
+    /*!
+     * @if jp
+     * @brief コンポーネント検索用ファンクタ
+     * @else
+     * @brief Functor to find the component
+     * @endif
+     */
+//    struct find_comp
+//    {
+//      RTC::LightweightRTObject_var m_comp;
+//      find_comp(RTC::LightweightRTObject_ptr comp)
+//        : m_comp(RTC::LightweightRTObject::_duplicate(comp)) {}
+//      boolean operator()(RTObjectStateMachine* comp)
+//      {
+//        return comp->isEquivalent(m_comp);
+//      }
+//    };
+
+    //------------------------------------------------------------
+    // member variables
+    /**
+     * {@.ja ロガーストリーム}
+     * {@.en Logger stream}
+     */
+    protected Logbuf rtcout;
+
+    protected ExecutionContextService m_ref;
+
+    /**
+     * {@.ja ExecutionContext の実行状態}
+     * {@.en The running state of ExecutionContext}
+     * true: running, false: stopped
+     */
+    protected boolean m_running;
+
+    /**
+     * {@.ja コンポーネントの参加者リスト}
+     * {@.en List of the participating component}
+     */
+    protected ArrayList<RTObjectStateMachine> m_comps;
+    protected String m_mutex;
+    protected ArrayList<RTObjectStateMachine> m_addedComps;
+    protected String m_addedMutex;
+    ArrayList<RTObjectStateMachine> m_removedComps;
+    protected String m_removedMutex;
+
+}; 

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -1,10 +1,31 @@
 package jp.go.aist.rtm.RTC.executionContext;
 
+import java.util.ArrayList;
+
 import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.StateAction;
+import jp.go.aist.rtm.RTC.StateHolder;
+import jp.go.aist.rtm.RTC.StateMachine;
 import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.util.POAUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
 import jp.go.aist.rtm.RTC.util.TimeValue;
 
 import org.omg.CORBA.SystemException;
+
+import OpenRTM.ExtTrigExecutionContextServicePOA;
+import OpenRTM.ExtTrigExecutionContextServiceHelper;
+import OpenRTM.DataFlowComponent;
+import OpenRTM.DataFlowComponentHelper;
+import RTC.ExecutionContextService;
+import RTC.ExecutionContextServiceHelper;
+import RTC.ExecutionKind;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
 /**
  * {@.ja ステップ実行が可能な ExecutionContext クラス}
  * {@.en ExecutionContext class that enables one step execution}
@@ -17,7 +38,8 @@
  * Time(Tick) advances one cycle by invoking method externally.}
  */
 public class ExtTrigExecutionContext
-        extends PeriodicExecutionContext implements Runnable {
+extends ExtTrigExecutionContextServicePOA 
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase{
 
     /**
      * {@.ja コンストラクタ}
@@ -27,12 +49,57 @@
         super();
 
         rtcout = new Logbuf("Manager.ExtTrigExecutionContext");
+        m_profile.setObjRef((ExecutionContextService)this.__this());
 
     }
     
     /**
-     * <p>ExecutionContextの処理を1周期分進めます。</p>
+     * <p> __this() </p>
+     *
+     * @return ExecutionContextService
      */
+
+    public ExecutionContextService __this() {
+
+        if (this.m_ref == null) {
+            try {
+                this.m_ref = ExtTrigExecutionContextServiceHelper.narrow(POAUtil.getRef(this));
+                
+            } catch (Exception e) {
+                throw new IllegalStateException(e);
+            }
+        }
+
+        return this.m_ref;
+    }
+    /**
+     * <p>終了処理用関数</p>
+     */
+    public boolean finalizeExecutionContext() {
+        synchronized (m_worker) {
+            //m_worker.running_ = true;
+            m_worker.notifyAll();
+        }
+	m_svc = false;
+	try {
+	    m_thread.join();
+	}
+	catch   (InterruptedException e) {
+	    System.out.println(e);
+	}
+	
+	return true;
+    }
+
+    /**
+     * {@.ja ExecutionContextの処理を進める}
+     * {@.en Proceed with tick of ExecutionContext}
+     *
+     * <p>
+     * {@.ja ExecutionContextの処理を1周期分進めます。}
+     * {@.en Proceed with tick of ExecutionContext for one period.}
+     *
+     */
     public void tick() throws SystemException {
 
         rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.tick()");
@@ -44,13 +111,25 @@
     }
 
     /**
+     * <p>ExecutionContext用のスレッドを生成します。</p>
+     */
+    public int open() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.open()");
+
+        if(m_thread==null) {
+            m_thread = new Thread(this, "ExtTrigExecutionContext");
+            m_thread.start();
+        }
+        return 0;
+    }
+    /**
      * <p>ExecutionContextにattachされている各Componentの処理を呼び出します。
      * 全Componentの処理を呼び出した後、次のイベントが発生するまで休止します。</p>
      */
     public int svc() {
 
         rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.svc()");
-
         do {
             TimeValue tv = new TimeValue(0, m_usec); // (s, us)
 
@@ -65,8 +144,9 @@
                 if (m_worker._called) {
                     m_worker._called = false;
                     for (int intIdx = 0; intIdx < m_comps.size(); ++intIdx) {
-                        m_comps.elementAt(intIdx).invoke();
+                        m_comps.get(intIdx).invoke();
                     }
+/*
                     while (!m_running) {
                         try {
                             Thread.sleep(0, (int) tv.getUsec());
@@ -79,6 +159,7 @@
                     } catch (InterruptedException e) {
                         e.printStackTrace();
                     }
+*/
                 }
             }
         } while (m_running);
@@ -93,6 +174,799 @@
         this.svc();
     }
 
+    //============================================================
+    // ExecutionContext
+    //============================================================
+    /**
+     * {@.ja ExecutionContext 実行状態確認関数}
+     * {@.en heck for ExecutionContext running state}
+     * <p>
+     * {@.ja この操作は ExecutionContext が Runnning 状態の場合に true を返す。
+     * Executioncontext が Running の間、当該 Executioncontext に参加し
+     * ている全てのアクティブRTコンポーネントが、ExecutionContext の実
+     * 行種類に応じて実行される。}
+     * {@.en This operation shall return true if the context is in the
+     * Running state.  While the context is Running, all Active RTCs
+     * participating in the context shall be executed according to the
+     * context’s execution kind.}
+     *
+     * @return 
+     *   {@.ja 状態確認関数(動作中:true、停止中:false)}
+     *   {@.en Check state function (Running:true、Stopping:false)}
+     *
+     */
+    public boolean is_running() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.is_running()");
+
+        return m_running;
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行を開始}
+     * {@.en Start the ExecutionContext}
+     * <p>
+     * {@.ja ExecutionContext の実行状態を Runnning とするためのリクエストを
+     * 発行する。ExecutionContext の状態が遷移すると
+     * ComponentAction::on_startup が呼び出される。参加しているRTコンポー
+     * ネントが、初期化されるまで ExecutionContext を開始することはでき
+     * ない。ExecutionContext は複数回開始/停止を繰り返すことができる。}
+     * {@.en Request that the context enter the Running state.  Once the
+     * state transition occurs, the ComponentAction::on_startup
+     * operation will be invoked.  An execution context may not be
+     * started until the RT-Components that participate in it have
+     * been initialized.  An execution context may be started and
+     * stopped multiple times.}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t start() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.start()");
+
+        if( m_running ) return ReturnCode_t.PRECONDITION_NOT_MET;
+
+        // invoke ComponentAction::on_startup for each comps.
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            m_comps.get(intIdx).invoke_on_startup();
+        }
+        // change EC thread state
+        m_running = true;
+        synchronized (m_worker) {
+            //m_worker.running_ = true;
+            m_worker.notifyAll();
+        }
+
+        this.open();
+
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行を停止}
+     * {@.en Stop the ExecutionContext}
+     * <p>
+     * {@.ja ExecutionContext の状態を Stopped とするためのリクエストを発行す
+     * る。遷移が発生した場合は、ComponentAction::on_shutdown が呼び出
+     * される。参加しているRTコンポーネントが終了する前に
+     * ExecutionContext を停止する必要がある。ExecutionContext は複数回
+     * 開始/停止を繰り返すことができる。}
+     * {@.en Request that the context enter the Stopped state.  Once the
+     * transition occurs, the ComponentAction::on_shutdown operation
+     * will be invoked.  An execution context must be stopped before
+     * the RT components that participate in it are finalized.  An
+     * execution context may be started and stopped multiple times.}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t stop(){
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.stop()");
+
+        if( !m_running ) return ReturnCode_t.PRECONDITION_NOT_MET;
+
+        // change EC thread state
+        m_running = false;
+	synchronized (m_worker) {
+	    //m_worker.running_ = false;
+	}
+
+        // invoke on_shutdown for each comps.
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            m_comps.get(intIdx).invoke_on_shutdown();
+        }
+
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を取得する}
+     * {@.en Get execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を取得す
+     * る。}
+     * {@.en This operation shall return the rate (in hertz) at which its
+     * Active participating RTCs are being invoked.}
+     *
+     * @return 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     */
+    public double get_rate() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_rate()");
+
+        return m_profile.getRate();
+    }
+    /**
+     * <p>ExecutionContextの実行周期(Hz)を設定します。</p>
+     * 
+     * @param rate 実行周期(Hz)
+     */
+    public ReturnCode_t set_rate(double rate) {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.set_rate("+rate+")");
+
+        if( rate<=0.0 ) return ReturnCode_t.BAD_PARAMETER;
+
+        m_profile.setRate(rate);
+        this.m_usec = (long)(1000000/rate);
+        if( m_usec == 0 ) {
+            m_nowait = true;
+        }
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            m_comps.get(intIdx).invoke_on_rate_changed();
+        }
+        rtcout.println(Logbuf.DEBUG, "Actual period: "
+                                        + m_profile.getPeriod().sec()
+                                        + " [sec], "
+                                        + m_profile.getPeriod().usec()
+                                        + " [usec]");
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * <p>コンポーネントをアクティブ化します。</p>
+     * 
+     * @param comp アクティブ化対象コンポーネント
+     * 
+     * @return 実行結果
+     */
+    public ReturnCode_t activate_component(LightweightRTObject comp) {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.activate_component()");
+
+        // コンポーネントが参加者リストに無ければ BAD_PARAMETER を返す
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+            if (find.eqaulof(m_comps.get(intIdx)) ) {
+                // the given component must be in Alive state.
+                if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.INACTIVE_STATE))) {
+                    return ReturnCode_t.PRECONDITION_NOT_MET;
+                }
+                m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.ACTIVE_STATE);
+                return ReturnCode_t.RTC_OK;
+            }
+        }
+        return ReturnCode_t.BAD_PARAMETER;
+    }
+
+    /**
+     * <p>コンポーネントを非アクティブ化します。</p>
+     * 
+     * @param comp 非アクティブ化対象コンポーネント
+     * 
+     * @return 実行結果
+     */
+    public ReturnCode_t deactivate_component(LightweightRTObject comp) {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.deactivate_component()");
+
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+            if (find.eqaulof(m_comps.get(intIdx)) ) {
+                // the given component must be in Alive state.
+                if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.ACTIVE_STATE))) {
+                    return ReturnCode_t.PRECONDITION_NOT_MET;
+                }
+                m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+                return ReturnCode_t.RTC_OK;
+            }
+        }
+        return ReturnCode_t.BAD_PARAMETER;
+    }
+
+    /**
+     * <p>コンポーネントをリセットします。</p>
+     * 
+     * @param comp リセット対象コンポーネント
+     * 
+     * @return 実行結果
+     */
+    public ReturnCode_t reset_component(LightweightRTObject comp){
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.reset_component()");
+
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+            if (find.eqaulof(m_comps.get(intIdx)) ) {
+                // the given component must be in Alive state.
+                if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.ERROR_STATE))) {
+                    return ReturnCode_t.PRECONDITION_NOT_MET;
+                }
+                m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+                return ReturnCode_t.RTC_OK;
+            }
+        }
+        return ReturnCode_t.BAD_PARAMETER;
+    }
+
+    /**
+     * <p>コンポーネントの状態を取得します。</p>
+     * 
+     * @param comp 状態取得対象コンポーネント
+     * 
+     * @return コンポーネント状態
+     */
+    public LifeCycleState get_component_state(LightweightRTObject comp) {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_component_state()");
+
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+            if (find.eqaulof(m_comps.get(intIdx)) ) {
+                return m_comps.get(intIdx)._sm.m_sm.getState();
+            }
+        }
+        return LifeCycleState.CREATED_STATE;
+    }
+
+    /**
+     * <p>ExecutionKindを取得します。</p>
+     * 
+     * @return ExecutionKind
+     */
+    public ExecutionKind get_kind() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_kind() ="
+                                            + m_profile.getKindString());
+
+        return m_profile.getKind();
+    }
+
+    /**
+     * {@.ja RTコンポーネントを追加する}
+     * {@.en Add an RT-component}
+     *
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストに追加する。追加されたRTコ
+     * ンポーネントは attach_context が呼ばれ、Inactive 状態に遷移する。
+     * 指定されたRTコンポーネントがnullの場合は、BAD_PARAMETER が返され
+     * る。指定されたRTコンポーネントが DataFlowComponent 以外の場合は、
+     * BAD_PARAMETER が返される。}
+     * {@.en The operation causes the given RTC to begin participating in
+     * the execution context.  The newly added RTC will receive a call
+     * to LightweightRTComponent::attach_context and then enter the
+     * Inactive state.  BAD_PARAMETER will be invoked, if the given
+     * RT-Component is null or if the given RT-Component is other than
+     * DataFlowComponent.}
+     *
+     * @param comp 
+     *   {@.ja 追加対象RTコンポーネント}
+     *   {@.en The target RT-Component for add}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     *
+     */
+    public ReturnCode_t add_component(LightweightRTObject comp) {
+
+        rtcout.println(Logbuf.TRACE, 
+                            "ExtTrigExecutionContext.add_component()");
+
+        if( comp==null ) return ReturnCode_t.BAD_PARAMETER;
+        //
+        try {
+            DataFlowComponent dfp = DataFlowComponentHelper.narrow(comp);
+            if( dfp==null ) {
+                // Because the ExecutionKind of this context is PERIODIC,
+                // the RTC must be a data flow component.
+                return ReturnCode_t.BAD_PARAMETER;
+            }
+            //
+            int id = dfp.attach_context(m_ref);
+            //
+            m_comps.add(new Comp((LightweightRTObject)comp._duplicate(), 
+                                (DataFlowComponent)dfp._duplicate(), id));
+            m_profile.addComponent((LightweightRTObject)comp._duplicate());
+            return ReturnCode_t.RTC_OK;
+        } catch(Exception ex) {
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+    }
+
+    /**
+     * {@.ja コンポーネントをバインドする。}
+     * {@.en Bind the component.}
+     *
+     * <p>
+     * {@.ja コンポーネントをバインドする。}
+     * {@.en Bind the component.}
+     *
+     * @param rtc 
+     *  {@.ja RTコンポーネント}
+     *  {@.en RT-Component's instances}
+     * @return 
+     *  {@.ja ReturnCode_t 型のリターンコード}
+     *  {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t bindComponent(RTObject_impl rtc) {
+
+        rtcout.println(Logbuf.TRACE, 
+                    "ExtTrigExecutionContext.bindComponent()");
+
+        if (rtc == null) return ReturnCode_t.BAD_PARAMETER;
+
+        LightweightRTObject comp = rtc.getObjRef();
+        DataFlowComponent dfp;
+        dfp = DataFlowComponentHelper.narrow(comp);
+
+        int id = rtc.bindContext(m_ref);
+	if (id < 0 || id > RTObject_impl.ECOTHER_OFFSET) {
+	    rtcout.println(Logbuf.ERROR, "bindContext returns invalid id: "+id);
+	    return ReturnCode_t.RTC_ERROR;
+	}
+	rtcout.println(Logbuf.DEBUG, "bindComponent() returns id = "+id);
+        m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
+                             (DataFlowComponent)dfp._duplicate(),
+                             id));
+        m_profile.setOwner((LightweightRTObject)dfp._duplicate());
+
+
+        return ReturnCode_t.RTC_OK;
+    }
+
+    /**
+     * {@.ja RTコンポーネントを参加者リストから削除する}
+     * {@.en Remove the RT-Component from participant list}
+     *
+     * <p>
+     * {@.ja 指定したRTコンポーネントを参加者リストから削除する。削除された
+     * RTコンポーネントは detach_context が呼ばれる。指定されたRTコンポー
+     * ネントが参加者リストに登録されていない場合は、BAD_PARAMETER が返
+     * される。}
+     * {@.en This operation causes a participant RTC to stop participating in 
+     * the execution context.
+     * The removed RTC will receive a call to
+     * LightweightRTComponent::detach_context.
+     * BAD_PARAMETER will be returned, if the given RT-Component is not 
+     * participating in the participant list.}
+     *
+     * @param comp 
+     *   {@.ja 削除対象RTコンポーネント}
+     *   {@.en The target RT-Component for delete}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード}
+     *   {@.en The return code of ReturnCode_t type}
+     *
+     */
+    public ReturnCode_t remove_component(LightweightRTObject comp) {
+
+        rtcout.println(Logbuf.TRACE, 
+                        "ExtTrigExecutionContext.remove_component()");
+
+        for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+            find_comp find 
+                = new find_comp((LightweightRTObject)comp._duplicate());
+            if (find.eqaulof(m_comps.get(intIdx)) ) {
+                m_comps.get(intIdx)._ref.detach_context(
+                                        m_comps.get(intIdx)._sm.ec_id);
+                m_comps.get(intIdx)._ref = null;
+                m_comps.remove(m_comps.get(intIdx));
+                rtcout.println(Logbuf.TRACE, 
+                    "remove_component(): an RTC removed from this context.");
+                m_profile.removeComponent(comp);
+                return ReturnCode_t.RTC_OK;
+            }
+        }
+        rtcout.println(Logbuf.TRACE, "remove_component(): no RTC found in this context.");
+        return ReturnCode_t.BAD_PARAMETER;
+    }
+
+    /**
+     * <p>ExecutionContextProfile を取得します。</p>
+     * 
+     * @return ExecutionContextProfile
+     */
+    public RTC.ExecutionContextProfile get_profile() {
+
+        rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_profile()");
+        return m_profile.getProfile();
+    }
+
+    /**
+     * <p>DataFlowComponentのAction定義用抽象クラスです。</p>
+     */
+    protected abstract class DFPBase {
+        /**
+         * <p>コンストラクタです。</p>
+         * 
+         * @param id ExecutionContextのID
+         */
+        public DFPBase(int id) {
+            ec_id = id;
+            m_sm = new StateMachine(3);
+            m_sm.setListener(this);
+            StateHolder st = new StateHolder();
+            m_sm.setEntryAction(LifeCycleState.ACTIVE_STATE, new onActivated());
+            m_sm.setDoAction(LifeCycleState.ACTIVE_STATE, new onExecute());
+            m_sm.setPostDoAction(LifeCycleState.ACTIVE_STATE, new onStateUpdate());
+            m_sm.setExitAction(LifeCycleState.ACTIVE_STATE, new onDeactivated());
+            m_sm.setEntryAction(LifeCycleState.ERROR_STATE, new onAborting());
+            m_sm.setDoAction(LifeCycleState.ERROR_STATE, new onError());
+            m_sm.setExitAction(LifeCycleState.ERROR_STATE, new onReset());
+
+            st.prev = LifeCycleState.INACTIVE_STATE;
+            st.curr = LifeCycleState.INACTIVE_STATE;
+            st.next = LifeCycleState.INACTIVE_STATE;
+            m_sm.setStartState(st);
+            m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+        }
+        /**
+         * <p>onActivatedアクション定義用抽象クラスです。</p>
+         */
+        private class onActivated implements StateAction {
+            public void doAction(StateHolder state) {
+                on_activated(state);
+            }
+        }
+        /**
+         * <p>onExecuteアクション定義用抽象クラスです。</p>
+         */
+        private class onExecute implements StateAction {
+            public void doAction(StateHolder state) {
+                on_execute(state);
+            }
+        }
+        /**
+         * <p>onStateUpdateアクション定義用抽象クラスです。</p>
+         */
+        private class onStateUpdate implements StateAction {
+            public void doAction(StateHolder state) {
+                on_state_update(state);
+            }
+        }
+        /**
+         * <p>onDeactivatedアクション定義用抽象クラスです。</p>
+         */
+        private class onDeactivated implements StateAction {
+            public void doAction(StateHolder state) {
+                on_deactivated(state);
+            }
+        }
+        /**
+         * <p>onAbortingアクション定義用抽象クラスです。</p>
+         */
+        private class onAborting implements StateAction {
+            public void doAction(StateHolder state) {
+                on_aborting(state);
+            }
+        }
+        /**
+         * <p>onErrorアクション定義用抽象クラスです。</p>
+         */
+        private class onError implements StateAction {
+            public void doAction(StateHolder state) {
+                on_error(state);
+            }
+        }
+        /**
+         * <p>onResetアクション定義用抽象クラスです。</p>
+         */
+        private class onReset implements StateAction {
+            public void doAction(StateHolder state) {
+                on_reset(state);
+            }
+        }
+
+        /**
+         * <p>ExecutionContextのstart時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_startup();
+        /**
+         * <p>ExecutionContextのstop時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_shutdown();
+        
+        /**
+         * <p>コンポーネントのactivate時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_activated(final StateHolder st);
+        /**
+         * <p>コンポーネントのdeactivate時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_deactivated(final StateHolder st);
+        /**
+         * <p>コンポーネントのabort時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_aborting(final StateHolder st);
+        /**
+         * <p>コンポーネントがerror状態の時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_error(final StateHolder st);
+        /**
+         * <p>コンポーネントreset時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_reset(final StateHolder st);
+        /**
+         * <p>コンポーネント実行時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_execute(final StateHolder st);
+        /**
+         * <p>コンポーネントの実行時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_state_update(final StateHolder st);
+
+        /**
+         * <p>ExecutionContextの実行周期変更時に呼ばれる抽象メソッドです。</p>
+         */
+        public abstract void on_rate_changed();
+        /**
+         * <p>ExecutionContextの状態遷移用ワーカーです。</p>
+         */
+        public void worker() {
+            m_sm.worker();
+        }
+        public void worker_pre() {
+            m_sm.worker_pre();
+        }
+        public void worker_do() {
+            m_sm.worker_do();
+        }
+        public void worker_post() {
+            m_sm.worker_post();
+        }
+
+        /**
+         * <p>現在の状態を取得します。</p>
+         * 
+         * @return 現在の状態
+         */
+        public LifeCycleState get_state(){
+            return m_sm.getState();
+        }
+
+        /**
+         * <p>ExecutionContextのID</p>
+         */
+        public int ec_id;
+        /**
+         * <p>ExecutionContextのStateMachine</p>
+         */
+        public StateMachine<LifeCycleState, DFPBase> m_sm;
+        
+    }
+
+    /**
+     * <p>DataFlowComponentのAction定義用抽象クラスです。</p>
+     */
+    protected class DFP extends DFPBase {
+        /**
+         * <p>コンストラクタです。</p>
+         * 
+         * @param obj 対象コンポーネント
+         * @param id ExecutionContextのID
+         */
+        public DFP(DataFlowComponent obj, int id) {
+            super(id);
+            m_obj = obj;
+        }
+        /**
+         * <p>onStartupアクション定義用メソッドです。</p>
+         */
+        public void on_startup() {
+            m_obj.on_startup(ec_id);
+        }
+        /**
+         * <p>onShutdownアクション定義用メソッドです。</p>
+         */
+        public void on_shutdown() {
+            m_obj.on_shutdown(ec_id);
+        }
+        /**
+         * <p>onActivatedアクション定義用メソッドです。</p>
+         */
+        public void on_activated(final StateHolder st) {
+            if( m_obj.on_activated(ec_id) != ReturnCode_t.RTC_OK ) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+        /**
+         * <p>onDeactivatedアクション定義用メソッドです。</p>
+         */
+        public void on_deactivated(final StateHolder st) {
+            if( m_obj.on_deactivated(ec_id) != ReturnCode_t.RTC_OK ) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+        /**
+         * <p>onAbortingアクション定義用メソッドです。</p>
+         */
+        public void on_aborting(final StateHolder st) {
+            m_obj.on_aborting(ec_id);
+        }
+        /**
+         * <p>onErrorアクション定義用メソッドです。</p>
+         */
+        public void on_error(final StateHolder st) {
+            m_obj.on_error(ec_id);
+        }
+        /**
+         * <p>onResetアクション定義用メソッドです。</p>
+         */
+        public void on_reset(final StateHolder st) {
+            if( m_obj.on_reset(ec_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+        /**
+         * <p>onExecuteアクション定義用メソッドです。</p>
+         */
+        public void on_execute(final StateHolder st) {
+            if( m_obj.on_execute(ec_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }  
+            return;
+        }
+        /**
+         * <p>onStateUpdateアクション定義用メソッドです。</p>
+         */
+        public void on_state_update(final StateHolder st) {
+            if( m_obj.on_state_update(ec_id) != ReturnCode_t.RTC_OK) {
+                m_sm.goTo(LifeCycleState.ERROR_STATE);
+                return;
+            }
+            return;
+        }
+        /**
+         * <p>onRateChangedアクション定義用メソッドです。</p>
+         */
+        public void on_rate_changed() {
+            m_obj.on_rate_changed(ec_id);
+        }
+        private DataFlowComponent m_obj; 
+    }
+
+    /**
+     * <p>ExecutionContextにattachされたコンポーネントのメソッド呼出用クラスです。</p>
+     */
+    protected class Comp {
+        /**
+         * <p>コンストラクタです。</p>
+         * 
+         * @param ref 対象コンポーネント
+         * @param dfp ExecutionContextの対象StateMachine
+         * @param id ExecutionContextのID
+         */
+        public Comp(LightweightRTObject ref, DataFlowComponent dfp, int id) {
+            this._ref = ref;
+            this._sm = new DFP(dfp, id);
+        }
+        /**
+         * <p>コンストラクタです。</p>
+         * 
+         * @param comp 対象コンポーネント
+         */
+        public Comp(final Comp comp) {
+            this._ref = comp._ref;
+            this._sm = new DFP(comp._sm.m_obj, comp._sm.ec_id);
+        }
+        /**
+         * <p>コンポーネントをコピーします。</p>
+         * 
+         * @param comp 対象コンポーネント
+         */
+        public Comp substitute(final Comp comp) {
+            this._ref = comp._ref;
+            this._sm.m_obj = comp._sm.m_obj;
+            this._sm.ec_id = comp._sm.ec_id;
+            return this;
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke(){
+            this._sm.worker();
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_pre(){
+            this._sm.worker_pre();
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_do(){
+            this._sm.worker_do();
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_post(){
+            this._sm.worker_post();
+        }
+        /**
+         * <p>StartUp時に呼び出されるメソッドです。</p>
+         */
+        public void invoke_on_startup(){
+            this._sm.on_startup();
+        }
+        /**
+         * <p>ShutDown時に呼び出されるメソッドです。</p>
+         */
+        public void invoke_on_shutdown(){
+            this._sm.on_shutdown();
+        }
+        /**
+         * <p>RateChanged時に呼び出されるメソッドです。</p>
+         */
+        public void invoke_on_rate_changed(){
+            this._sm.on_rate_changed();
+        }
+        /**
+         * <p>StateMachine管理対象コンポーネントです。</p>
+         */
+        public LightweightRTObject _ref;
+        /**
+         * <p>対象コンポーネントのStateMachineです。</p>
+         */
+        public DFP _sm;
+    }
+    /**
+     * <p>管理対象コンポーネント検索用ヘルパークラスです。</p>
+     */
+    protected class find_comp {
+        private LightweightRTObject m_comp;
+        public find_comp(LightweightRTObject comp) {
+            m_comp = comp;
+        }
+        public boolean eqaulof(Comp comp) {
+            return comp._ref._is_equivalent(m_comp);
+        }
+    };
+
+    /**
+     * <p>ExecutionContextにatttachされているコンポーネントのリストです。</p>
+     */
+    protected ArrayList<Comp>  m_comps = new ArrayList<Comp>();
+    /**
+     * <p>ExecutionContextの実行状態です。</p>
+     */
+    protected boolean m_running;
+    /**
+     * <p>ExecutionContext のスレッド実行フラグです。</p>
+     */
+    private boolean m_svc;
+
     private class Worker {
         
         public Worker() {
@@ -103,15 +977,60 @@
     }
     
     private Worker m_worker = new Worker();
+    /**
+     * <p>ExecutionContextProfileです。</p>
+     */
+    protected ExecutionContextProfile m_profile = new ExecutionContextProfile();
+    /**
+     * <p>ExecutionContextの動作周期です。</p>
+     */
+    protected long m_usec;
+    /**
+     * <p>ExecutionContextServiceとしてのCORBAオブジェクト参照です。</p>
+     */
+    protected ExecutionContextService m_ref;
+    protected boolean m_nowait;
+    protected Thread m_thread = null;
 
+
     /**
+     * {@.ja OpenHRPExecutionContext を生成する}
+     * {@.en Creats OpenHRPExecutionContext}
+     * 
+     * @return 
+     *   {@.ja 生成されたExtTrigExecutionContext}
+     *   {@.en Object Created instances}
+     *
+     *
+     */
+    public ExecutionContextBase creator_() {
+        return new ExtTrigExecutionContext();
+    }
+    /**
+     * {@.ja Object を破棄する}
+     * {@.en Destructs Object}
+     * 
+     * @param obj
+     *   {@.ja 破棄するインタスタンス}
+     *   {@.en The target instances for destruction}
+     *
+     */
+    public void destructor_(Object obj) {
+        obj = null;
+    }
+    /**
      * <p>このExecutionContextを生成するFactoryクラスを
      * ExecutionContext用ObjectManagerに登録します。</p>
      * 
      * @param manager Managerオブジェクト
      */
     public static void ExtTrigExecutionContextInit(Manager manager) {
-        manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.ExtTrigExecutionContext");
+
+        ExecutionContextFactory<ExecutionContextBase,String> factory 
+                                        = ExecutionContextFactory.instance();
+        factory.addFactory("jp.go.aist.rtm.RTC.executionContext.ExtTrigExecutionContext",
+                    new ExtTrigExecutionContext(),
+                    new ExtTrigExecutionContext());
     }
     
     /**
@@ -136,4 +1055,113 @@
      * <p>Logging用フォーマットオブジェクト</p>
      */
     protected Logbuf rtcout;
+    /**
+     * {@.ja ExecutionContextクラスの初期化関数}
+     * {@.en Initialization function of ExecutionContext class}
+     */
+    public void init(Properties props) {
+    }
+
+    /**
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
+     */
+    public void setObjRef(final ExecutionContextService ref) {
+        m_profile.setObjRef(ref);
+    }
+    /**
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
+     */
+    public ExecutionContextService getObjRef() {
+      return m_profile.getObjRef();
+    }
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を設定する}
+     * {@.en Set execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を設定す
+     * る。実行周期の変更は、DataFlowComponentAction の
+     * on_rate_changed によって各RTコンポーネントに伝達される。}
+     * {@.en This operation shall set the rate (in hertz) at which this
+     * context’s Active participating RTCs are being called.  If the
+     * execution kind of the context is PERIODIC, a rate change shall
+     * result in the invocation of on_rate_changed on any RTCs
+     * realizing DataFlowComponentAction that are registered with any
+     * RTCs participating in the context.}
+     *
+     * @param rate
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード
+     *         RTC_OK: 正常終了
+     *         BAD_PARAMETER: 設定値が負の値}
+     *   {@.en The return code of ReturnCode_t type
+     *         RTC_OK: Succeed
+     *         BAD_PARAMETER: Invalid value. The value might be negative.}
+     *
+     */
+    public ReturnCode_t setRate(double rate) {
+      return m_profile.setRate(rate);
+    }
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を取得する}
+     * {@.en Get execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を取得す
+     * る。}
+     * {@.en This operation shall return the rate (in hertz) at which its
+     * Active participating RTCs are being invoked.}
+     *
+     * @return 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     */
+    public double getRate()  {
+      return m_profile.getRate();
+    }
+    /**
+     * {@.ja ExecutionKind を文字列化する}
+     * {@.en Converting ExecutionKind enum to string}
+     * <p>
+     * {@.ja RTC::ExecutionKind で定義されている PERIODIC, EVENT_DRIVEN,
+     * OTHER を文字列化する。}
+     * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+     * OTHER) defined in RTC::ExecutionKind to string.}
+     *
+     * @param kind 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     * @return 
+     *   {@.ja 文字列化されたExecutionKind}
+     *   {@.en String of ExecutionKind}
+     *
+     */
+    public final String getKindString(ExecutionKind kind) {
+      return m_profile.getKindString(kind);
+    }
+
 }

Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java	                        (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,46 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import org.omg.CORBA.SystemException;
+
+import RTC.ExecutionContextService;
+import OpenRTM.ExtTrigExecutionContextServicePOA;
+
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+import RTC.ExecutionKind;
+import RTC.ReturnCode_t;
+
+/**
+ * <p>Periodic Sampled Data Processing(周期実行用)ExecutionContextのベースとなる
+ * 抽象クラスです。</p>
+ */
+//public abstract class ExecutionContextBase 
+// implements ECNewDeleteFunc {
+public interface IExecutionContextBase extends ECNewDeleteFunc {
+
+    /**
+     * {@.ja ExecutionContextクラスの初期化関数}
+     * {@.en Initialization function of ExecutionContext class}
+     */
+    public void init(Properties props);
+    
+    /**
+     * <p> bindComponent </p>
+     *
+     * @param rtc RTObject
+     * @return ReturnCode_t
+     * 
+     */
+    public ReturnCode_t bindComponent(RTObject_impl rtc);
+
+    public boolean finalizeExecutionContext();
+/*
+    public ExecutionContextProfile m_profile 
+                                    = new jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile();
+*/
+/*
+    protected ExecutionContextProfile m_profile 
+                                    = new ExecutionContextProfile();
+*/
+
+}

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -1,6 +1,8 @@
 package jp.go.aist.rtm.RTC.executionContext;
 
 import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
 
 import org.omg.CORBA.SystemException;
 
@@ -9,8 +11,9 @@
  *
  */
 public class OpenHRPExecutionContext
-        extends PeriodicExecutionContext implements Runnable{
-
+//        extends PeriodicExecutionContext implements Runnable{
+extends PeriodicExecutionContext 
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase{
     /**
      * <p> Constructor </p>
      */
@@ -72,12 +75,42 @@
     private Worker m_worker = new Worker();
 
     /**
+     * {@.ja OpenHRPExecutionContext を生成する}
+     * {@.en Creats OpenHRPExecutionContext}
+     * 
+     * @return 
+     *   {@.ja 生成されたOpenHRPExecutionContext}
+     *   {@.en Object Created instances}
+     *
+     *
+     */
+    public OpenHRPExecutionContext creator_() {
+        return new OpenHRPExecutionContext();
+    }
+    /**
+     * {@.ja Object を破棄する}
+     * {@.en Destructs Object}
+     * 
+     * @param obj
+     *   {@.ja 破棄するインタスタンス}
+     *   {@.en The target instances for destruction}
+     *
+     */
+    public void destructor_(Object obj) {
+        obj = null;
+    }
+    /**
      * <p> OpenHRPExecutionContextInit </p>
      *
      * @param manager Manager
      */
     public static void OpenHRPExecutionContextInit(Manager manager) {
-        manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext");
+//        manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext");
+        ExecutionContextFactory<ExecutionContextBase,String> factory 
+                                        = ExecutionContextFactory.instance();
+        factory.addFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext",
+                    new OpenHRPExecutionContext(),
+                    new OpenHRPExecutionContext());
     }
     
     /**

Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java	2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java	2015-10-28 01:44:04 UTC (rev 732)
@@ -3,6 +3,8 @@
 import java.util.Vector;
 
 import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.StateAction;
 import jp.go.aist.rtm.RTC.StateHolder;
@@ -11,13 +13,16 @@
 import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
 import jp.go.aist.rtm.RTC.util.NVUtil;
 import jp.go.aist.rtm.RTC.util.POAUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.TimeValue;
 import jp.go.aist.rtm.RTC.util.equalFunctor;
+//import RTC.ExecutionContextProfile;
 import OpenRTM.DataFlowComponent;
 import OpenRTM.DataFlowComponentHelper;
-import RTC.ExecutionContextProfile;
 import RTC.ExecutionContextProfileHolder;
 import RTC.ExecutionContextService;
 import RTC.ExecutionContextServiceHelper;
+import RTC.ExecutionContextServicePOA;
 import RTC.ExecutionKind;
 import RTC.LifeCycleState;
 import RTC.LightweightRTObject;
@@ -28,8 +33,12 @@
  * <p>Periodic Sampled Data Processing(周期実行用)ExecutionContextクラスです。</p>
  */
 
-public class PeriodicExecutionContext extends ExecutionContextBase implements Runnable {
+//public class PeriodicExecutionContext extends  ExtTrigExecutionContextServicePOA implements Runnable, ExecutionContextBase {
+public class PeriodicExecutionContext 
+extends  ExecutionContextServicePOA 
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase {
 
+
     /**
      * {@.ja デフォルトコンストラクタ}
      * {@.en Default Constructor}
@@ -55,14 +64,21 @@
 
         m_usec = (long)(1000000/rate);
 
-        m_ref = (ExecutionContextService)this.__this();
+        //m_ref = (ExecutionContextService)this.__this();
+        m_profile.setObjRef((ExecutionContextService)this.__this());
 
 
+        m_profile.setPeriod(new TimeValue(1.0 / rate));
+        m_profile.setKind(ExecutionKind.PERIODIC);
+        m_profile.setRate(1.0 / jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile.DEEFAULT_PERIOD);
+
+/*
         m_profile.kind = ExecutionKind.PERIODIC;
         m_profile.rate = 0.0;
         m_profile.owner = (RTC.RTObject)null;
         m_profile.participants = new RTC.RTObject[0];
         m_profile.properties = new _SDOPackage.NameValue[0];
+*/
     }
 
     /**
@@ -107,19 +123,29 @@
         m_svc = true;
         m_nowait = true;
 
-        if( rate==0 ) rate = (1.0/0.000001);//1000000Hz
-
+        if( rate==0 ) {
+            rate = (1.0/0.000001);//1000000Hz
+        }
         m_usec = (long)(1000000/rate);
-        if( m_usec==0 ) m_nowait = true;
+        if( m_usec==0 ) {
+            m_nowait = true;
+        }
 
-        m_ref = (ExecutionContextService)this.__this();
+        //m_ref = (ExecutionContextService)this.__this();
+        m_profile.setObjRef((ExecutionContextService)this.__this());
 
 
+        m_profile.setPeriod(new TimeValue(1.0 / rate));
+        m_profile.setKind(ExecutionKind.PERIODIC);
+        m_profile.setRate(1.0 / jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile.DEEFAULT_PERIOD);
+        m_profile.setOwner((LightweightRTObject)owner._duplicate());
+/*
         m_profile.kind = ExecutionKind.PERIODIC;
         m_profile.rate = rate;
         m_profile.owner = owner;
         m_profile.participants = new RTC.RTObject[0];
         m_profile.properties = new _SDOPackage.NameValue[0];
+*/
     }
 
     /**
@@ -177,12 +203,14 @@
      * 
      * @return ExecutionContextService
      */
+/*
     public ExecutionContextService getObjRef() {
 
         rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.getObjRef()");
 
         return m_ref;
     }
+*/
     /**
      * <p>本オブジェクトのExecutionContextServiceとしてのCORBAオブジェクト参照を設定します。</p>
      * 
@@ -228,7 +256,9 @@
 		}
 		if (m_worker.running_) {
 		    for (int intIdx=0; intIdx < m_comps.size(); ++intIdx) {
-			m_comps.elementAt(intIdx).invoke();
+			m_comps.get(intIdx).invoke_work_pre();
+			m_comps.get(intIdx).invoke_work_do();
+			m_comps.get(intIdx).invoke_work_post();
 		    }
 		}
 	    }
@@ -344,9 +374,12 @@
 
         rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_rate()");
 
+        return m_profile.getRate();
+/*
         synchronized (m_profile) {
             return m_profile.rate;
         }
+*/
     }
 
     /**
@@ -360,14 +393,24 @@
 
         if( rate<=0.0 ) return ReturnCode_t.BAD_PARAMETER;
 
+        m_profile.setRate(rate);
+/*
         synchronized (m_profile) {
             m_profile.rate = rate;
         }
+*/
         this.m_usec = (long)(1000000/rate);
-        if( m_usec == 0 ) m_nowait = true;
+        if( m_usec == 0 ) {
+            m_nowait = true;
+        }
         for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
             m_comps.elementAt(intIdx).invoke_on_rate_changed();
         }
+        rtcout.println(Logbuf.DEBUG, "Actual period: "
+                                        + m_profile.getPeriod().sec()
+                                        + " [sec], "
+                                        + m_profile.getPeriod().usec()
+                                        + " [usec]");
         return ReturnCode_t.RTC_OK;
     }
 
@@ -474,9 +517,11 @@
      */
     public ExecutionKind get_kind() {
 
-        rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_kind()");
+        rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_kind() ="
+                                            + m_profile.getKindString());
 
-        return m_profile.kind;
+        return m_profile.getKind();
+        //return m_profile.kind;
     }
 
     /**
@@ -525,11 +570,14 @@
             //
             m_comps.add(new Comp((LightweightRTObject)comp._duplicate(), 
                                 (DataFlowComponent)dfp._duplicate(), id));
+            m_profile.addComponent((LightweightRTObject)comp._duplicate());
+/*
             RTC.RTCListHolder holder
                         = new RTC.RTCListHolder(m_profile.participants);
             CORBA_SeqUtil.push_back(holder, 
                         RTC.RTObjectHelper.narrow(comp));
             m_profile.participants = holder.value;
+*/
             return ReturnCode_t.RTC_OK;
         } catch(Exception ex) {
             return ReturnCode_t.BAD_PARAMETER;
@@ -572,7 +620,8 @@
         m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
                              (DataFlowComponent)dfp._duplicate(),
                              id));
-        m_profile.owner = (DataFlowComponent)dfp._duplicate();
+        m_profile.setOwner((LightweightRTObject)dfp._duplicate());
+        //m_profile.owner = (DataFlowComponent)dfp._duplicate();
 
 
         return ReturnCode_t.RTC_OK;
@@ -616,7 +665,10 @@
                                         m_comps.elementAt(intIdx)._sm.ec_id);
                 m_comps.elementAt(intIdx)._ref = null;
                 m_comps.remove(m_comps.elementAt(intIdx));
-                rtcout.println(Logbuf.TRACE, "remove_component(): an RTC removed from this context.");
+                rtcout.println(Logbuf.TRACE, 
+                    "remove_component(): an RTC removed from this context.");
+                m_profile.removeComponent(comp);
+/*
                 RTC.RTObject rtcomp = RTC.RTObjectHelper.narrow(comp);
                 if(rtcomp == null){
                     rtcout.println(Logbuf.ERROR,"Invalid object reference."); 
@@ -636,6 +688,7 @@
                     CORBA_SeqUtil.erase(holder, (int)index);
                     m_profile.participants = holder.value;
                 }
+*/
                 return ReturnCode_t.RTC_OK;
             }
         }
@@ -651,15 +704,17 @@
      * 
      * @return ExecutionContextProfile
      */
-    public ExecutionContextProfile get_profile() {
+    public RTC.ExecutionContextProfile get_profile() {
 
         rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_profile()");
-
+        return m_profile.getProfile();
+/*
         ExecutionContextProfileHolder p;
         synchronized (m_profile) {
             p = new ExecutionContextProfileHolder(m_profile);
         }
         return p.value;
+*/
     }
 
     /**
@@ -795,6 +850,15 @@
         public void worker() {
             m_sm.worker();
         }
+        public void worker_pre() {
+            m_sm.worker_pre();
+        }
+        public void worker_do() {
+            m_sm.worker_do();
+        }
+        public void worker_post() {
+            m_sm.worker_post();
+        }
 
         /**
          * <p>現在の状態を取得します。</p>
@@ -955,6 +1019,24 @@
             this._sm.worker();
         }
         /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_pre(){
+            this._sm.worker_pre();
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_do(){
+            this._sm.worker_do();
+        }
+        /**
+         * <p>ExecutionContextから呼び出されるメソッドです。</p>
+         */
+        public void invoke_work_post(){
+            this._sm.worker_post();
+        }
+        /**
          * <p>StartUp時に呼び出されるメソッドです。</p>
          */
         public void invoke_on_startup(){
@@ -1043,10 +1125,40 @@
      * @param manager Managerオブジェクト
      */
     public static void PeriodicExecutionContextInit(Manager manager) {
-        manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext");
+        //manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext");
+        ExecutionContextFactory<ExecutionContextBase,String> factory 
+                                        = ExecutionContextFactory.instance();
+        factory.addFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
+                    new PeriodicExecutionContext(),
+                    new PeriodicExecutionContext());
     }
 
     /**
+     * {@.ja PeriodicExecutionContext を生成する}
+     * {@.en Creats PeriodicExecutionContext}
+     * 
+     * @return 
+     *   {@.ja 生成されたinstance}
+     *   {@.en Object Created instances}
+     *
+     *
+     */
+    public ExecutionContextBase creator_() {
+        return new PeriodicExecutionContext();
+    }
+    /**
+     * {@.ja Object を破棄する}
+     * {@.en Destructs Object}
+     * 
+     * @param obj
+     *   {@.ja 破棄するインタスタンス}
+     *   {@.en The target instances for destruction}
+     *
+     */
+    public void destructor_(Object obj) {
+        obj = null;
+    }
+    /**
      * <p>ExecutionContextのインスタンスを取得します。</p>
      * 
      * @return ExecutionContextインスタンス
@@ -1077,4 +1189,115 @@
             return m_obj._is_equivalent((RTC.RTObject)object);
         }
     }
+
+    /**
+     * {@.ja ExecutionContextクラスの初期化関数}
+     * {@.en Initialization function of ExecutionContext class}
+     */
+    public void init(Properties props) {
+    }
+
+    /**
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
+     */
+/*
+    public void setObjRef(final ExecutionContextService ref) {
+        m_profile.setObjRef(ref);
+    }
+*/
+    /**
+     * {@.ja CORBA オブジェクト参照の取得}
+     * {@.en Get the reference to the CORBA object}
+     * <p>
+     * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
+     * クト参照を取得する。}
+     * {@.en Get the reference to the CORBA object as
+     * ExecutioncontextService of this object.}
+     *
+     * @return 
+     *   {@.ja CORBA オブジェクト参照}
+     *   {@.en The reference to CORBA object}
+     *
+     */
+    public ExecutionContextService getObjRef() {
+      return m_profile.getObjRef();
+    }
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を設定する}
+     * {@.en Set execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を設定す
+     * る。実行周期の変更は、DataFlowComponentAction の
+     * on_rate_changed によって各RTコンポーネントに伝達される。}
+     * {@.en This operation shall set the rate (in hertz) at which this
+     * context’s Active participating RTCs are being called.  If the
+     * execution kind of the context is PERIODIC, a rate change shall
+     * result in the invocation of on_rate_changed on any RTCs
+     * realizing DataFlowComponentAction that are registered with any
+     * RTCs participating in the context.}
+     *
+     * @param rate
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     * @return 
+     *   {@.ja ReturnCode_t 型のリターンコード
+     *         RTC_OK: 正常終了
+     *         BAD_PARAMETER: 設定値が負の値}
+     *   {@.en The return code of ReturnCode_t type
+     *         RTC_OK: Succeed
+     *         BAD_PARAMETER: Invalid value. The value might be negative.}
+     *
+     */
+    public ReturnCode_t setRate(double rate) {
+      return m_profile.setRate(rate);
+    }
+    /**
+     * {@.ja ExecutionContext の実行周期(Hz)を取得する}
+     * {@.en Get execution rate(Hz) of ExecutionContext}
+     * <p>
+     * {@.ja Active 状態にてRTコンポーネントが実行される周期(単位:Hz)を取得す
+     * る。}
+     * {@.en This operation shall return the rate (in hertz) at which its
+     * Active participating RTCs are being invoked.}
+     *
+     * @return 
+     *   {@.ja 処理周期(単位:Hz)}
+     *   {@.en Execution cycle(Unit:Hz)}
+     *
+     */
+    public double getRate()  {
+      return m_profile.getRate();
+    }
+    /**
+     * {@.ja ExecutionKind を文字列化する}
+     * {@.en Converting ExecutionKind enum to string}
+     * <p>
+     * {@.ja RTC::ExecutionKind で定義されている PERIODIC, EVENT_DRIVEN,
+     * OTHER を文字列化する。}
+     * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+     * OTHER) defined in RTC::ExecutionKind to string.}
+     *
+     * @param kind 
+     *   {@.ja ExecutionKind}
+     *   {@.en ExecutionKind}
+     * @return 
+     *   {@.ja 文字列化されたExecutionKind}
+     *   {@.en String of ExecutionKind}
+     *
+     */
+    public final String getKindString(ExecutionKind kind) {
+      return m_profile.getKindString(kind);
+    }
 }



More information about the openrtm-commit mailing list