[openrtm-commit:00520] r613 - branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 12月 27日 (火) 10:12:21 JST
Author: fsi-katami
Date: 2011-12-27 10:12:20 +0900 (Tue, 27 Dec 2011)
New Revision: 613
Added:
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java
Modified:
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java
branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java
Log:
Implemented LocalService. refs #2301
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListener.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -1,5 +1,9 @@
package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
import jp.go.aist.rtm.RTC.util.Properties;
/**
@@ -14,68 +18,100 @@
* {@.en This class is abstract base class for listener classes that
* provides callbacks for various events in rtobject.}
*/
-public class LocalServiceActionListener {
+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 void preServiceRegister(String service_name) {
- }
+ public abstract void preServiceRegister(String service_name);
/**
* {@.ja postServiceRegister コールバック関数}
* {@.en postServiceRegister callback function}
*/
- public void postServiceRegister(String service_name,
- LocalServiceBase service){
- }
+ public abstract void postServiceRegister(String service_name,
+ LocalServiceBase service);
/**
* {@.ja preServiceInit コールバック関数}
* {@.en preServiceInit callback function}
*/
- public void preServiceInit(Properties prop,
- LocalServiceBase service){
- }
+ public abstract void preServiceInit(Properties prop,
+ LocalServiceBase service);
/**
* {@.ja postServiceInit コールバック関数}
* {@.en postServiceInit callback function}
*/
- public void postServiceInit(Properties prop,
- LocalServiceBase service){
- }
+ public abstract void postServiceInit(Properties prop,
+ LocalServiceBase service);
/**
* {@.ja preServiceReinit コールバック関数}
* {@.en preServiceReinit callback function}
*/
- public void preServiceReinit(Properties prop,
- LocalServiceBase service){
- }
+ public abstract void preServiceReinit(Properties prop,
+ LocalServiceBase service);
/**
* {@.ja postServiceReinit コールバック関数}
* {@.en postServiceReinit callback function}
*/
- public void postServiceReinit(Properties prop,
- LocalServiceBase service){
- }
+ public abstract void postServiceReinit(Properties prop,
+ LocalServiceBase service);
/**
* {@.ja postServiceFinalize コールバック関数}
* {@.en postServiceFinalize callback function}
*/
- public void postServiceFinalize(String service_name,
- LocalServiceBase service){
- }
+ public abstract void postServiceFinalize(String service_name,
+ LocalServiceBase service);
/**
* {@.ja preServiceFinalize コールバック関数}
* {@.en preServiceFinalize callback function}
*/
- public void preServiceFinalize(String service_name,
- LocalServiceBase service){
- }
- };
+ public abstract void preServiceFinalize(String service_name,
+ LocalServiceBase service);
+};
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerArgument.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -14,16 +14,26 @@
* {@.en Constructor}
*
*/
- public LocalServiceActionListenerArgument(Properties prop,
+ public LocalServiceActionListenerArgument(String method_name,
+ Properties prop,
LocalServiceBase service){
+ m_method_name = method_name;
m_prop = prop;
m_service = service;
}
- public LocalServiceActionListenerArgument(String service_name,
+ 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;
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LocalServiceActionListenerHolder.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -26,7 +26,9 @@
*/
public void preServiceRegister(String service_name){
super.setChanged();
- super.notifyObservers((Object)service_name);
+ LocalServiceActionListenerArgument arg
+ = new LocalServiceActionListenerArgument("preServiceRegister",service_name);
+ super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -38,7 +40,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(service_name,service);
+ = new LocalServiceActionListenerArgument("postServiceRegister",service_name,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -51,7 +53,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(prop,service);
+ = new LocalServiceActionListenerArgument("preServiceInit",prop,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -63,7 +65,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(prop,service);
+ = new LocalServiceActionListenerArgument("postServiceInit",prop,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -76,7 +78,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(prop,service);
+ = new LocalServiceActionListenerArgument("preServiceReinit",prop,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -88,7 +90,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(prop,service);
+ = new LocalServiceActionListenerArgument("postServiceReinit",prop,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -101,7 +103,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(service_name,service);
+ = new LocalServiceActionListenerArgument("postServiceFinalize",service_name,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -113,7 +115,7 @@
LocalServiceBase service){
super.setChanged();
LocalServiceActionListenerArgument arg
- = new LocalServiceActionListenerArgument(service_name,service);
+ = new LocalServiceActionListenerArgument("preServiceFinalize",service_name,service);
super.notifyObservers((Object)arg);
super.clearChanged();
}
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -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();
}
@@ -535,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) {
@@ -566,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);
}
/**
@@ -845,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
@@ -973,6 +979,7 @@
rtcout.println(Logbuf.TRACE,
"RTC Created: " + comp_id.getProperty("implementaion_id"));
+ m_listeners.rtclifecycle_.postCreate(comp);
prop.merge(comp_prop);
/* zxc
@@ -1037,12 +1044,15 @@
// 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: "
@@ -1054,6 +1064,7 @@
"RTC initialization succeeded: "
+ comp_id.getProperty("implementaion_id"));
+ m_listeners.rtclifecycle_.postInitialize();
//------------------------------------------------------------
// Bind component to naming service
registerComponent(comp);
@@ -1326,11 +1337,13 @@
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;
}
@@ -1679,6 +1692,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}
*
@@ -2471,7 +2600,17 @@
protected void shutdownNaming() {
rtcout.println(Logbuf.TRACE, "Manager.shutdownNaming()");
-
+ Vector<RTObject_impl> comps = getComponents();
+
+ for (int ic=0; ic < comps.size(); ++ic) {
+ String[] names = comps.get(ic).getNamingNames();
+ m_listeners.naming_.preUnbind(comps.get(ic), names);
+ for (int jc=0; jc < names.length; ++jc) {
+ m_namingManager.unbindObject(names[jc]);
+ }
+ m_listeners.naming_.postUnbind(comps.get(ic), names);
+ }
+
m_namingManager.unbindAll();
}
@@ -3499,6 +3638,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";
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListener.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -13,31 +13,54 @@
*
*/
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 void preShutdown() {
- }
+ public abstract void preShutdown();
/**
* {@.ja postShutdown コールバック関数}
* {@.en postShutdown callback function}
*/
- public void postShutdown(){
- }
+ public abstract void postShutdown();
/**
* {@.ja preReinit コールバック関数}
* {@.en preReinit callback function}
*/
- public void preReinit(){
- }
+ public abstract void preReinit();
/**
* {@.ja postReinit コールバック関数}
* {@.en postReinit callback function}
*/
- public void postReinit(){
- }
+ public abstract void postReinit();
}
Added: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java (rev 0)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerArgument.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -0,0 +1,25 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja ModuleActionListenerArgument クラス}
+ * {@.en ModuleActionListenerArgument class}
+ *
+ *
+ */
+public class ManagerActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public ManagerActionListenerArgument(String method,
+ String modname,
+ String funcname){
+ m_method = method;
+ m_modname = modname;
+ m_funcname = funcname;
+ }
+ public String m_method;
+ public String m_modname;
+ public String m_funcname;
+}
+
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListenerHolder.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -9,6 +9,13 @@
* {@.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 コールバック関数}
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListener.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -1,39 +1,66 @@
package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
/**
* {@.ja ModuleActionListener クラス}
* {@.en ModuleActionListener class}
*
*/
-public class ModuleActionListener {
+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 void preLoad(String modname,
- String funcname){
- }
+ public abstract void preLoad(String modname,
+ String funcname);
/**
* {@.ja postLoad コールバック関数}
* {@.en postLoad callback function}
*/
- public void postLoad(String modname,
- String funcname){
- }
+ public abstract void postLoad(String modname,
+ String funcname);
/**
* {@.ja preUnload コールバック関数}
* {@.en preUnload callback function}
*/
- public void preUnload(String modname){
- }
+ public abstract void preUnload(String modname);
/**
* {@.ja postUnload コールバック関数}
* {@.en postUnload callback function}
*/
- public void postUnload(String modname){
- }
+ public abstract void postUnload(String modname);
};
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerArgument.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -11,11 +11,24 @@
* {@.en Constructor}
*
*/
- public ModuleActionListenerArgument(String modname,
+ 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;
}
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleActionListenerHolder.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -18,7 +18,7 @@
String funcname){
super.setChanged();
ModuleActionListenerArgument arg
- = new ModuleActionListenerArgument(modname,funcname);
+ = new ModuleActionListenerArgument("preLoad",modname);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -31,7 +31,7 @@
String funcname){
super.setChanged();
ModuleActionListenerArgument arg
- = new ModuleActionListenerArgument(modname,funcname);
+ = new ModuleActionListenerArgument("postLoad",modname);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -41,7 +41,9 @@
*/
public void preUnload(String modname){
super.setChanged();
- super.notifyObservers((Object)modname);
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("preUnload",modname);
+ super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -51,7 +53,9 @@
*/
public void postUnload(String modname){
super.setChanged();
- super.notifyObservers((Object)modname);
+ ModuleActionListenerArgument arg
+ = new ModuleActionListenerArgument("postUnload",modname);
+ super.notifyObservers((Object)arg);
super.clearChanged();
}
};
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListener.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -1,5 +1,9 @@
package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
import java.util.Vector;
/**
@@ -23,38 +27,59 @@
* provides callbacks for various events in rtobject.}
*
*/
-public class NamingActionListener {
-
+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 void preBind(RTObject_impl rtobj,
- Vector<String> name){
- }
+ public abstract void preBind(RTObject_impl rtobj,
+ String[] name);
/**
* {@.ja postBind コールバック関数}
* {@.en postBind callback function}
*/
- public void postBind(RTObject_impl rtobj,
- Vector<String> name){
- }
+ public abstract void postBind(RTObject_impl rtobj,
+ String[] name);
/**
* {@.ja preUnbind コールバック関数}
* {@.en preUnbind callback function}
*/
- public void preUnbind(RTObject_impl rtobj,
- Vector<String> name){
- }
-
+ public abstract void preUnbind(RTObject_impl rtobj,
+ String[] name);
/**
* {@.ja postUnbind コールバック関数}
* {@.en postUnbind callback function}
*/
- public void postUnbind(RTObject_impl rtobj,
- Vector<String> name){
- }
+ public abstract void postUnbind(RTObject_impl rtobj,
+ String[] name);
};
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerArgument.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -13,13 +13,16 @@
* {@.en Constructor}
*
*/
- public NamingActionListenerArgument(RTObject_impl rtobj,
- Vector<String> name){
+ 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 Vector<String> m_name;
+ public String[] m_name;
}
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingActionListenerHolder.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -20,10 +20,10 @@
* {@.en preBind callback function}
*/
public void preBind(RTObject_impl rtobj,
- Vector<String> name){
+ String[] name){
super.setChanged();
NamingActionListenerArgument arg
- = new NamingActionListenerArgument(rtobj,name);
+ = new NamingActionListenerArgument("",rtobj,name);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -32,10 +32,10 @@
* {@.en postBind callback function}
*/
public void postBind(RTObject_impl rtobj,
- Vector<String> name){
+ String[] name){
super.setChanged();
NamingActionListenerArgument arg
- = new NamingActionListenerArgument(rtobj,name);
+ = new NamingActionListenerArgument("postBind",rtobj,name);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -45,10 +45,10 @@
* {@.en preUnbind callback function}
*/
public void preUnbind(RTObject_impl rtobj,
- Vector<String> name){
+ String[] name){
super.setChanged();
NamingActionListenerArgument arg
- = new NamingActionListenerArgument(rtobj,name);
+ = new NamingActionListenerArgument("preUnbind",rtobj,name);
super.notifyObservers((Object)arg);
super.clearChanged();
}
@@ -58,10 +58,10 @@
* {@.en postUnbind callback function}
*/
public void postUnbind(RTObject_impl rtobj,
- Vector<String> name){
+ String[] name){
super.setChanged();
NamingActionListenerArgument arg
- = new NamingActionListenerArgument(rtobj,name);
+ = new NamingActionListenerArgument("postUnbind",rtobj,name);
super.notifyObservers((Object)arg);
super.clearChanged();
}
Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java 2011-12-22 08:12:53 UTC (rev 612)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -1,5 +1,9 @@
package jp.go.aist.rtm.RTC;
+import java.util.Observable;
+import java.util.Observer;
+
+
import jp.go.aist.rtm.RTC.util.Properties;
/**
@@ -24,47 +28,19 @@
*
*
*/
-public class RtcLifecycleActionListener {
- /**
- * {@.ja preCreate コールバック関数}
- * {@.en preCreate callback function}
- */
- public void preCreate(String args){
+public abstract class RtcLifecycleActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ String arg = (String)obj;
+ operator();
}
-
/**
- * {@.ja postCreate コールバック関数}
- * {@.en postCreate callback function}
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja RtcLifecycleActionListener のコールバック関数}
+ * {@.en This is a the Callback function for RtcLifecycleActionListener.}
+ *
*/
- public void postCreate(RTObject_impl rtobj){
- }
-
- /**
- * {@.ja preConfigure コールバック関数}
- * {@.en preConfigure callback function}
- */
- public void preConfigure(Properties prop){
- }
-
- /**
- * {@.ja postConfigure コールバック関数}
- * {@.en postConfigure callback function}
- */
- public void postConfigure(Properties prop){
- }
-
- /**
- * {@.ja preInitialize コールバック関数}
- * {@.en preInitialize callback function}
- */
- public void preInitialize(){
- }
-
- /**
- * {@.ja postInitialize コールバック関数}
- * {@.en postInitialize callback function}
- */
- public void postInitialize(){
- }
+ public abstract void operator();
};
Added: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java (rev 0)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java 2011-12-27 01:12:20 UTC (rev 613)
@@ -0,0 +1,25 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja RtcLifecycleActionListenerArgument クラス}
+ * {@.en RtcLifecycleActionListenerArgument class}
+ *
+ *
+ */
+public class RtcLifecycleActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public RtcLifecycleActionListenerArgument(String method,
+ String modname,
+ String funcname){
+ m_method = method;
+ m_modname = modname;
+ m_funcname = funcname;
+ }
+ public String m_method;
+ public String m_modname;
+ public String m_funcname;
+}
+
openrtm-commit メーリングリストの案内