[openrtm-commit:03318] r1122 - in branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: RTMExamples/ConfigSample RTMExamples/ExtTrigger RTMExamples/GUIIn RTMExamples/SeqIO RTMExamples/SimpleService RTMExamples/SinCosOut jp/go/aist/rtm/RTC

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 3月 28日 (水) 15:57:52 JST


Author: t-katami
Date: 2018-03-28 15:57:52 +0900 (Wed, 28 Mar 2018)
New Revision: 1122

Modified:
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ConfigSample/ConfigSample.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleIn.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOut.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/GUIIn/GUIIn.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqIn.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOut.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumer.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceProvider.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SinCosOut/SinCosOut.java
   branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
Log:
[merge] r1120-r1121 have been merged from trunk.

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ConfigSample/ConfigSample.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ConfigSample/ConfigSample.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ConfigSample/ConfigSample.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class ConfigSample implements RtcNewFunc, RtcDeleteFunc {
 //  Module specification
@@ -38,4 +39,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new ConfigSample(), new ConfigSample());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleIn.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleIn.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleIn.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class ConsoleIn implements RtcNewFunc, RtcDeleteFunc {
 
@@ -30,4 +31,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new ConsoleIn(), new ConsoleIn());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOut.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOut.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOut.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class ConsoleOut implements RtcNewFunc, RtcDeleteFunc {
 
@@ -31,4 +32,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new ConsoleOut(), new ConsoleOut());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/GUIIn/GUIIn.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/GUIIn/GUIIn.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/GUIIn/GUIIn.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -5,6 +5,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class GUIIn implements RtcNewFunc, RtcDeleteFunc {
 
@@ -32,4 +33,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new GUIIn(), new GUIIn());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqIn.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqIn.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqIn.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class SeqIn implements RtcNewFunc, RtcDeleteFunc {
 //  Module specification
@@ -30,4 +31,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new SeqIn(), new SeqIn());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOut.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOut.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOut.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class SeqOut implements RtcNewFunc, RtcDeleteFunc {
 //  Module specification
@@ -30,4 +31,9 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new SeqOut(), new SeqOut());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumer.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumer.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumer.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class MyServiceConsumer implements RtcNewFunc, RtcDeleteFunc {
 
@@ -18,7 +19,7 @@
             "category",          "Generic",
             "activity_type",     "DataFlowComponent",
             "max_instance",      "10",
-            "language",          "C++",
+            "language",          "Java",
             "lang_type",         "compile",
             ""
             };
@@ -31,4 +32,12 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, 
+                                new MyServiceConsumer(), 
+                                new MyServiceConsumer());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceProvider.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceProvider.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceProvider.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -4,6 +4,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class MyServiceProvider implements RtcNewFunc, RtcDeleteFunc {
 
@@ -18,7 +19,7 @@
             "category",          "Generic",
             "activity_type",     "DataFlowComponent",
             "max_instance",      "10",
-            "language",          "C++",
+            "language",          "Java",
             "lang_type",         "compile",
             ""
             };
@@ -31,4 +32,11 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, 
+                                new MyServiceProvider(), 
+                                new MyServiceProvider());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SinCosOut/SinCosOut.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SinCosOut/SinCosOut.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SinCosOut/SinCosOut.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -5,6 +5,7 @@
 import jp.go.aist.rtm.RTC.RTObject_impl;
 import jp.go.aist.rtm.RTC.RtcDeleteFunc;
 import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
 
 public class SinCosOut implements RtcNewFunc, RtcDeleteFunc {
 
@@ -32,4 +33,11 @@
     public void deleteRtc(RTObject_impl rtcBase) {
         rtcBase = null;
     }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, 
+                                new SinCosOut(), 
+                                new SinCosOut());
+    }
 }

Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java	2018-03-28 06:16:15 UTC (rev 1121)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java	2018-03-28 06:57:52 UTC (rev 1122)
@@ -21,6 +21,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Stack;
 import java.util.Vector;
 
 import jp.go.aist.rtm.RTC.util.Properties;
@@ -86,6 +87,7 @@
             }
             m_loadPath.add(loadPath[i]);
         }
+        m_loadPath = recursiveDirectory(m_loadPath);
         
         m_absoluteAllowed = StringUtil.toBool(
                 properties.getProperty(ALLOW_ABSPATH), "yes", "no", false);
@@ -361,7 +363,8 @@
             URI uri = path.toURI();
             urls[0] = uri.toURL();
         } catch(java.net.MalformedURLException ex){
-            rtcout.println(Logbuf.WARN, "java.net.MalformedURLException: toURL() threw Exception."+ex);
+            rtcout.println(Logbuf.WARN, 
+                "java.net.MalformedURLException: toURL() threw Exception."+ex);
             return null;
         }
         URLClassLoader url = new URLClassLoader(urls);
@@ -548,6 +551,7 @@
      */
     public void setLoadpath(final Vector<String> loadPath) {
         m_loadPath = new Vector<String>(loadPath);
+        m_loadPath = recursiveDirectory(m_loadPath);
     }
     
     /**
@@ -580,7 +584,8 @@
      *   {@.en List of additional module search path}
      */
     public void addLoadPath(final Vector<String> loadPath) {
-        m_loadPath.addAll(loadPath);
+        Vector<String>loadpath = recursiveDirectory(loadPath);
+        m_loadPath.addAll(loadpath);
     }
     
     /**
@@ -1133,6 +1138,7 @@
         public Class dll;
     }
 
+
     /**
      * {@.ja モジュール・ロード・パス・リスト}
      * {@.en Module load path list}
@@ -1184,4 +1190,26 @@
     }
     private Logbuf rtcout;
     private ArrayList<Properties> m_modprofs = new ArrayList<Properties>();
+    /**
+     * {@.ja 指定したパス以下に存在するディレクトリを探索する}
+     * {@.en Searches the directory which exists in below of designated paths.}
+     */
+    private Vector<String> recursiveDirectory(Vector<String> paths){
+        Vector<String> result = new Vector<String>();
+        for(String path:paths){
+            Stack<File> stack = new Stack<>();
+            stack.add(new File(path));
+            while(!stack.isEmpty()){
+                File item = stack.pop();
+                if (item.isDirectory()) {
+                    result.add(item.getPath());
+                    for (File child : item.listFiles()){
+                        stack.push(child);
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
 }



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