[openrtm-commit:00528] r621 - in trunk/jp.go.aist.rtm.RTC/src: RTMExamples/SimpleIO jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 12月 28日 (水) 15:25:08 JST
Author: fsi-katami
Date: 2011-12-28 15:25:08 +0900 (Wed, 28 Dec 2011)
New Revision: 621
Added:
trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserManagerAction.java
trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserModuleAction.java
trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserNamingAction.java
trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserRtcLifeCycle.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceAdmin.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceBase.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceFactory.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceProfile.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java
Modified:
trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInComp.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
Log:
LocalService framework to realize additional services in the manager has been introduced.
Manager's call-backs to hook manager's events (manager, naming, RTC creation, etc.) have been implemented.
refs #2301
Modified: trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInComp.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInComp.java 2011-12-28 06:16:42 UTC (rev 620)
+++ trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInComp.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -69,6 +69,18 @@
// Initialize manager
final Manager manager = Manager.init(args);
+ UserRtcLifeCycle rtclife
+ = new UserRtcLifeCycle();
+ manager.addRtcLifecycleActionListener(rtclife);
+ UserManagerAction manageraction
+ = new UserManagerAction();
+ manager.addManagerActionListener(manageraction);
+ UserModuleAction moduleaction
+ = new UserModuleAction();
+ manager.addModuleActionListener(moduleaction);
+ UserNamingAction namingaction
+ = new UserNamingAction();
+ manager.addNamingActionListener(namingaction);
// Set module initialization proceduer
// This procedure will be invoked in activateManager() function.
ConsoleInComp init = new ConsoleInComp();
Copied: trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserManagerAction.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserManagerAction.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserManagerAction.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserManagerAction.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,27 @@
+package RTMExamples.SimpleIO;
+
+import jp.go.aist.rtm.RTC.ManagerActionListener;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+public class UserManagerAction extends ManagerActionListener{
+ public void operator() {
+ ;
+ }
+ public void preShutdown(){
+ System.out.println("UserManagerAction.preShutdown");
+ }
+ public void postShutdown() {
+ System.out.println("UserManagerAction.postShutdown");
+ }
+
+ public void preReinit(){
+ System.out.println("UserManagerAction.preReinit()");
+ }
+
+ public void postReinit() {
+ System.out.println("UserManagerAction.postReinit()");
+ }
+
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserModuleAction.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserModuleAction.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserModuleAction.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserModuleAction.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,29 @@
+package RTMExamples.SimpleIO;
+
+import jp.go.aist.rtm.RTC.ModuleActionListener;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+public class UserModuleAction extends ModuleActionListener{
+ public void operator() {
+ ;
+ }
+ public void preLoad(String modname,
+ String funcname){
+ System.out.println("UserModuleAction.preLoad "+modname+" "+funcname);
+ }
+ public void postLoad(String modname,
+ String funcname) {
+ System.out.println("UserModuleAction.postLoad "+modname+" "+funcname);
+ }
+
+ public void preUnload(String modname){
+ System.out.println("UserModuleAction.preUnload() "+modname );
+ }
+
+ public void postUnload(String modname) {
+ System.out.println("UserModuleAction.postUnload() "+modname);
+ }
+
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserNamingAction.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserNamingAction.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserNamingAction.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserNamingAction.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,31 @@
+package RTMExamples.SimpleIO;
+
+import jp.go.aist.rtm.RTC.NamingActionListener;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+public class UserNamingAction extends NamingActionListener{
+ public void operator() {
+ ;
+ }
+ public void preBind(RTObject_impl rtobj,
+ String[] name){
+ System.out.println("UserNamingAction.preBind");
+ }
+ public void postBind(RTObject_impl rtobj,
+ String[] name) {
+ System.out.println("UserNamingAction.postBind");
+ }
+
+ public void preUnbind(RTObject_impl rtobj,
+ String[] name){
+ System.out.println("UserNamingAction.preUnbind");
+ }
+
+ public void postUnbind(RTObject_impl rtobj,
+ String[] name){
+ System.out.println("UserNamingAction.postUnbind");
+ }
+
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserRtcLifeCycle.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserRtcLifeCycle.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserRtcLifeCycle.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/UserRtcLifeCycle.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,42 @@
+package RTMExamples.SimpleIO;
+
+import jp.go.aist.rtm.RTC.RtcLifecycleActionListener;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+public class UserRtcLifeCycle extends RtcLifecycleActionListener{
+ public void operator() {
+ ;
+ }
+ public void preCreate(String args){
+ System.out.println("UserRtcLifeCycle.preCreate("+args+")");
+ }
+ public void postCreate(RTObject_impl rtobj) {
+ System.out.println("UserRtcLifeCycle.postCreate("+rtobj+")");
+ }
+
+ public void preConfigure(Properties prop){
+ String str = new String();
+ str = prop._dump(str,prop,0);
+ System.out.println("UserRtcLifeCycle.preConfigure()");
+ System.out.println(str);
+ }
+
+ public void postConfigure(Properties prop) {
+ String str = new String();
+ str = prop._dump(str,prop,0);
+ System.out.println("UserRtcLifeCycle.postConfigure()");
+ System.out.println(str);
+ }
+
+ public void preInitialize(){
+ System.out.println("UserRtcLifeCycle.preInitialize()");
+ ;
+ }
+
+ public void postInitialize(){
+ System.out.println("UserRtcLifeCycle.postInitialize()");
+ ;
+ }
+}
+
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2011-12-28 06:16:42 UTC (rev 620)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -62,6 +62,7 @@
"manager.command", "rtcd",
"sdo.service.provider.enabled_services", "ALL",
"sdo.service.consumer.enabled_services", "ALL",
+ "manager.local_service.enabled_services","ALL",
""
};
}
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,117 @@
+package jp.go.aist.rtm.RTC;
+
+
+import java.util.Observable;
+import java.util.Observer;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+
+ /**
+ * {@.ja LocalServiceActionListener クラス}
+ * {@.en LocalServiceActionListener class}
+ * <p>
+ * {@.ja 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ *
+ * - ADD_PORT:
+ * - REMOVE_PORT:}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ */
+public abstract class LocalServiceActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ LocalServiceActionListenerArgument arg = (LocalServiceActionListenerArgument)obj;
+ if(arg.m_method_name.equals("preServiceRegister")){
+ preServiceRegister(arg.m_service_name);
+ }
+ else if(arg.m_method_name.equals("postServiceRegister")){
+ postServiceRegister(arg.m_service_name,arg.m_service);
+ }
+ else if(arg.m_method_name.equals("preServiceInit")){
+ preServiceInit(arg.m_prop,arg.m_service);
+ }
+ else if(arg.m_method_name.equals("postServiceInit")){
+ postServiceInit(arg.m_prop,arg.m_service);
+ }
+ else if(arg.m_method_name.equals("preServiceReinit")){
+ preServiceReinit(arg.m_prop,arg.m_service);
+ }
+ else if(arg.m_method_name.equals("postServiceReinit")){
+ postServiceReinit(arg.m_prop,arg.m_service);
+ }
+ else if(arg.m_method_name.equals("postServiceFinalize")){
+ postServiceFinalize(arg.m_service_name, arg.m_service);
+ }
+ else if(arg.m_method_name.equals("preServiceFinalize")){
+ preServiceFinalize(arg.m_service_name,arg.m_service);
+ }
+ else{
+ operator(arg.m_service_name);
+ }
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja LocalServiceActionListener のコールバック関数}
+ * {@.en This is a the Callback function for LocalServiceActionListener.}
+ *
+ */
+ public abstract void operator(final String service_name);
+
+ /**
+ * {@.ja preServiceRegister コールバック関数}
+ * {@.en preServiceRegister callback function}
+ */
+ public abstract void preServiceRegister(String service_name);
+
+ /**
+ * {@.ja postServiceRegister コールバック関数}
+ * {@.en postServiceRegister callback function}
+ */
+ public abstract void postServiceRegister(String service_name,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja preServiceInit コールバック関数}
+ * {@.en preServiceInit callback function}
+ */
+ public abstract void preServiceInit(Properties prop,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja postServiceInit コールバック関数}
+ * {@.en postServiceInit callback function}
+ */
+ public abstract void postServiceInit(Properties prop,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja preServiceReinit コールバック関数}
+ * {@.en preServiceReinit callback function}
+ */
+ public abstract void preServiceReinit(Properties prop,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja postServiceReinit コールバック関数}
+ * {@.en postServiceReinit callback function}
+ */
+ public abstract void postServiceReinit(Properties prop,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja postServiceFinalize コールバック関数}
+ * {@.en postServiceFinalize callback function}
+ */
+ public abstract void postServiceFinalize(String service_name,
+ LocalServiceBase service);
+
+ /**
+ * {@.ja preServiceFinalize コールバック関数}
+ * {@.en preServiceFinalize callback function}
+ */
+ public abstract void preServiceFinalize(String service_name,
+ LocalServiceBase service);
+};
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,42 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+
+ /**
+ * {@.ja LocalServiceActionListenerArgument クラス}
+ * {@.en LocalServiceActionListenerArgument class}
+ *
+ *
+ */
+public class LocalServiceActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public LocalServiceActionListenerArgument(String method_name,
+ Properties prop,
+ LocalServiceBase service){
+ m_method_name = method_name;
+ m_prop = prop;
+ m_service = service;
+ }
+ public LocalServiceActionListenerArgument(String method_name,
+ String service_name,
+ LocalServiceBase service){
+ m_method_name = method_name;
+ m_service_name = service_name;
+ m_service = service;
+ }
+ public LocalServiceActionListenerArgument(String method_name,
+ String service_name){
+ m_method_name = method_name;
+ m_service_name = service_name;
+ }
+ public String m_method_name;
+ public Properties m_prop;
+ public LocalServiceBase m_service;
+ public String m_service_name;
+}
+
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,123 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+
+ /**
+ * {@.ja LocalServiceActionListenerHolder クラス}
+ * {@.en LocalServiceActionListenerHolder class}
+ * <p>
+ * {@.ja 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ *
+ * - ADD_PORT:
+ * - REMOVE_PORT:}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ *
+ */
+public class LocalServiceActionListenerHolder extends Observable {
+
+ // registration instance of service to svc admin
+ /**
+ * {@.ja preServiceRegister コールバック関数}
+ * {@.en preServiceRegister callback function}
+ */
+ public void preServiceRegister(String service_name){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("preServiceRegister",service_name);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postServiceRegister コールバック関数}
+ * {@.en postServiceRegister callback function}
+ */
+ public void postServiceRegister(String service_name,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("postServiceRegister",service_name,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preServiceInit コールバック関数}
+ * {@.en preServiceInit callback function}
+ */
+ public void preServiceInit(Properties prop,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("preServiceInit",prop,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ /**
+ * {@.ja postServiceInit コールバック関数}
+ * {@.en postServiceInit callback function}
+ */
+ public void postServiceInit(Properties prop,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("postServiceInit",prop,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preServiceReinit コールバック関数}
+ * {@.en preServiceReinit callback function}
+ */
+ public void preServiceReinit(Properties prop,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("preServiceReinit",prop,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ /**
+ * {@.ja postServiceReinit コールバック関数}
+ * {@.en postServiceReinit callback function}
+ */
+ public void postServiceReinit(Properties prop,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("postServiceReinit",prop,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postServiceFinalize コールバック関数}
+ * {@.en postServiceFinalize callback function}
+ */
+ public void postServiceFinalize(String service_name,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("postServiceFinalize",service_name,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ /**
+ * {@.ja preServiceFinalize コールバック関数}
+ * {@.en preServiceFinalize callback function}
+ */
+ public void preServiceFinalize(String service_name,
+ LocalServiceBase service){
+ super.setChanged();
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("preServiceFinalize",service_name,service);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceAdmin.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceAdmin.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceAdmin.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceAdmin.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,296 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+
+import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.StringUtil;
+
+ /**
+ * {@.ja LocalService 管理クラス}
+ * {@.en SDO service administration class}
+ *
+ */
+public class LocalServiceAdmin {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ * <p>
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ private LocalServiceAdmin() {
+ rtcout = new Logbuf("LocalServiceAdmin");
+ rtcout.println(Logbuf.TRACE, "LocalServiceAdmin::LocalServiceAdmin()");
+ }
+
+
+ /**
+ *
+ */
+ public static LocalServiceAdmin instance() {
+ return _instance;
+ }
+ /**
+ * {@.ja "all" 文字列探索Functor}
+ * {@.en A functor to search "all"}
+ */
+ private class find_all {
+ public boolean is_all(final String str) {
+ String a = str;
+ if(StringUtil.normalize(a).equals("all")){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ public int find_if(String str[]) {
+ int ic;
+ for(ic=0;ic<str.length;++ic){
+ if(this.is_all(str[ic])){
+ break;
+ }
+ }
+ return ic;
+ }
+ };
+ /**
+ * {@.ja LocaServiceAdminの初期化}
+ * {@.en Initialization of LocalServiceAdmin}
+ *
+ */
+ public void init(Properties props) {
+ rtcout.println(Logbuf.TRACE, "LocalServiceAdmin::init():");
+ String str = new String();
+ props._dump(str,props,0);
+ rtcout.println(Logbuf.TRACE, str);
+ String es = props.getProperty("enabled_services");
+ String svcs[] = es.split(",");
+ find_all fa = new find_all();
+ boolean all_enable = false;
+
+ if(fa.find_if(svcs)!=svcs.length){
+ rtcout.println(Logbuf.INFO,"All the local services are enabled.");
+ all_enable = true;
+ }
+
+ LocalServiceFactory<LocalServiceBase,String> factory = LocalServiceFactory.instance();
+ Set ids = factory.getIdentifiers();
+ rtcout.println(Logbuf.DEBUG,"Available services: " + StringUtil.flatten(ids));
+
+ Vector vsvcs = new Vector();
+ for (int ic = 0; ic < svcs.length; ++ic) {
+ vsvcs.add(svcs[ic]);
+ }
+
+ Iterator it = ids.iterator();
+ while (it.hasNext()) {
+ String id_str = (String)it.next();
+ if (all_enable || isEnabled(id_str, vsvcs)) {
+ if (notExisting(id_str)) {
+ LocalServiceBase service = factory.createObject(id_str);
+ rtcout.println(Logbuf.DEBUG,"Service created: "+id_str);
+ Properties prop = props.getNode(id_str);
+ service.init(prop);
+ addLocalService(service);
+ }
+ }
+ }
+ }
+ /**
+ * {@.ja LocalserviceAdmin の終了処理}
+ * {@.en Finalization ofLocalServiceAdmin}
+ *
+ *
+ */
+ public void _finalize() {
+ LocalServiceFactory factory = LocalServiceFactory.instance();
+ Iterator it = m_services.iterator();
+ while (it.hasNext()) {
+ LocalServiceBase lsb = (LocalServiceBase)it.next();
+ lsb._finalize();
+ factory.deleteObject(lsb);
+ }
+ m_services.clear();
+ }
+
+
+ /**
+ * {@.ja LocalServiceProfileListの取得}
+ * {@.en Getting LocalServiceProfileList}
+ *
+ */
+ public LocalServiceProfile[] getServiceProfiles() {
+ LocalServiceProfile[] profs = new LocalServiceProfile[m_services.size()];
+ for (int ic=0; ic < m_services.size(); ++ic) {
+ profs[ic] = m_services.get(ic).getProfile();
+ }
+ return profs;
+ }
+
+ /**
+ * {@.ja LocalServiceProfile を取得する}
+ * {@.en Get LocalServiceProfile of an LocalService}
+ * <p>
+ * {@.ja id で指定されたIDを持つLocalService の
+ * LocalServiceProfile を取得する。id が NULL ポインタの場合、指定された
+ * id に該当するServiceProfile が存在しない場合、falseを返す。}
+ * {@.en This operation returns LocalServiceProfile of a LocalService
+ * which has the specified id. If the specified id is
+ * NULL pointer or the specified id does not exist in the
+ * ServiceProfile list, false will be returned.}
+ *
+ * @param name
+ * {@.ja LocalService の IFR ID}
+ * {@.en ID of an LocalService}
+ * @param prof
+ * @return
+ * {@.ja 指定された id を持つ LocalServiceProfile}
+ * {@.en LocalServiceProfile which has the specified id}
+ *
+ */
+ public boolean getServiceProfile(String name,
+ LocalServiceProfile prof) {
+ synchronized (m_services) {
+ Iterator it = m_services.iterator();
+ while (it.hasNext()) {
+ LocalServiceBase lsb = (LocalServiceBase)it.next();
+ if (name == lsb.getProfile().name) {
+ prof = lsb.getProfile();
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@.ja LocalService の Service を取得する}
+ * {@.en Get a pointer of a LocalService}
+ * <p>
+ * {@.ja id で指定されたIDを持つLocalService のポインタを取得する。id が
+ * NULL ポインタの場合、指定された id に該当するServiceProfile が存
+ * 在しない場合、NULLを返す。}
+ * {@.en This operation returnes a pointer to the LocalService
+ * which has the specified id. If the specified id is
+ * NULL pointer or the specified id does not exist in the
+ * ServiceProfile list, NULL pointer will be returned.}
+ *
+ * @param id
+ * {@.ja LocalService の ID}
+ * {@.en ID of a LocalService}
+ * @return
+ * {@.ja 指定された id を持つ LocalService のポインタ}
+ * {@.en a pointer which has the specified id}
+ *
+ */
+ public LocalServiceBase getService(final String id) {
+ Iterator it = m_services.iterator();
+ while (it.hasNext()) {
+ LocalServiceBase lsb = (LocalServiceBase)it.next();
+ if (lsb.getProfile().name == id) {
+ return lsb;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * {@.ja SDO service provider をセットする}
+ * {@.en Set a SDO service provider}
+ *
+ */
+ public boolean addLocalService(LocalServiceBase service) {
+ if (service == null) {
+ rtcout.println(Logbuf.ERROR,"Invalid argument: addLocalService(service == NULL)");
+ return false;
+ }
+ rtcout.println(Logbuf.TRACE,"LocalServiceAdmin::addLocalService("+
+ service.getProfile().name+")");
+ synchronized (m_services) {
+ m_services.add(service);
+ }
+ return true;
+ }
+
+ /**
+ * {@.ja LocalService を削除する}
+ * {@.en Remove a LocalService}
+ *
+ *
+ */
+ public boolean removeLocalService(final String name) {
+ rtcout.println(Logbuf.TRACE,"removeLocalService("+name+")");
+ synchronized (m_services){
+
+ Iterator it = m_services.iterator();
+ while (it.hasNext()) {
+ LocalServiceBase lsb = (LocalServiceBase)it.next();
+ if (name == lsb.getProfile().name) {
+ lsb._finalize();
+ LocalServiceFactory
+ factory = LocalServiceFactory.instance();
+ factory.deleteObject(lsb);
+ m_services.remove(lsb);
+ rtcout.println(Logbuf.INFO,"SDO service has been deleted: "+name);
+ return true;
+ }
+ }
+ rtcout.println(Logbuf.WARN,"Specified SDO service not found: "+name);
+ return false;
+ }
+ }
+
+ /**
+ * {@.ja 指定されたIDが有効かどうかチェックする}
+ * {@.en Check if specified ID is enabled}
+ */
+ private boolean isEnabled(final String id, final Vector<String> enabled) {
+ boolean ret = enabled.contains(id);
+ rtcout.println(Logbuf.DEBUG,"Local service "+id +" "+ ret +" enabled.");
+ return ret;
+ }
+
+ /**
+ * {@.ja 指定されたIDがすでに存在するかどうかチェックする}
+ * {@.en Check if specified ID is existing}
+ */
+ private boolean notExisting(final String id) {
+ synchronized (m_services) {
+ Iterator it = m_services.iterator();
+ while (it.hasNext()) {
+ LocalServiceBase lsb = (LocalServiceBase)it.next();
+ if (lsb.getProfile().name == id) {
+ rtcout.println(Logbuf.WARN, "Local service "+id+" already exists.");
+ return false;
+ }
+ }
+ rtcout.println(Logbuf.DEBUG,"Local service "+id+" does not exist.");
+ }
+ return true;
+ }
+
+ /**
+ * {@.ja Lock 付き SDO ServiceProfileList}
+ * {@.en SDO ServiceProfileList with mutex lock}
+ */
+ private Vector<LocalServiceBase> m_services = new Vector<LocalServiceBase>();
+ private String m_services_mutex;
+
+ /**
+ * {@.ja logger}
+ * {@.en logger}
+ */
+ private Logbuf rtcout;
+ /**
+ * {@.ja The only instance}
+ * {@.en The only instance}
+ */
+ private static final LocalServiceAdmin _instance = new LocalServiceAdmin();
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceBase.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceBase.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceBase.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceBase.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,155 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+ /**
+ * {@.ja LocalService 基底クラス}
+ * <p>
+ * {@.ja Local Service とは RT-Middlewareのマネージャデーモン内で各種サービ
+ * スを提供するための仕組みである。Local Serviceにはいくつかのユース
+ * ケースが考えられる。
+ *
+ * 1. RTCの内部ロジックに対してサービスを提供する。コンポーネントの開
+ * 発者は、一定の艇順を経て、Local Serviceのインスタンスへの参照を得
+ * て、このサービスを利用することができる。
+ *
+ * 2. マネージャ等に機能を追加するためのサービス。たとえは、RTCの名前
+ * を登録するCORBAネームサービスの代わりに、新たなディレクトリサービ
+ * スやブロードキャストによる名前通知機能などを新たな機能をマネージャ
+ * に追加するために利用することができる。マネージャには、様々なアクショ
+ * ンに対するフックが用意されており、これを利用することで、マネージャ
+ * の様々なイベントに対してアクションを起こすことができる。
+ *
+ * 3. マネージャは自身のサービス以外に付加的に外部に対してサービスを
+ * 提供する機能を有する。外部からCORBA経由で、ローカルの機能、たとえ
+ * ばデバイスやリソースのマネジメント機能に対してアクセスする方法を提
+ * 供する。サービスのインスタンス化後に、マネージャに対して、マネージャ
+ * サービスとして登録することで、外部からのアクセスを受け付けることが
+ * できるようになる。
+ *
+ * Local Service はモジュールとしてロードされ、通常唯一のインスタンス
+ * が生成される。すなわち、LocalService はシングルトンとして実装され
+ * る。インスタンス化されたサービスはサービスリストに登録され、RTC等
+ * からは名前やUUIDによってインスタンスの参照を入手することができる。
+ *
+ * このオブジェクトのライフサイクルは以下の通り。
+ *
+ * -# オブジェクトは通常、共有オブジェクト (so, DLL) としてコンパイル・
+ * リンクされる。
+ * -# マネージャに対してロードされるとモジュール初期化関数によりオブ
+ * ジェクトファクトリが、LocalServiceFactory に対して登録される。
+ * 登録のキーにはUUIDと名前が利用され、これによりサービスが区別さ
+ * れる。
+ * -# rtc.conf等のコンフィギュレーション指定により、有効化することが
+ * 指定されているサービスインプロバイダは、RTCの起動と同時にインス
+ * タンス化される。
+ * -# インスタンス化後、初期化関数 init() が呼ばれる。引数には当該サー
+ * ビスのためのコンフィギュレーションオプションが coil::Propertyに
+ * より渡される。
+ * -# マネージャサービスオペレーション reinit が呼ばれると、すべての
+ * Local Service お reinit が呼び出され、更新されたコンフィギュレー
+ * ション情報が読み込まれる。
+ * -# マネージャ解体時には、すべての Local Service の finalizeが呼び
+ * 出され、解体されるので、ここでリソースの解放など終了処理を行
+ * う。
+ *
+ * このクラスの実装に当たっては、少なくとも以下の純粋仮想関数を実装す
+ * る必要がある。
+ *
+ * - init(): 初期化関数。与えられた RTObject および ServiceProfile か
+ * ら、当該オブジェクトを初期化する。
+ * - reinit(): 再初期化関数。ServiceProfile は設定情報更新のため同一
+ * IDで呼び出されることが有るが、その際にこの関数が新たな
+ * ServiceProfile とともに呼び出される。関数内では、設定の変更など
+ * 再初期化処理を実装する。
+ * - getProfile(): 設定されたプロファイルを返す関数。
+ * - finalize(): 終了処理。コンシューマがデタッチされる際に呼び出され
+ * る関数。関数内では終了処理を実装する。
+ *
+ * LocalService は通常共有オブジェクトとしてコンパイル・リンク
+ * される。共有オブジェクトのエントリポイントは通常コンパイルされたファ
+ * イル名の basename + "Init" にしておく。以下に、クラス名、ファイル
+ * 名、エントリポイント関数名の推奨例を示す。
+ *
+ * - 実装クラス名: MyLocalService
+ * - ファイル名: MyLocalService.h. MyLocalService.cpp
+ * - 共有オブジェクト名: MyLocalService.so (or DLL)
+ * - エントリポイント関数名: MyLocalServiceInit()
+ *
+ * エントリポイント関数は通常以下のように、LocalServiceFactory
+ * に当該コンシューマのファクトリ (と解体ファンクタ) を登録する以下の
+ * ような関数になる。}
+ *
+ * <pre>
+ * extern "C"
+ * {
+ * void MyLocalServiceInit()
+ * {
+ * RTC::LocalServiceFactory& factory
+ * = RTC::LocalServiceFactory::instance();
+ * factory.addFactory(::RTC::MyLocalSerivce::name,
+ * ::coil::Creator< ::RTC::LocalServiceBase,
+ * ::RTC::MyLocalService>,
+ * ::coil::Destructor< ::RTC::LocalServiceBase,
+ * ::RTC::MyLocalService>);
+ * }
+ * };
+ * </pre>
+ *
+ *
+ */
+public interface LocalServiceBase {
+ /**
+ * {@.ja LocalServiceクラスの初期化関数}
+ * {@.en Initialization function of the LocalService class}
+ * <p>
+ * {@.ja このオブジェクトの初期化を行う。LocalService を実装する場合、外
+ * 部からの設定情報は、このinit()関数により与えられる。}
+ *
+ * @param props
+ * {@.ja 外部から与えられた Properties}
+ * @return
+ * {@.ja 与えられた LocalServiceProfile が不正の場合 false}
+ *
+ *
+ */
+ public boolean init(final Properties props);
+ /**
+ * {@.ja LocalServiceクラスの再初期化関数}
+ * {@.en Reinitialization function of the LocalService class}
+ * <p>
+ * @param props
+ * {@.ja 新たに与えられた Properties}
+ * @return
+ * {@.ja 不正な LocalServiceProfile が与えられた場合は false}
+ *
+ *
+ *
+ */
+ public boolean reinit(final Properties props);
+
+ /**
+ * {@.ja LocalServiceProfile を返す}
+ * {@.en Getting LocalServiceProfile}
+ * <p>
+ * {@.ja init()/reinit()で与えられた LocalServiceProfile は通常オブジェク
+ * ト内で保持される。この関数では保持されている ServiceProfile を返
+ * す。}
+ *
+ * @return
+ * {@.ja このオブジェクトが保持している LocalServiceProfile}
+ *
+ */
+ public LocalServiceProfile getProfile();
+
+ /**
+ * {@.ja 終了処理}
+ * {@.en Finalization}
+ * <p>
+ * {@.ja LocalService が終了する際に呼び出される終了処理用関数。当該オブ
+ * ジェクトが保持するリソースを解放するなどの処理を行う。}
+ *
+ */
+ public void _finalize();
+
+
+}
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceFactory.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceFactory.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceFactory.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceFactory.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,36 @@
+package jp.go.aist.rtm.RTC;
+
+/**
+ * {@.ja LocalService用ファクトリの実装。}
+ * {@.en This class is a factory for LocalService.}
+ */
+public class LocalServiceFactory<ABSTRACTCLASS,IDENTIFIER> extends FactoryGlobal<ABSTRACTCLASS,IDENTIFIER> {
+
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ */
+ private LocalServiceFactory() {
+
+ }
+ /**
+ * {@.ja LocalServiceFactoryのインスタンスを生成する。}
+ * {@.en Creates a instance of LocalServiceFactory.}
+ * @return
+ * {@.ja LocalServiceFactoryオブジェクト}
+ * {@.en LocalServiceFactory object}
+ */
+ public static LocalServiceFactory instance() {
+ return (LocalServiceFactory)instance("jp.go.aist.rtm.RTC.LocalServiceFactory");
+ }
+ /**
+ * <p> mutex </p>
+ */
+ private static String factory_global_mutex = new String();
+ /**
+ * <p> object </p>
+ */
+ private static BufferFactory factory_global;
+}
+
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceProfile.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceProfile.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceProfile.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceProfile.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,30 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+ /**
+ * {@.ja LocalServiceのプロファイルデータ}
+ * {@.en Profile data structure of LocalService}
+ */
+public interface LocalServiceProfile {
+ /**
+ * {@.ja LocalServiceのサービス名}
+ * {@.en The name of LocalService}
+ */
+ public String name = new String();
+ /**
+ * {@.ja LocalServiceの固有ID}
+ * {@.en The unique ID of LocalService}
+ */
+ public String uuid = new String();
+ /**
+ * {@.ja @brief LocalServiceのプロパティ}
+ * {@.en Properties of LocalService}
+ */
+ public Properties properties = new Properties();
+ /**
+ * {@.ja LocalServiceのポインタ}
+ * {@.en The pointer to LocalService}
+ */
+ public LocalServiceBase service = null;
+}
+
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2011-12-28 06:16:42 UTC (rev 620)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -227,7 +227,7 @@
public void shutdown() {
rtcout.println(Logbuf.TRACE, "Manager.shutdown()");
-
+ m_listeners.manager_.preShutdown();
shutdownComponents();
shutdownNaming();
shutdownORB();
@@ -246,7 +246,8 @@
} else {
join();
}
-
+
+ m_listeners.manager_.postShutdown();
shutdownLogger();
}
@@ -373,6 +374,8 @@
bindManagerServant();
+ initLocalService();
+
preloadComponent();
if (m_initProc != null) {
@@ -533,12 +536,14 @@
String file_name = moduleFileName;
String init_func = initFunc;
+ m_listeners.module_.preLoad(file_name, init_func);
try {
if (init_func==null||init_func.equals("")) {
init_func = "registerModule";
}
String path = m_module.load(file_name, init_func);
rtcout.println(Logbuf.DEBUG, "module path: "+path);
+ m_listeners.module_.postLoad(path, init_func);
return path;
} catch (Exception e) {
@@ -564,8 +569,10 @@
public void unload(final String moduleFileName) throws Exception {
rtcout.println(Logbuf.TRACE, "Manager.unload("+moduleFileName+")");
-
+
+ m_listeners.module_.preUnload(moduleFileName);
m_module.unload(moduleFileName);
+ m_listeners.module_.postUnload(moduleFileName);
}
/**
@@ -843,6 +850,7 @@
if( comp_args == null || comp_args.equals("") ) {
return null;
}
+ m_listeners.rtclifecycle_.preCreate(comp_args);
//------------------------------------------------------------
// extract "comp_type" and "comp_prop" from comp_arg
@@ -971,76 +979,24 @@
rtcout.println(Logbuf.TRACE,
"RTC Created: " + comp_id.getProperty("implementaion_id"));
+ m_listeners.rtclifecycle_.postCreate(comp);
prop.merge(comp_prop);
-/* zxc
- for (i=0, len=m_factory.m_objects.size(); i < len; ++i) {
- FactoryBase factory = m_factory.m_objects.elementAt(i);
- if (factory == null) {
- return null;
- }
-
- if (factory.m_Profile.getProperty("implementation_id").equals(comp_id.getProperty("implementation_id"))) {
- prop = factory.profile();
-
- Vector<String> keyval = comp_prop.propertyNames();
- for (int ic=0, lenc=comp_prop.size(); ic < lenc; ++ic) {
- prop.setProperty(keyval.get(ic) ,
- comp_prop.getProperty(keyval.get(ic)));
- }
-
- final String[] inherit_prop = {
- "exec_cxt.periodic.type",
- "exec_cxt.periodic.rate",
- "exec_cxt.evdriven.type",
- "naming.formats",
- "logger.enable",
- "logger.log_level",
- "naming.enable",
- "naming.type",
- "naming.formats",
- ""
- };
-
- for (int ic=0; inherit_prop[ic].length() != 0; ++ic) {
- // if (prop.hasKey() == NULL) continue;
- prop.setProperty(inherit_prop[ic],
- m_config.getProperty(inherit_prop[ic]));
- }
-
- comp = m_factory.m_objects.elementAt(i).create(this);
- if (comp == null) {
- rtcout.println(Logbuf.ERROR,
- "RTC creation failed: "
- + comp_id.getProperty("implementaion_id"));
- return null;
- }
- rtcout.println(Logbuf.TRACE,
- "RTC Created: " + comp_id.getProperty("implementaion_id"));
- break;
- }
- }
- if(i == m_factory.m_objects.size()) {
- rtcout.println(Logbuf.ERROR,
- "Factory not found: " + comp_id.getProperty("implementaion_id"));
- return null;
- }
- if( comp == null ) {
- return null;
- }
-*/
//------------------------------------------------------------
// Load configuration file specified in "rtc.conf"
//
// rtc.conf:
// [category].[type_name].config_file = file_name
// [category].[instance_name].config_file = file_name
+ m_listeners.rtclifecycle_.preConfigure(prop);
configureComponent(comp, prop);
+ m_listeners.rtclifecycle_.postConfigure(prop);
// comp.setProperties(prop);
//------------------------------------------------------------
// Component initialization
+ m_listeners.rtclifecycle_.preInitialize();
if( comp.initialize() != ReturnCode_t.RTC_OK ) {
rtcout.println(Logbuf.TRACE,
"RTC initialization failed: "
@@ -1052,6 +1008,7 @@
"RTC initialization succeeded: "
+ comp_id.getProperty("implementaion_id"));
+ m_listeners.rtclifecycle_.postInitialize();
//------------------------------------------------------------
// Bind component to naming service
registerComponent(comp);
@@ -1322,13 +1279,16 @@
// NamingManagerのみで代用可能
m_compManager.registerObject(comp, new InstanceName(comp));
+
String[] names = comp.getNamingNames();
- for (int i = 0; i < names.length; ++i) {
- rtcout.println(Logbuf.TRACE, "Bind name: " + names[i]);
+ m_listeners.naming_.preBind(comp,names);
+ for (int ic = 0; ic < names.length; ++ic) {
+ rtcout.println(Logbuf.TRACE, "Bind name: " + names[ic]);
- m_namingManager.bindObject(names[i], comp);
+ m_namingManager.bindObject(names[ic], comp);
}
+ m_listeners.naming_.postBind(comp,names);
return true;
}
@@ -1358,11 +1318,13 @@
m_compManager.unregisterObject(new InstanceName(comp));
String[] names = comp.getNamingNames();
+ m_listeners.naming_.preUnbind(comp, names);
for (int i = 0; i < names.length; ++i) {
rtcout.println(Logbuf.TRACE, "Unbind name: " + names[i]);
m_namingManager.unbindObject(names[i]);
}
+ m_listeners.naming_.postUnbind(comp, names);
return true;
}
@@ -1677,6 +1639,122 @@
}
/**
+ *
+ */
+ public void
+ addManagerActionListener(ManagerActionListener listener,
+ boolean autoclean) {
+ m_listeners.manager_.addObserver(listener);
+ }
+ /**
+ *
+ */
+ public void
+ addManagerActionListener(ManagerActionListener listener){
+ addManagerActionListener(listener,true);
+ }
+ /**
+ *
+ */
+ public void
+ removeManagerActionListener(ManagerActionListener listener){
+ m_listeners.manager_.deleteObserver(listener);
+ }
+
+ /**
+ *
+ */
+ public void
+ addModuleActionListener(ModuleActionListener listener,
+ boolean autoclean) {
+ m_listeners.module_.addObserver(listener);
+ }
+ /**
+ *
+ */
+ public void
+ addModuleActionListener(ModuleActionListener listener){
+ addModuleActionListener(listener,true);
+ }
+ /**
+ *
+ */
+ public void
+ removeModuleActionListener(ModuleActionListener listener){
+ m_listeners.module_.deleteObserver(listener);
+ }
+
+ /**
+ *
+ */
+ public void
+ addRtcLifecycleActionListener(RtcLifecycleActionListener listener,
+ boolean autoclean){
+ m_listeners.rtclifecycle_.addObserver(listener);
+ }
+ /**
+ *
+ */
+ public void
+ addRtcLifecycleActionListener(RtcLifecycleActionListener listener){
+ addRtcLifecycleActionListener(listener,true);
+ }
+ /**
+ *
+ */
+ public void
+ removeRtcLifecycleActionListener(RtcLifecycleActionListener listener){
+ m_listeners.rtclifecycle_.deleteObserver(listener);
+ }
+
+ /**
+ *
+ */
+ public void
+ addNamingActionListener(NamingActionListener listener,
+ boolean autoclean){
+ m_listeners.naming_.addObserver(listener);
+ }
+ /**
+ *
+ */
+ public void
+ addNamingActionListener(NamingActionListener listener){
+ addNamingActionListener(listener,true);
+ }
+ /**
+ *
+ */
+ public void
+ removeNamingActionListener(NamingActionListener listener){
+ m_listeners.naming_.deleteObserver(listener);
+ }
+
+ /**
+ *
+ */
+ public void
+ addLocalServiceActionListener(LocalServiceActionListener listener,
+ boolean autoclean){
+ m_listeners.localservice_.addObserver(listener);
+ }
+ /**
+ *
+ */
+ public void
+ addLocalServiceActionListener(LocalServiceActionListener listener){
+ addLocalServiceActionListener(listener,true);
+ }
+ /**
+ *
+ */
+ public void
+ removeLocalServiceActionListener(LocalServiceActionListener listener){
+ m_listeners.localservice_.deleteObserver(listener);
+ }
+
+
+ /**
* {@.ja ORB のポインタを取得する。}
* {@.en Get the pointer to ORB}
*
@@ -2469,7 +2547,6 @@
protected void shutdownNaming() {
rtcout.println(Logbuf.TRACE, "Manager.shutdownNaming()");
-
m_namingManager.unbindAll();
}
@@ -3458,6 +3535,30 @@
}
}
/**
+ * {@.ja LocalService の初期化}
+ * {@.en LocalService initialization}
+ * @return Timer
+ * {@.ja 初期化処理実行結果(初期化成功:true、初期化失敗:false)}
+ * {@.en Initialization result (Successful:true, Failed:false)}
+ */
+ protected boolean initLocalService(){
+ rtcout.println(Logbuf.TRACE,"Manager::initLocalService()");
+
+ LocalServiceAdmin admin = LocalServiceAdmin.instance();
+ Properties prop = m_config.getNode("manager.local_service");
+ admin.init(prop);
+ rtcout.println(Logbuf.DEBUG,"LocalServiceAdmin's properties:");
+ String str = new String();
+ prop._dump(str,prop,0);
+ rtcout.println(Logbuf.TRACE, str);
+
+ LocalServiceProfile[] svclist = admin.getServiceProfiles();
+ for (int ic=0; ic < svclist.length; ++ic) {
+ rtcout.println(Logbuf.INFO,"Available local service: "+svclist[ic].name+" "+svclist[ic].uuid);
+ }
+ return true;
+ }
+ /**
* {@.ja コンポーネント削除用クラス}
* {@.en Class}
*
@@ -3473,6 +3574,8 @@
*/
Finalized m_finalized = new Finalized();
+ ManagerActionListeners m_listeners = new ManagerActionListeners();
+
//private static final String SERVER_HOST = "com.sun.CORBA.ORBServerHost";
//private static final String SERVER_PORT = "com.sun.CORBA.ORBServerPort";
//private static final String LISTENER_PORT = "com.sun.CORBA.POA.ORBPersistentServerPort";
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,66 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+ /**
+ * {@.ja ManagerActionListener}
+ * {@.en ManagerActionListener}
+ * <p>
+ * {@.ja - マネージャShutdownの直前: void onPreShutdown()
+ * - マネージャShutdownの直後: void onPostShutdown()
+ * - マネージャの再初期化直前: void onPreReinit()
+ * - マネージャの再初期化直後: void onPostReinit()}
+ *
+ */
+public abstract class ManagerActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ ManagerActionListenerArgument arg = (ManagerActionListenerArgument)obj;
+ if(arg.m_method.equals("preShutdown")){
+ preShutdown();
+ }
+ else if(arg.m_method.equals("postShutdown")){
+ postShutdown();
+ }
+ else if(arg.m_method.equals("preReinit")){
+ preReinit();
+ }
+ else if(arg.m_method.equals("postReinit")){
+ postReinit();
+ }
+ else{
+ operator();
+ }
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja ManagerActionListener のコールバック関数}
+ * {@.en This is a the Callback function for ManagerActionListener.}
+ *
+ */
+ public abstract void operator();
+ /**
+ * {@.ja preShutdown コールバック関数}
+ * {@.en preShutdown callback function}
+ */
+ public abstract void preShutdown();
+
+ /**
+ * {@.ja postShutdown コールバック関数}
+ * {@.en postShutdown callback function}
+ */
+ public abstract void postShutdown();
+
+ /**
+ * {@.ja preReinit コールバック関数}
+ * {@.en preReinit callback function}
+ */
+ public abstract void preReinit();
+
+ /**
+ * {@.ja postReinit コールバック関数}
+ * {@.en postReinit callback function}
+ */
+ public abstract void postReinit();
+}
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,19 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja ModuleActionListenerArgument クラス}
+ * {@.en ModuleActionListenerArgument class}
+ *
+ *
+ */
+public class ManagerActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public ManagerActionListenerArgument(String method){
+ m_method = method;
+ }
+ public String m_method;
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,69 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+
+ /**
+ * {@.ja ManagerActionListenerHolder クラス}
+ * {@.en ManagerActionListenerHolder class}
+ */
+public class ManagerActionListenerHolder extends Observable {
+ public void notify(final int ec_id, RTC.ReturnCode_t ret) {
+ super.setChanged();
+ ManagerActionListenerArgument arg
+ = new ManagerActionListenerArgument("");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preShutdown コールバック関数}
+ * {@.en preShutdown callback function}
+ */
+ public void preShutdown(){
+ super.setChanged();
+ ManagerActionListenerArgument arg
+ = new ManagerActionListenerArgument("preShutdown");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postShutdown コールバック関数}
+ * {@.en postShutdown callback function}
+ */
+ public void postShutdown() {
+ super.setChanged();
+ ManagerActionListenerArgument arg
+ = new ManagerActionListenerArgument("postShutdown");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preReinit コールバック関数}
+ * {@.en preReinit callback function}
+ */
+ public void preReinit(){
+ super.setChanged();
+ ManagerActionListenerArgument arg
+ = new ManagerActionListenerArgument("preReinit");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postReinit コールバック関数}
+ * {@.en postReinit callback function}
+ */
+ public void postReinit(){
+ super.setChanged();
+ ManagerActionListenerArgument arg
+ = new ManagerActionListenerArgument("postReinit");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ };
+
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,19 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja ManagerActionListeners クラス}
+ * {@.en ManagerActionListeners class}
+ */
+ class ManagerActionListeners
+ {
+ public ManagerActionListenerHolder manager_
+ = new ManagerActionListenerHolder();
+ public ModuleActionListenerHolder module_
+ = new ModuleActionListenerHolder();
+ public RtcLifecycleActionListenerHolder rtclifecycle_
+ = new RtcLifecycleActionListenerHolder();
+ public NamingActionListenerHolder naming_
+ = new NamingActionListenerHolder();
+ public LocalServiceActionListenerHolder localservice_
+ = new LocalServiceActionListenerHolder();
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,66 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+ /**
+ * {@.ja ModuleActionListener クラス}
+ * {@.en ModuleActionListener class}
+ *
+ */
+public abstract class ModuleActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ ModuleActionListenerArgument arg = (ModuleActionListenerArgument)obj;
+ if(arg.m_method.equals("preLoad")){
+ preLoad(arg.m_modname,arg.m_funcname);
+ }
+ else if(arg.m_method.equals("postLoad")){
+ postLoad(arg.m_modname,arg.m_funcname);
+ }
+ else if(arg.m_method.equals("preUnload")){
+ preUnload(arg.m_modname);
+ }
+ else if(arg.m_method.equals("postUnload")){
+ postUnload(arg.m_modname);
+ }
+ else{
+ operator();
+ }
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja ModuleActionListener のコールバック関数}
+ * {@.en This is a the Callback function for ModuleActionListener.}
+ *
+ */
+ public abstract void operator();
+
+ /**
+ * {@.ja preLoad コールバック関数}
+ * {@.en preLoad callback function}
+ */
+ public abstract void preLoad(String modname,
+ String funcname);
+
+ /**
+ * {@.ja postLoad コールバック関数}
+ * {@.en postLoad callback function}
+ */
+ public abstract void postLoad(String modname,
+ String funcname);
+
+ /**
+ * {@.ja preUnload コールバック関数}
+ * {@.en preUnload callback function}
+ */
+ public abstract void preUnload(String modname);
+
+ /**
+ * {@.ja postUnload コールバック関数}
+ * {@.en postUnload callback function}
+ */
+ public abstract void postUnload(String modname);
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,35 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja ModuleActionListenerArgument クラス}
+ * {@.en ModuleActionListenerArgument class}
+ *
+ *
+ */
+public class ModuleActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public ModuleActionListenerArgument(String method,
+ String modname,
+ String funcname){
+ m_method = method;
+ m_modname = modname;
+ m_funcname = funcname;
+ }
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public ModuleActionListenerArgument(String method,
+ String modname) {
+ m_method = method;
+ m_modname = modname;
+ }
+ public String m_method;
+ public String m_modname;
+ public String m_funcname;
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,62 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+ /**
+ * {@.ja ModuleActionListenerHolder クラス}
+ * {@.en ModuleActionListenerHolder class}
+ *
+ */
+public class ModuleActionListenerHolder extends Observable {
+ /**
+ * {@.ja preLoad コールバック関数}
+ * {@.en preLoad callback function}
+ */
+ public void preLoad(String modname,
+ String funcname){
+ super.setChanged();
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("preLoad",modname,funcname);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postLoad コールバック関数}
+ * {@.en postLoad callback function}
+ */
+ public void postLoad(String modname,
+ String funcname){
+ super.setChanged();
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("postLoad",modname,funcname);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ /**
+ * {@.ja preUnload コールバック関数}
+ * {@.en preUnload callback function}
+ */
+ public void preUnload(String modname){
+ super.setChanged();
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("preUnload",modname);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postUnload コールバック関数}
+ * {@.en postUnload callback function}
+ */
+ public void postUnload(String modname){
+ super.setChanged();
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("postUnload",modname);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,85 @@
+package jp.go.aist.rtm.RTC;
+
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.util.Vector;
+
+ /**
+ * {@.ja NamingActionListener クラス}
+ * {@.en NamingActionListener class}
+ * <p>
+ * {@.ja 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ *
+ * Registration系
+ * - PRE_NS_REGISTER: RTCの名前の登録の直前 bool (coil::vstring&)
+ * - POST_NS_REGISTER: RTCの名前の登録の直後 bool (coil::vstring&)
+ * - PRE_NS_UNREGISTER: RTCの名前の登録の直前 bool (coil::vstring&)
+ * - POST_NS_UNREGISTER: RTCの名前の登録の直後 bool (coil::vstring&)
+ *
+ * - ADD_PORT:
+ * - REMOVE_PORT:}
+ *
+ *
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ *
+ */
+public abstract class NamingActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ NamingActionListenerArgument arg = (NamingActionListenerArgument)obj;
+ if(arg.m_method_name.equals("preBind")){
+ preBind(arg.m_rtobj,arg.m_name);
+ }
+ else if(arg.m_method_name.equals("postBind")){
+ postBind(arg.m_rtobj,arg.m_name);
+ }
+ else if(arg.m_method_name.equals("preUnbind")){
+ preUnbind(arg.m_rtobj,arg.m_name);
+ }
+ else if(arg.m_method_name.equals("postUnbind")){
+ postUnbind(arg.m_rtobj,arg.m_name);
+ }
+ else{
+ operator();
+ }
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja NamingActionListener のコールバック関数}
+ * {@.en This is a the Callback function for NamingActionListener.}
+ *
+ */
+ public abstract void operator();
+ /**
+ * {@.ja preBind コールバック関数}
+ * {@.en preBind callback function}
+ */
+ public abstract void preBind(RTObject_impl rtobj,
+ String[] name);
+ /**
+ * {@.ja postBind コールバック関数}
+ * {@.en postBind callback function}
+ */
+ public abstract void postBind(RTObject_impl rtobj,
+ String[] name);
+
+ /**
+ * {@.ja preUnbind コールバック関数}
+ * {@.en preUnbind callback function}
+ */
+ public abstract void preUnbind(RTObject_impl rtobj,
+ String[] name);
+
+ /**
+ * {@.ja postUnbind コールバック関数}
+ * {@.en postUnbind callback function}
+ */
+ public abstract void postUnbind(RTObject_impl rtobj,
+ String[] name);
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,29 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Vector;
+ /**
+ * {@.ja NamingActionListenerArgument クラス}
+ * {@.en NamingActionListenerArgument class}
+ *
+ *
+ */
+public class NamingActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public NamingActionListenerArgument( String method_name,
+ RTObject_impl rtobj,
+ String[] name){
+ m_method_name = method_name;
+ m_rtobj = rtobj;
+ m_name = name;
+ }
+ public String m_method_name;
+ public RTObject_impl m_rtobj;
+ public String[] m_name;
+}
+
+
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,69 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.util.Vector;
+
+ /**
+ * {@.ja NamingActionListenerHolder クラス}
+ * {@.en NamingActionListenerHolder class}
+ * <p>
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ *
+ */
+public class NamingActionListenerHolder extends Observable {
+
+ /**
+ * {@.ja preBind コールバック関数}
+ * {@.en preBind callback function}
+ */
+ public void preBind(RTObject_impl rtobj,
+ String[] name){
+ super.setChanged();
+ NamingActionListenerArgument arg
+ = new NamingActionListenerArgument("preBind",rtobj,name);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ /**
+ * {@.ja postBind コールバック関数}
+ * {@.en postBind callback function}
+ */
+ public void postBind(RTObject_impl rtobj,
+ String[] name){
+ super.setChanged();
+ NamingActionListenerArgument arg
+ = new NamingActionListenerArgument("postBind",rtobj,name);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preUnbind コールバック関数}
+ * {@.en preUnbind callback function}
+ */
+ public void preUnbind(RTObject_impl rtobj,
+ String[] name){
+ super.setChanged();
+ NamingActionListenerArgument arg
+ = new NamingActionListenerArgument("preUnbind",rtobj,name);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postUnbind コールバック関数}
+ * {@.en postUnbind callback function}
+ */
+ public void postUnbind(RTObject_impl rtobj,
+ String[] name){
+ super.setChanged();
+ NamingActionListenerArgument arg
+ = new NamingActionListenerArgument("postUnbind",rtobj,name);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ };
+
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2011-12-28 06:16:42 UTC (rev 620)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -5869,7 +5869,7 @@
}
if( m_pManager != null) {
- m_pManager.cleanupComponent(this);
+ m_pManager.notifyFinalized(this);
}
}
protected void preOnInitialize(int ec_id)
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,101 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+
+import jp.go.aist.rtm.RTC.util.Properties;
+
+ /**
+ * {@.ja RtcLifecycleActionListener クラス}
+ * {@.en RtcLifecycleActionListener class}
+ * <p>
+ * {@.ja RTC系
+ * - RTC生成の直前 bool (std::string&)
+ * void preCreate(std::string& args) = 0;
+ * - RTC生成の直後 bool (RTObject_impl*)
+ * void postCreate(RTObject_impl*) = 0;
+ * - RTCのコンフィグ直前 bool (coil::Properties& prop)
+ * void preConfigure(coil::Properties& prop) = 0;
+ * - RTCのコンフィグ直後 bool (coil::Properties& prop)
+ * void postConfigure(coil::Properties& prop) = 0;
+ * - RTCの初期化の直前 bool (void)
+ * void preInitialize(void) = 0;
+ * - RTCの初期化の直後 bool (void)
+ * void postInitialize(void) = 0;}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ *
+ *
+ */
+public abstract class RtcLifecycleActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ RtcLifecycleActionListenerArgument arg = (RtcLifecycleActionListenerArgument)obj;
+ if(arg.m_method.equals("preCreate")){
+ preCreate(arg.m_args);
+ }
+ else if(arg.m_method.equals("postCreate")){
+ postCreate(arg.m_rtobj);
+ }
+ else if(arg.m_method.equals("preConfigure")){
+ preConfigure(arg.m_prop);
+ }
+ else if(arg.m_method.equals("postConfigure")){
+ postConfigure(arg.m_prop);
+ }
+ else if(arg.m_method.equals("preInitialize")){
+ preInitialize();
+ }
+ else if(arg.m_method.equals("postInitialize")){
+ postInitialize();
+ }
+ else{
+ operator();
+ }
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja RtcLifecycleActionListener のコールバック関数}
+ * {@.en This is a the Callback function for RtcLifecycleActionListener.}
+ *
+ */
+ public abstract void operator();
+ /**
+ * {@.ja preCreate コールバック関数}
+ * {@.en preCreate callback function}
+ */
+ public abstract void preCreate(String args);
+
+ /**
+ * {@.ja postCreate コールバック関数}
+ * {@.en postCreate callback function}
+ */
+ public abstract void postCreate(RTObject_impl rtobj);
+
+ /**
+ * {@.ja preConfigure コールバック関数}
+ * {@.en preConfigure callback function}
+ */
+ public abstract void preConfigure(Properties prop);
+
+ /**
+ * {@.ja postConfigure コールバック関数}
+ * {@.en postConfigure callback function}
+ */
+ public abstract void postConfigure(Properties prop);
+
+ /**
+ * {@.ja preInitialize コールバック関数}
+ * {@.en preInitialize callback function}
+ */
+ public abstract void preInitialize();
+
+ /**
+ * {@.ja postInitialize コールバック関数}
+ * {@.en postInitialize callback function}
+ */
+ public abstract void postInitialize();
+ };
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,54 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+ /**
+ * {@.ja RtcLifecycleActionListenerArgument クラス}
+ * {@.en RtcLifecycleActionListenerArgument class}
+ *
+ *
+ */
+public class RtcLifecycleActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public RtcLifecycleActionListenerArgument(String method,
+ String args){
+ m_method = method;
+ m_args = args;
+ }
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public RtcLifecycleActionListenerArgument(String method){
+ m_method = method;
+ }
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public RtcLifecycleActionListenerArgument(String method, RTObject_impl rtobj){
+ m_method = method;
+ m_rtobj = rtobj;
+ }
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public RtcLifecycleActionListenerArgument(String method, Properties prop){
+ m_method = method;
+ m_prop = prop;
+ }
+ public String m_method;
+ public String m_args;
+ public Properties m_prop;
+ public RTObject_impl m_rtobj;
+ public String m_modname;
+ public String m_funcname;
+}
+
Copied: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java (from rev 620, branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java)
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java 2011-12-28 06:25:08 UTC (rev 621)
@@ -0,0 +1,89 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import jp.go.aist.rtm.RTC.util.Properties;
+
+ /**
+ * {@.ja RtcLifecycleActionListenerHolder クラス}
+ * {@.en RtcLifecycleActionListenerHolder class}
+ * <p>
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.}
+ *
+ */
+public class RtcLifecycleActionListenerHolder extends Observable {
+ /**
+ * {@.ja preCreate コールバック関数}
+ * {@.en preCreate callback function}
+ */
+ public void preCreate(String args){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("preCreate",args);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postCreate コールバック関数}
+ * {@.en postCreate callback function}
+ */
+ public void postCreate(RTObject_impl rtobj){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("postCreate",rtobj);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preConfigure コールバック関数}
+ * {@.en preConfigure callback function}
+ */
+ public void preConfigure(Properties prop){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("preConfigure",prop);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postConfigure コールバック関数}
+ * {@.en postConfigure callback function}
+ */
+ public void postConfigure(Properties prop){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("postConfigure",prop);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja preInitialize コールバック関数}
+ * {@.en preInitialize callback function}
+ */
+ public void preInitialize(){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("preInitialize");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+
+ /**
+ * {@.ja postInitialize コールバック関数}
+ * {@.en postInitialize callback function}
+ */
+ public void postInitialize(){
+ super.setChanged();
+ RtcLifecycleActionListenerArgument arg
+ = new RtcLifecycleActionListenerArgument("postInitialize");
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ };
+
openrtm-commit メーリングリストの案内