[openrtm-commit:00737] r278 - in trunk/rtmtools/jp.go.aist.rtm.toolscommon: src/jp/go/aist/rtm/toolscommon/model src/jp/go/aist/rtm/toolscommon/model/component src/jp/go/aist/rtm/toolscommon/model/component/impl src/jp/go/aist/rtm/toolscommon/util text
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 2月 21日 (火) 02:56:11 JST
Author: sakamoto
Date: 2012-02-21 02:56:11 +0900 (Tue, 21 Feb 2012)
New Revision: 278
Modified:
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component.ecore
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/PortSynchronizer.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentPackageImpl.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortConnectorImpl.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortSynchronizerImpl.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortConnectorSpecificationImpl.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortSynchronizerImpl.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ConnectorUtil.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java
trunk/rtmtools/jp.go.aist.rtm.toolscommon/text/description.txt
Log:
Update Single Port connection #2296
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/PortSynchronizer.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/PortSynchronizer.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/PortSynchronizer.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -58,12 +58,28 @@
/**
* <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ boolean disconnect(String conn_id);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ boolean disconnect(ConnectorProfile conn_prof);
+
+ /**
+ * <!-- begin-user-doc -->
* 当該ポート上の接続をすべて切断する。
* <!-- end-user-doc -->
* @model
* @generated
*/
- void disconnectAll();
+ boolean disconnectAll();
String getDataflowType();
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentPackageImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentPackageImpl.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentPackageImpl.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -2185,8 +2185,14 @@
initEClass(portSynchronizerEClass, PortSynchronizer.class, "PortSynchronizer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getPortSynchronizer_OriginalPortString(), ecorePackage.getEString(), "originalPortString", null, 0, 1, PortSynchronizer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(portSynchronizerEClass, null, "disconnectAll", 0, 1, IS_UNIQUE, IS_ORDERED);
+ op = addEOperation(portSynchronizerEClass, ecorePackage.getEBoolean(), "disconnect", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, ecorePackage.getEString(), "conn_id", 0, 1, IS_UNIQUE, IS_ORDERED);
+ op = addEOperation(portSynchronizerEClass, ecorePackage.getEBoolean(), "disconnect", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, this.getConnectorProfile(), "conn_prof", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ addEOperation(portSynchronizerEClass, ecorePackage.getEBoolean(), "disconnectAll", 0, 1, IS_UNIQUE, IS_ORDERED);
+
initEClass(portConnectorEClass, PortConnector.class, "PortConnector", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getPortConnector_ConnectorProfile(), this.getConnectorProfile(), null, "connectorProfile", null, 0, 1, PortConnector.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getPortConnector_RoutingConstraint(), this.getEIntegerObjectToPointMapEntry(), null, "routingConstraint", null, 0, -1, PortConnector.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortConnectorImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortConnectorImpl.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortConnectorImpl.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -6,6 +6,9 @@
*/
package jp.go.aist.rtm.toolscommon.model.component.impl;
+import java.util.ArrayList;
+import java.util.List;
+
import jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile;
import jp.go.aist.rtm.toolscommon.model.component.CorbaPortSynchronizer;
import jp.go.aist.rtm.toolscommon.model.component.Port;
@@ -40,17 +43,33 @@
if (profile.connector_id == null) {
profile.connector_id = "";
}
-
profile.name = connectorProfile.getName();
- profile.ports = new RTC.PortService[] { getCorbaObjectInterface(first),
- getCorbaObjectInterface(second) };
- profile.properties = CorbaConnectorProfileImpl.createProperties(connectorProfile);
+ List<RTC.PortService> portLists = new ArrayList<RTC.PortService>();
+ RTC.PortService firstPortService = null;
+ RTC.PortService secondPortService = null;
+ if (first != null) {
+ firstPortService = getCorbaObjectInterface(first);
+ portLists.add(firstPortService);
+ }
+ if (second != null) {
+ secondPortService = getCorbaObjectInterface(second);
+ portLists.add(secondPortService);
+ }
+ profile.ports = portLists.toArray(new RTC.PortService[0]);
+ profile.properties = CorbaConnectorProfileImpl
+ .createProperties(connectorProfile);
+
ConnectorProfileHolder connectorProfileHolder = new ConnectorProfileHolder(
profile);
- getCorbaObjectInterface(first).connect(connectorProfileHolder);
+ RTC.ReturnCode_t ret = RTC.ReturnCode_t.BAD_PARAMETER;
+ if (firstPortService != null) {
+ ret = firstPortService.connect(connectorProfileHolder);
+ } else if (secondPortService != null) {
+ ret = secondPortService.connect(connectorProfileHolder);
+ }
+ return ret == RTC.ReturnCode_t.RTC_OK;
- return true;
} catch (RuntimeException e) {
e.printStackTrace();
}
@@ -59,24 +78,24 @@
}
private PortService getCorbaObjectInterface(Port port) {
- CorbaPortSynchronizer synchronizer = (CorbaPortSynchronizer) port.getSynchronizer();
+ CorbaPortSynchronizer synchronizer = (CorbaPortSynchronizer) port
+ .getSynchronizer();
return (PortService) synchronizer.getCorbaObjectInterface();
}
+ @Override
public boolean deleteConnectorR() {
try {
RTC.PortService inport = getCorbaObjectInterface(getTarget());
-
ReturnCode_t code = inport.disconnect(this.getConnectorProfile()
.getConnectorId());
-
if (code == ReturnCode_t.RTC_OK) {
return true;
}
} catch (RuntimeException e) {
// void
}
-
return false;
}
-} //CorbaPortConnectorImpl
+
+} // CorbaPortConnectorImpl
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortSynchronizerImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortSynchronizerImpl.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaPortSynchronizerImpl.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -13,6 +13,7 @@
import jp.go.aist.rtm.toolscommon.factory.CorbaWrapperFactory;
import jp.go.aist.rtm.toolscommon.model.component.ComponentFactory;
import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
+import jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile;
import jp.go.aist.rtm.toolscommon.model.component.CorbaPortInterfaceProfile;
import jp.go.aist.rtm.toolscommon.model.component.CorbaPortSynchronizer;
import jp.go.aist.rtm.toolscommon.model.component.IPropertyMap;
@@ -183,6 +184,41 @@
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public boolean disconnect(String conn_id) {
+ RTC.ReturnCode_t ret = getCorbaObjectInterface().disconnect(conn_id);
+ return ret == RTC.ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public boolean disconnect(ConnectorProfile conn_prof) {
+ if (conn_prof == null) {
+ return false;
+ }
+ return disconnect(conn_prof.getConnectorId());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public boolean disconnectAll() {
+ RTC.ReturnCode_t ret = getCorbaObjectInterface().disconnect_all();
+ return ret != RTC.ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
@Override
@@ -440,11 +476,6 @@
}
@Override
- public void disconnectAll() {
- getCorbaObjectInterface().disconnect_all();
- }
-
- @Override
public String getDataflowType() {
String result = getProperty(PROP.DATAFLOW_TYPE);
return result;
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortConnectorSpecificationImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortConnectorSpecificationImpl.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortConnectorSpecificationImpl.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -22,24 +22,29 @@
*
* @generated
*/
-public class PortConnectorSpecificationImpl extends PortConnectorImpl
- implements PortConnector {
+public class PortConnectorSpecificationImpl extends PortConnectorImpl implements
+ PortConnector {
-
- @SuppressWarnings("unchecked")
public boolean createConnectorR(Port source, Port target,
ConnectorProfile connectorProfile) {
if (connectorProfile.getConnectorId() == null) {
connectorProfile.setConnectorId(UUID.randomUUID().toString());
}
- connectorProfile.setSourceString(source.getOriginalPortString());
- connectorProfile.setTargetString(target.getOriginalPortString());
- addPortProfile(source, connectorProfile);
- addPortProfile(target, connectorProfile);
+ if (source != null) {
+ connectorProfile.setSourceString(source.getOriginalPortString());
+ }
+ if (target != null) {
+ connectorProfile.setTargetString(target.getOriginalPortString());
+ }
+ if (source != null) {
+ addPortProfile(source, connectorProfile);
+ }
+ if (target != null) {
+ addPortProfile(target, connectorProfile);
+ }
return true;
}
- @SuppressWarnings("unchecked")
private void addPortProfile(Port port, ConnectorProfile connectorProfile) {
for (Object object : port.getConnectorProfiles()) {
if (connectorProfile.getConnectorId().equals(
@@ -50,13 +55,17 @@
port.getConnectorProfiles().add(connectorProfile);
}
- @SuppressWarnings("unchecked")
+ @Override
public boolean deleteConnectorR() {
try {
- removeByID(getSource().getConnectorProfiles(),
- getConnectorProfile());
- removeByID(getTarget().getConnectorProfiles(),
- getConnectorProfile());
+ if (getSource() != null) {
+ removeByID(getSource().getConnectorProfiles(),
+ getConnectorProfile());
+ }
+ if (getTarget() != null) {
+ removeByID(getTarget().getConnectorProfiles(),
+ getConnectorProfile());
+ }
return true;
} catch (RuntimeException e) {
return false;
@@ -74,8 +83,7 @@
@Override
public boolean createConnectorR() {
- return createConnectorR(getSource(), getTarget(),
- getConnectorProfile());
+ return createConnectorR(getSource(), getTarget(), getConnectorProfile());
}
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortSynchronizerImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortSynchronizerImpl.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/PortSynchronizerImpl.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -109,12 +109,61 @@
* <!-- end-user-doc -->
* @generated NOT
*/
- public void disconnectAll() {
+ @Override
+ public boolean disconnect(String conn_id) {
+ Port port = (Port) eContainer();
+ ConnectorProfile profile = findConnProfile(conn_id, port);
+ if (profile == null) {
+ return false;
+ }
+ SystemDiagram diagram = (SystemDiagram) port.eContainer().eContainer();
+ if (diagram == null) {
+ diagram = currentDiagram.getRootDiagram();
+ } else {
+ diagram = diagram.getRootDiagram();
+ }
+ PortConnector connector = PortConnectorFactory
+ .createPortConnectorSpecification();
+ connector.setConnectorProfile(profile);
+ connector.setSource(port.findPort(diagram, profile.getSourceString()));
+ connector.setTarget(port.findPort(diagram, profile.getTargetString()));
+ return connector.deleteConnectorR();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public boolean disconnect(ConnectorProfile conn_prof) {
+ if (conn_prof == null) {
+ return false;
+ }
+ return disconnect(conn_prof.getConnectorId());
+ }
+
+ ConnectorProfile findConnProfile(String conn_id, Port port) {
+ for (ConnectorProfile profile : port.getConnectorProfiles()) {
+ if (conn_id != null && conn_id.equals(profile.getConnectorId())) {
+ return profile;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public boolean disconnectAll() {
// ここではオフラインのポート全切断を行う
Port port = (Port) eContainer();
SystemDiagram diagram = (SystemDiagram) port.eContainer().eContainer();
diagram = diagram != null ? diagram.getRootDiagram() : currentDiagram.getRootDiagram();
-
+
List<ConnectorProfile> profiles = new ArrayList<ConnectorProfile>(port.getConnectorProfiles());
for (ConnectorProfile profile : profiles) {
PortConnector connector = PortConnectorFactory.createPortConnectorSpecification();
@@ -123,6 +172,7 @@
connector.setTarget(port.findPort(diagram, profile.getTargetString()));
connector.deleteConnectorR();
}
+ return true;
}
/**
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component.ecore
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component.ecore 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component.ecore 2012-02-20 17:56:11 UTC (rev 278)
@@ -196,7 +196,13 @@
<eClassifiers xsi:type="ecore:EClass" name="OutPort" eSuperTypes="#//Port"/>
<eClassifiers xsi:type="ecore:EClass" name="ServicePort" eSuperTypes="#//Port"/>
<eClassifiers xsi:type="ecore:EClass" name="PortSynchronizer" eSuperTypes="#//IPropertyMap">
- <eOperations name="disconnectAll"/>
+ <eOperations name="disconnect" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
+ <eParameters name="conn_id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eOperations>
+ <eOperations name="disconnect" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
+ <eParameters name="conn_prof" eType="#//ConnectorProfile"/>
+ </eOperations>
+ <eOperations name="disconnectAll" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="originalPortString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="PortConnector" abstract="true" eSuperTypes="core.ecore#//WrapperObject">
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ConnectorUtil.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ConnectorUtil.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ConnectorUtil.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -23,7 +23,14 @@
* @return
*/
public static boolean isAllowAnyDataType(OutPort source, InPort target) {
- return source.isAllowAnyDataType() && target.isAllowAnyDataType();
+ if (source != null && target != null) {
+ return source.isAllowAnyDataType() && target.isAllowAnyDataType();
+ } else if (source != null && target == null) {
+ return source.isAllowAnyDataType();
+ } else if (source == null && target != null) {
+ return target.isAllowAnyDataType();
+ }
+ return false;
}
/**
@@ -34,8 +41,15 @@
* @return
*/
public static boolean isAllowAnyInterfaceType(OutPort source, InPort target) {
- return source.isAllowAnyInterfaceType()
- && target.isAllowAnyInterfaceType();
+ if (source != null && target != null) {
+ return source.isAllowAnyInterfaceType()
+ && target.isAllowAnyInterfaceType();
+ } else if (source != null && target == null) {
+ return source.isAllowAnyInterfaceType();
+ } else if (source == null && target != null) {
+ return target.isAllowAnyInterfaceType();
+ }
+ return false;
}
/**
@@ -46,8 +60,15 @@
* @return
*/
public static boolean isAllowAnyDataflowType(OutPort source, InPort target) {
- return source.isAllowAnyDataflowType()
- && target.isAllowAnyDataflowType();
+ if (source != null && target != null) {
+ return source.isAllowAnyDataflowType()
+ && target.isAllowAnyDataflowType();
+ } else if (source != null && target == null) {
+ return source.isAllowAnyDataflowType();
+ } else if (source == null && target != null) {
+ return target.isAllowAnyDataflowType();
+ }
+ return false;
}
/**
@@ -59,10 +80,19 @@
*/
public static boolean isAllowAnySubscriptionType(OutPort source,
InPort target) {
- return source.isAllowAnySubscriptionType()
- && target.isAllowAnySubscriptionType();
+ if (source != null && target != null) {
+ return source.isAllowAnySubscriptionType()
+ && target.isAllowAnySubscriptionType();
+ } else if (source != null && target == null) {
+ return source.isAllowAnySubscriptionType();
+ } else if (source == null && target != null) {
+ return target.isAllowAnySubscriptionType();
+ }
+ return false;
}
+ static List<String> emptyList = new ArrayList<String>();
+
/**
* 使用可能なデータ型のリストを返す
*
@@ -71,6 +101,13 @@
* @return
*/
public static List<String> getAllowDataTypes(OutPort source, InPort target) {
+ if (source == null && target == null) {
+ return emptyList;
+ } else if (source != null && target == null) {
+ return source.getDataTypes();
+ } else if (source == null && target != null) {
+ return target.getDataTypes();
+ }
List<String> sourceTypes = source.getDataTypes();
List<String> targetTypes = target.getDataTypes();
//
@@ -89,6 +126,13 @@
*/
public static List<String> getAllowInterfaceTypes(OutPort source,
InPort target) {
+ if (source == null && target == null) {
+ return emptyList;
+ } else if (source != null && target == null) {
+ return source.getInterfaceTypes();
+ } else if (source == null && target != null) {
+ return target.getInterfaceTypes();
+ }
List<String> sourceTypes = source.getInterfaceTypes();
List<String> targetTypes = target.getInterfaceTypes();
//
@@ -107,6 +151,13 @@
*/
public static List<String> getAllowDataflowTypes(OutPort source,
InPort target) {
+ if (source == null && target == null) {
+ return emptyList;
+ } else if (source != null && target == null) {
+ return source.getDataflowTypes();
+ } else if (source == null && target != null) {
+ return target.getDataflowTypes();
+ }
List<String> sourceTypes = source.getDataflowTypes();
List<String> targetTypes = target.getDataflowTypes();
//
@@ -124,6 +175,13 @@
*/
public static List<String> getAllowSubscriptionTypes(OutPort source,
InPort target) {
+ if (source == null && target == null) {
+ return emptyList;
+ } else if (source != null && target == null) {
+ return source.getSubscriptionTypes();
+ } else if (source == null && target != null) {
+ return target.getSubscriptionTypes();
+ }
List<String> sourceTypes = source.getSubscriptionTypes();
List<String> targetTypes = target.getSubscriptionTypes();
//
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java 2012-02-20 17:56:11 UTC (rev 278)
@@ -366,16 +366,19 @@
ComponentExt target, Component original, RtsProfileExt rtsProfile) {
for (jp.go.aist.rtm.toolscommon.model.component.Port ePort : eComp.getOutports()) {
addDataPort(ePort, target, original);
- for(jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf : ePort.getConnectorProfiles() ) {
+ for (jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf : ePort.getConnectorProfiles()) {
addDataPortConnector(eConnProf, rtsProfile, ePort);
}
}
for (jp.go.aist.rtm.toolscommon.model.component.Port ePort : eComp.getInports()) {
addDataPort(ePort, target, original);
+ for (jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf : ePort.getConnectorProfiles()) {
+ addDataPortConnector(eConnProf, rtsProfile, ePort);
+ }
}
for (jp.go.aist.rtm.toolscommon.model.component.Port ePort : eComp.getServiceports()) {
addServicePort(ePort, target, original);
- for(jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf : ePort.getConnectorProfiles() ) {
+ for (jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf : ePort.getConnectorProfiles()) {
addServicePortConnector(eConnProf, rtsProfile, ePort);
}
}
@@ -413,22 +416,35 @@
connector.setInterfaceType(eConnProf.getInterfaceType());
connector.setDataType(eConnProf.getDataType());
connector.setDataflowType(eConnProf.getDataflowType());
- if(eConnProf.getSubscriptionType()!=null) connector.setSubscriptionType(eConnProf.getSubscriptionType());
- if(eConnProf.getPushRate()!=null) connector.setPushInterval(eConnProf.getPushRate());
+ if (eConnProf.getSubscriptionType() != null) {
+ connector.setSubscriptionType(eConnProf.getSubscriptionType());
+ }
+ if (eConnProf.getPushRate() != null) {
+ connector.setPushInterval(eConnProf.getPushRate());
+ }
// ベンドポイントの保存
- jp.go.aist.rtm.toolscommon.model.component.PortConnector ePortConnector = diagram.getConnectorMap().get(eConnProf.getConnectorId());
+ jp.go.aist.rtm.toolscommon.model.component.PortConnector ePortConnector = diagram
+ .getConnectorMap().get(eConnProf.getConnectorId());
if (ePortConnector != null) {
- saveBendPoint(ePortConnector.getRoutingConstraint().map(), connector.getProperties());
+ saveBendPoint(ePortConnector.getRoutingConstraint().map(),
+ connector.getProperties());
}
-
- DataportConnector original = findOrignalDataportConnector(eConnProf.getConnectorId());
- connector.setSourceDataPort(createTargetPort(ePort.findPort(diagram, eConnProf.getSourceString())
- , original == null ? null : original.getSourceDataPort()));
- connector.setTargetDataPort(createTargetPort(ePort.findPort(diagram, eConnProf.getTargetString())
- , original == null ? null : original.getTargetDataPort()));
-
+ DataportConnector original = findOrignalDataportConnector(eConnProf
+ .getConnectorId());
+
+ if (eConnProf.getSourceString() != null) {
+ connector.setSourceDataPort(createTargetPort(ePort.findPort(
+ diagram, eConnProf.getSourceString()),
+ original == null ? null : original.getSourceDataPort()));
+ }
+ if (eConnProf.getTargetString() != null) {
+ connector.setTargetDataPort(createTargetPort(ePort.findPort(
+ diagram, eConnProf.getTargetString()),
+ original == null ? null : original.getTargetDataPort()));
+ }
+
if (original instanceof DataportConnectorExt) {
DataportConnectorExt originalExt = (DataportConnectorExt) original;
connector.setComment(originalExt.getComment());
@@ -507,21 +523,32 @@
private ServiceportConnector saveServicePortConnector(
jp.go.aist.rtm.toolscommon.model.component.Port ePort,
jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile eConnProf) {
- ServiceportConnectorExt connector = factory.createServiceportConnectorExt();
+ ServiceportConnectorExt connector = factory
+ .createServiceportConnectorExt();
connector.setConnectorId(eConnProf.getConnectorId());
connector.setName(eConnProf.getName());
+
// ベンドポイントの保存
- jp.go.aist.rtm.toolscommon.model.component.PortConnector ePortConnector = diagram.getConnectorMap().get(eConnProf.getConnectorId());
+ jp.go.aist.rtm.toolscommon.model.component.PortConnector ePortConnector = diagram
+ .getConnectorMap().get(eConnProf.getConnectorId());
if (ePortConnector != null) {
- saveBendPoint(ePortConnector.getRoutingConstraint().map(), connector.getProperties());
+ saveBendPoint(ePortConnector.getRoutingConstraint().map(),
+ connector.getProperties());
}
- ServiceportConnector original = findOrignalServiceportConnector(eConnProf.getConnectorId());
+ ServiceportConnector original = findOrignalServiceportConnector(eConnProf
+ .getConnectorId());
- connector.setSourceServicePort(createTargetPort(ePort.findPort(diagram, eConnProf.getSourceString())
- , original == null ? null : original.getSourceServicePort()));
- connector.setTargetServicePort(createTargetPort(ePort.findPort(diagram, eConnProf.getTargetString())
- , original == null ? null : original.getTargetServicePort()));
+ if (eConnProf.getSourceString() != null) {
+ connector.setSourceServicePort(createTargetPort(ePort.findPort(
+ diagram, eConnProf.getSourceString()),
+ original == null ? null : original.getSourceServicePort()));
+ }
+ if (eConnProf.getTargetString() != null) {
+ connector.setTargetServicePort(createTargetPort(ePort.findPort(
+ diagram, eConnProf.getTargetString()),
+ original == null ? null : original.getTargetServicePort()));
+ }
if (original instanceof ServiceportConnectorExt) {
if (original != null) {
@@ -1124,13 +1151,17 @@
jp.go.aist.rtm.toolscommon.model.component.Component eComp = null;
jp.go.aist.rtm.toolscommon.model.component.Port eSource = null;
jp.go.aist.rtm.toolscommon.model.component.Port eTarget = null;
- eComp = findEMFComponentByTargetComponent(source, eComps);
- if (eComp != null) {
- eSource = findEMFPortByTargetPort(source, eComp.getPorts());
+ if (source != null) {
+ eComp = findEMFComponentByTargetComponent(source, eComps);
+ if (eComp != null) {
+ eSource = findEMFPortByTargetPort(source, eComp.getPorts());
+ }
}
- eComp = findEMFComponentByTargetComponent(target, eComps);
- if (eComp != null) {
- eTarget = findEMFPortByTargetPort(target, eComp.getPorts());
+ if (target != null) {
+ eComp = findEMFComponentByTargetComponent(target, eComps);
+ if (eComp != null) {
+ eTarget = findEMFPortByTargetPort(target, eComp.getPorts());
+ }
}
jp.go.aist.rtm.toolscommon.model.component.PortConnector eConnector = PortConnectorFactory
.createPortConnector(eSource, eTarget);
Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/text/description.txt
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/text/description.txt 2012-02-20 17:55:25 UTC (rev 277)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/text/description.txt 2012-02-20 17:56:11 UTC (rev 278)
@@ -186,7 +186,9 @@
Class PortSynchronizer -> IPropertyMap
Attribute originalPortString : EString
- Operation disconnectAll() : void
+ Operation disconnect(EString) : EBoolean
+ Operation disconnect(ConnectorProfile) : EBoolean
+ Operation disconnectAll() : EBoolean
Class PortConnector -> WrapperObject
Reference connectorProfile : ConnectorProfile
openrtm-commit メーリングリストの案内