[openrtm-commit:02840] r1052 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 9月 22日 (金) 17:34:27 JST
Author: t-katami
Date: 2017-09-22 17:34:26 +0900 (Fri, 22 Sep 2017)
New Revision: 1052
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
Log:
[compat,newfunc->releng_1_2] refs #4189 , refs #4190
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-22 05:10:40 UTC (rev 1051)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-22 08:34:26 UTC (rev 1052)
@@ -65,6 +65,7 @@
"manager.name", "manager",
"manager.command", "rtcd",
"manager.nameservers", "default",
+ "manager.language", "Java",
"manager.components.naming_policy", "process_unique",
"manager.modules.C++.manager_cmd", "rtcd",
"manager.modules.Python.manager_cmd", "rtcd_python",
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-22 05:10:40 UTC (rev 1051)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-22 08:34:26 UTC (rev 1052)
@@ -1098,7 +1098,9 @@
* "Manager.components.precreate".}
*/
private void precreateComponent() {
- rtcout.println(Logbuf.TRACE, "Components pre-creation: " + m_config.getProperty("manager.components.precreate").split(","));
+ rtcout.println(Logbuf.TRACE,
+ "Components pre-creation: "
+ + m_config.getProperty("manager.components.precreate").split(","));
String[] comp
= m_config.getProperty("manager.components.precreate").split(",");
for (int i=0; i < comp.length; ++i) {
@@ -1722,9 +1724,9 @@
* 部分が存在する。
* comp_args: [id]?[configuration] <br>
* id は必須、configurationはオプション<ul>
- * <li>id: RTC:[vendor]:[category]:[implementation_id]:[version]
+ * <li>id: RTC:[vendor]:[category]:[implementation_id]:[language]:[version]
* RTC は固定かつ必須
- * vendor, category, version はオプション
+ * vendor, category,language,version はオプション
* implementation_id は必須
* オプションを省略する場合でも ":" は省略不可</li>
* <li>configuration: [key0]=[value0]&[key1]=[value1]&[key2]=[value2].....
@@ -1733,13 +1735,13 @@
* </ul>
*
* 例えば、<br>
- * RTC:jp.go.aist:example:ConfigSample:1.0?conf.default.str_param0=munya
+ * RTC:jp.go.aist:example:ConfigSample::1.0?conf.default.str_param0=munya
* RTC::example:ConfigSample:?conf.default.int_param0=100}
*
* {@.en Target RT-Component names for the creation.<br>
* comp_args: [id]?[configuration] <br>
* for examples,<br>
- * RTC:jp.go.aist:example:ConfigSample:1.0?conf.default.str_param0=munya
+ * RTC:jp.go.aist:example:ConfigSample::1.0?conf.default.str_param0=munya
* RTC::example:ConfigSample:?conf.default.int_param0=100}
* @return
* {@.ja 生成したRTコンポーネントのインスタンス}
@@ -1746,7 +1748,6 @@
* {@.en Created RT-Component's instances}
*/
public RTObject_impl createComponent(final String comp_args) {
-
rtcout.println(Logbuf.TRACE,
"Manager.createComponent(" + comp_args + ")");
@@ -1753,7 +1754,6 @@
if( comp_args == null || comp_args.equals("") ) {
return null;
}
- m_listeners.rtclifecycle_.preCreate(comp_args);
//------------------------------------------------------------
// extract "comp_type" and "comp_prop" from comp_arg
@@ -1763,6 +1763,22 @@
return null;
}
+ rtcout.println(Logbuf.PARANOID,
+ "comp_prop.getProperty(\"instance_name\"):"
+ + comp_prop.getProperty("instance_name"));
+ if(!comp_prop.getProperty("instance_name").equals("")){
+ RTObject_impl comp =
+ getComponent(comp_prop.getProperty("instance_name"));
+ if(comp!=null){
+ rtcout.println(Logbuf.PARANOID,
+ "A RTC with the instance name ("
+ + comp_prop.getProperty("instance_name")
+ +") has started already.");
+ return comp;
+ }
+ }
+ m_listeners.rtclifecycle_.preCreate(comp_args);
+
//------------------------------------------------------------
// Because the format of port-name had been changed from <port_name>
// to <instance_name>.<port_name>, the following processing was added.
@@ -2154,33 +2170,38 @@
"Invalid arguments. Two or more '?' in arg : " + comp_arg);
return false;
}
+ /*
+ final String[] prof = {
+ "RTC",
+ "vendor",
+ "category",
+ "implementation_id",
+ "language",
+ "version"
+ };
+ */
+ String[] prof = (String[])CompParam.prof_list.toArray(new String[0]);
+ int param_num = prof.length;
+
if (id_and_conf[0].indexOf(":") == -1) {
- id_and_conf[0] = "RTC:::".concat(id_and_conf[0]);
- id_and_conf[0] = id_and_conf[0].concat(":");
+ id_and_conf[0] = prof[0] + ":::" + id_and_conf[0];
+ id_and_conf[0] = id_and_conf[0].concat("::");
}
String[] id = id_and_conf[0].split(":",-1);
- // id should be devided into 1 or 5 elements
- // RTC:[vendor]:[category]:impl_id:[version] => 5
- if (id.length != 5) {
+ // id should be devided into 1 or 6 elements
+ // RTC:[vendor]:[category]:impl_id:[language]:[version] => 6
+ if (id.length != param_num) {
rtcout.println(Logbuf.ERROR,
"Invalid RTC id format.: " + id_and_conf[0]);
return false;
}
- final String[] prof = {
- "RTC",
- "vendor",
- "category",
- "implementation_id",
- "version"
- };
-
if (id[0].trim().equals(prof[0]) == false) {
rtcout.println(Logbuf.ERROR, "Invalid id type: " + id[0]);
return false;
}
- for (int i = 1; i < 5; ++i) {
+ for (int i = 1; i < param_num; ++i) {
comp_id.setProperty(prof[i], id[i].trim());
rtcout.println(Logbuf.TRACE,
"RTC basic propfile " + prof[i] + ":" + id[i].trim());
@@ -4767,6 +4788,11 @@
!str.equals(prop.getProperty("category"))) {
return false;
}
+ str = m_prop.getProperty("language");
+ if (str!=null && !str.equals("") &&
+ !str.equals(prop.getProperty("language"))) {
+ return false;
+ }
str = m_prop.getProperty("version");
if (str!=null && !str.equals("") &&
!str.equals(prop.getProperty("version"))) {
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-22 05:10:40 UTC (rev 1051)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-22 08:34:26 UTC (rev 1052)
@@ -572,6 +572,9 @@
get_parameter_by_modulename("manager_address",temp);
String manager_name = new String();
manager_name = get_parameter_by_modulename("manager_name",temp);
+
+ CompParam comp_param = new CompParam(temp[0]);
+
rtcout.println(Logbuf.PARANOID, "m_isMaster:"+m_isMaster);
if(m_isMaster){
synchronized(m_slaveMutex) {
@@ -579,11 +582,20 @@
"m_slaves.length:"+m_slaves.length);
for (int ic=0; ic < m_slaves.length; ++ic) {
try {
- rtc = m_slaves[ic].create_component(module_name);
- rtcout.println(Logbuf.PARANOID,
+ _SDOPackage.NameValue[] prof
+ = m_slaves[ic]. get_configuration();
+ NVListHolder nvholder = new NVListHolder(prof);
+ Properties prop = new Properties();
+ NVUtil.copyToProperties(prop, nvholder);
+ String slave_lang
+ = prop.getProperty("manager.language");
+ if(slave_lang.equals(comp_param.language())){
+ rtc = m_slaves[ic].create_component(module_name);
+ rtcout.println(Logbuf.PARANOID,
"m_slaves[ic].create_component():" +rtc);
- if(rtc != null){
- return rtc;
+ if(rtc != null){
+ return rtc;
+ }
}
}
catch (org.omg.CORBA.SystemException ex) {
@@ -590,6 +602,11 @@
rtcout.println(Logbuf.ERROR,
"Unknown exception cought.");
rtcout.println(Logbuf.DEBUG, ex.toString());
+ RTM.ManagerListHolder holder
+ = new RTM.ManagerListHolder(m_slaves);
+ CORBA_SeqUtil.erase(holder, ic);
+ --ic;
+ m_slaves = holder.value;
}
}
}
@@ -1453,22 +1470,15 @@
+mgrobj);
}
- tmp[0] = arg;
- String language = get_parameter_by_modulename("language",tmp);
- arg = tmp[0];
+ CompParam comp_param = new CompParam(arg);
- if(language==null){
- language = "Java";
- }
- if(language.isEmpty()){
- language = "Java";
- }
-
if(mgrobj == null){
rtcout.println(Logbuf.WARN, mgrstr +" cannot be found.");
Properties config = m_mgr.getConfig();
String rtcd_cmd =
- config.getProperty("manager.modules."+language+".manager_cmd");
+ config.getProperty("manager.modules."
+ +comp_param.language()
+ +".manager_cmd");
if(rtcd_cmd.isEmpty()){
rtcd_cmd = "rtcd_java";
}
@@ -1476,7 +1486,7 @@
String load_path = config.getProperty("manager.modules.load_path");
String load_path_language = config.getProperty(
"manager.modules."
- +language
+ +comp_param.language()
+".load_paths");
load_path = load_path + "," + load_path_language;
@@ -1497,16 +1507,9 @@
cmd.add("-o");
cmd.add("manager.modules.load_path:"+load_path);
cmd.add("-o");
+ cmd.add("manager.supported_languages:"+ comp_param.language());
+ cmd.add("-o");
cmd.add("manager.shutdown_auto:YES");
-/*
- String cmd = rtcd_cmd;
- cmd += " -o " + "manager.is_master:NO";
- cmd += " -o " + "manager.corba_servant:YES";
- cmd += " -o " + "corba.master_manager:"
- + config.getProperty("corba.master_manager");
- cmd += " -o " + "manager.name:" + config.getProperty("manager.name");
- cmd += " -o " + "manager.instance_name:" + mgrstr;
-*/
rtcout.println(Logbuf.DEBUG, "Invoking command: "+ cmd + ".");
try{
@@ -1649,21 +1652,14 @@
RTM.Manager mgrobj = findManager(mgrstr);
- tmp[0] = arg;
- String language = get_parameter_by_modulename("language",tmp);
- arg = tmp[0];
+ CompParam comp_param = new CompParam(arg);
- if(language==null){
- language = "Java";
- }
- if(language.isEmpty()){
- language = "Java";
- }
-
if(mgrobj == null){
Properties config = m_mgr.getConfig();
String rtcd_cmd =
- config.getProperty("manager.modules."+language+".manager_cmd");
+ config.getProperty("manager.modules."
+ +comp_param.language()
+ +".manager_cmd");
if(rtcd_cmd.isEmpty()){
rtcd_cmd = "rtcd_java";
@@ -1672,7 +1668,7 @@
String load_path = config.getProperty("manager.modules.load_path");
String load_path_language = config.getProperty(
"manager.modules."
- +language
+ +comp_param.language()
+".load_paths");
load_path = load_path + "," + load_path_language;
@@ -1774,7 +1770,7 @@
Properties config = m_mgr.getConfig();
RTM.Manager owner = findManager(
config.getProperty("corba.master_manager"));
- if(owner != null){
+ if(owner == null){
rtcout.println(Logbuf.INFO,
"Master manager not found");
return;
More information about the openrtm-commit
mailing list