[openrtm-commit:01736] r763 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 2月 21日 (日) 15:27:31 JST
Author: win-ei
Date: 2016-02-21 15:27:31 +0900 (Sun, 21 Feb 2016)
New Revision: 763
Added:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingService.java
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java
Log:
Now NamingManager can register a reference of Port (PortBase) to naming service. refs #3391
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingBase.java 2016-02-21 04:18:43 UTC (rev 762)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingBase.java 2016-02-21 06:27:31 UTC (rev 763)
@@ -1,5 +1,6 @@
package jp.go.aist.rtm.RTC;
+import jp.go.aist.rtm.RTC.port.PortBase;
/**
* {@.ja Naming Service管理用インターフェース。}
* {@.en NamingService management interface}
@@ -38,6 +39,8 @@
*/
public void bindObject(final String name, final RTObject_impl rtobj);
+ public void bindObject(final String name, final PortBase port);
+
/**
* {@.ja 指定したManagerServantをNamingServiceへバインドする純粋仮想関数}
* {@.en Pure virtual function to bind the specified ManagerServants
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2016-02-21 04:18:43 UTC (rev 762)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2016-02-21 06:27:31 UTC (rev 763)
@@ -3,6 +3,7 @@
import java.util.Vector;
import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.port.PortBase;
import jp.go.aist.rtm.RTC.util.CallbackFunction;
import jp.go.aist.rtm.RTC.util.StringUtil;
@@ -57,7 +58,7 @@
synchronized (m_names) {
- m_names.add(new Names(method, name_server, name));
+ m_names.add(new NamingService(method, name_server, name));
}
}
@@ -98,6 +99,23 @@
}
}
+ public void bindObject(final String name, final PortBase port) {
+ rtcout.println(Logbuf.TRACE, "NamingManager.bindObject(" + name + ")");
+ synchronized (m_names) {
+ int len = m_names.size();
+ for(int intIdx=0; intIdx < len; ++intIdx ) {
+ if( m_names.elementAt(intIdx).ns != null ) {
+ try{
+ m_names.elementAt(intIdx).ns.bindObject(name, port);
+ }
+ catch(Exception ex){
+ m_names.elementAt(intIdx).ns = null;
+ }
+ }
+ }
+ this.registerPortName(name, port);
+ }
+ }
/**
* {@.ja 指定したManagerServantのNamingServiceへバインド。}
* {@.en Bind the specified ManagerServants to NamingService}
@@ -207,7 +225,7 @@
* {@.en NameServer}
*
*/
- protected void retryConnection(Names ns){
+ protected void retryConnection(NamingService ns){
// recreate NamingObj
NamingBase nsobj = null;
try {
@@ -320,7 +338,10 @@
}
return comps;
}
-
+
+ public Vector<NamingService> getNameServices() {
+ return m_names;
+ }
/**
* {@.ja NameServer 管理用オブジェクトの生成。}
* {@.en Create objects for NameServer management}
@@ -416,6 +437,36 @@
}
/**
+ *
+ * {@.ja NameServer に登録するPortの設定}
+ * {o.en Configure the ports that will be registered to NameServer}
+ *
+ * <p>
+ * {@.ja NameServer に登録するPortを設定する。}
+ * {@.en Configure the ports that will be registered to NameServer.}
+ *
+ * @param name
+ * {@.ja コンポーネントの登録時名称}
+ * {@.en Names of components at the registration}
+ *
+ * @param port
+ * {@.ja 登録対象port}
+ * {@.en The target ports for registration}
+ *
+ */
+ protected void registerPortName(final String name, final PortBase port) {
+ int len = m_portNames.size();
+ for(int intIdx=0; intIdx < len; ++intIdx ) {
+ if( m_portNames.elementAt(intIdx).name.equals(name) ) {
+ m_portNames.elementAt(intIdx).port = port;
+ return;
+ }
+ }
+ m_portNames.add(new Port(name, port));
+ return;
+ }
+
+ /**
* {@.ja NameServer に登録するManagerServantの設定。}
* {@.en Configure the ManagerServants that will be registered
* to NameServer}
@@ -467,6 +518,8 @@
return;
}
+ protected void unregisterPortName(final String name) {
+ }
/**
* {@.ja NameServer に登録するManagerServantの設定解除。}
* {@.en Unregister the ManagerServants that will be registered
@@ -537,7 +590,7 @@
* {@.ja 登録された NameServer リスト}
* {@.en NameServer list}
*/
- protected Vector<Names> m_names = new Vector<Names>();
+ protected Vector<NamingService> m_names = new Vector<NamingService>();
/**
* {@.ja Naming Service登録用コンポーネントクラス}
* {@.en Class for component management}
@@ -569,6 +622,19 @@
*/
public RTObject_impl rtobj;
}
+
+ /**
+ * {@.ja コンポーネント管理用構造体}
+ * {@,en Structure for component management}
+ */
+ protected class Port {
+ public Port(final String n, final PortBase p) {
+ name = n;
+ port = p;
+ }
+ public String name;
+ public PortBase port;
+ };
/**
* {@.ja Naming Service登録用マネージャサーバントクラス}
@@ -608,6 +674,12 @@
protected Vector<Comps> m_compNames = new Vector<Comps>();
/**
+ * {@.ja コンポーネントリスト}
+ * {@.en Component list}
+ */
+ protected Vector<Port> m_portNames = new Vector<Port>();
+
+ /**
* {@.ja 登録されたManagerServantリスト}
* {@.en ManagerServant list}
*/
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java 2016-02-21 04:18:43 UTC (rev 762)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java 2016-02-21 06:27:31 UTC (rev 763)
@@ -1,6 +1,7 @@
package jp.go.aist.rtm.RTC;
import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.port.PortBase;
import org.omg.CORBA.ORB;
/**
@@ -86,6 +87,13 @@
}
}
+ public void bindObject(final String name, final PortBase port) {
+ rtcout.println(Logbuf.TRACE, "bindObject(" + name + ",rtobj)");
+ try{
+ m_cosnaming.rebindByString(name, port.getPortRef(), true);
+ } catch ( Exception ex ) {
+ }
+ }
/**
* {@.ja 指定したManagerServantをNamingServiceへバインド}
* {@.en Bind the specified ManagerServants to NamingService}
@@ -143,6 +151,9 @@
return m_cosnaming.isAlive();
}
+ public CorbaNaming getCorbaNaming() {
+ return m_cosnaming;
+ }
private CorbaNaming m_cosnaming;
/**
* {@.ja Logging用フォーマットオブジェクト}
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingService.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingService.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingService.java 2016-02-21 06:27:31 UTC (rev 763)
@@ -0,0 +1,48 @@
+package jp.go.aist.rtm.RTC;
+
+
+ /**
+ * {@.ja NameServer 管理用構造体}
+ * {@.en Structure for NameServer management}
+ */
+class NamingService {
+ /**
+ * {@.ja コンストラクタ。}
+ * {@.en Constructor}
+ *
+ * @param meth
+ * {@.ja NamingServerタイプ}
+ * {@.en NamingServer type}
+ * @param name
+ * {@.ja NamingServer名称}
+ * {@.en NamingServer name}
+ * @param naming
+ * {@.ja NameServerオブジェクト}
+ * {@.en NamingServer object}
+ *
+ */
+ public NamingService(final String meth, final String name, NamingBase naming) {
+ method = meth;
+ nsname = name;
+ ns = naming;
+ }
+
+
+ /**
+ * {@.ja NamingServerタイプ}
+ * {@.en NamingServer type}
+ */
+ public String method;
+ /**
+ * {@.ja NamingServer名称}
+ * {@.en NamingServer name}
+ */
+ public String nsname;
+ /**
+ * {@.ja NameServerオブジェクト}
+ * {@.en NameServer object}
+ */
+ public NamingBase ns;
+}
+
+
More information about the openrtm-commit
mailing list