[openrtm-commit:00521] r614 - branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 12月 27日 (火) 10:52:13 JST


Author: fsi-katami
Date: 2011-12-27 10:52:13 +0900 (Tue, 27 Dec 2011)
New Revision: 614

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/ManagerActionListeners.java
   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/RtcLifecycleActionListenerArgument.java
   branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java
Log:
Implemented LocalService.  refs #2301

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-27 01:12:20 UTC (rev 613)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2011-12-27 01:52:13 UTC (rev 614)
@@ -846,6 +846,7 @@
         
         rtcout.println(Logbuf.TRACE, 
                             "Manager.createComponent(" + comp_args + ")");
+System.out.println("Manager.createComponent(" + comp_args + ")");
         
         if( comp_args == null || comp_args.equals("") ) {
             return null;
@@ -982,62 +983,6 @@
         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"
         //

Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java	2011-12-27 01:12:20 UTC (rev 613)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerActionListeners.java	2011-12-27 01:52:13 UTC (rev 614)
@@ -5,10 +5,15 @@
    */
   class ManagerActionListeners
   {
-    public ManagerActionListenerHolder manager_;
-    public ModuleActionListenerHolder module_;
-    public RtcLifecycleActionListenerHolder rtclifecycle_;
-    public NamingActionListenerHolder naming_;
-    public LocalServiceActionListenerHolder localservice_;
+    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();
   };
 

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-27 01:12:20 UTC (rev 613)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListener.java	2011-12-27 01:52:13 UTC (rev 614)
@@ -30,8 +30,28 @@
    */
 public abstract class RtcLifecycleActionListener  implements Observer{
     public void update(Observable o, Object obj) {
-           String arg = (String)obj;
-           operator();
+           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 仮想コールバック関数}
@@ -42,5 +62,40 @@
      *
      */
     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();
   };
 

Modified: 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	2011-12-27 01:12:20 UTC (rev 613)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerArgument.java	2011-12-27 01:52:13 UTC (rev 614)
@@ -1,4 +1,6 @@
 package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.util.Properties;
   /**
    * {@.ja RtcLifecycleActionListenerArgument クラス}
    * {@.en RtcLifecycleActionListenerArgument class}
@@ -12,13 +14,14 @@
      *
      */
     public RtcLifecycleActionListenerArgument(String method,
-                         String modname,
-                         String funcname){
+                         String args){
         m_method = method;
-        m_modname = modname; 
-        m_funcname = funcname;
+        m_args = args; 
     }
     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;
 }

Modified: branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java
===================================================================
--- branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java	2011-12-27 01:12:20 UTC (rev 613)
+++ branches/work/ForLocalService/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RtcLifecycleActionListenerHolder.java	2011-12-27 01:52:13 UTC (rev 614)
@@ -20,7 +20,9 @@
      */
     public void preCreate(String args){
         super.setChanged();
-        super.notifyObservers((Object)args);
+        RtcLifecycleActionListenerArgument arg 
+            = new RtcLifecycleActionListenerArgument("preCreate",args);
+        super.notifyObservers((Object)arg);
         super.clearChanged();
     }
     



openrtm-commit メーリングリストの案内