[openrtm-commit:00119] r182 - in trunk/rtmtools: jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/factory jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/synchronizationframework

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 5月 27日 (金) 18:36:11 JST


Author: ta
Date: 2011-05-27 18:36:11 +0900 (Fri, 27 May 2011)
New Revision: 182

Modified:
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/factory/CompositeComponentCreator.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/Component.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/SystemDiagram.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentImpl.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentSpecificationImpl.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaComponentImpl.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/SystemDiagramImpl.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/synchronizationframework/SynchronizationSupport.java
Log:
separate remote/local synchronization.

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/factory/CompositeComponentCreator.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/factory/CompositeComponentCreator.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/factory/CompositeComponentCreator.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -20,7 +20,6 @@
 import jp.go.aist.rtm.toolscommon.manager.ToolsCommonPreferenceManager;
 import jp.go.aist.rtm.toolscommon.model.component.Component;
 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.ConfigurationSet;
 import jp.go.aist.rtm.toolscommon.model.component.CorbaComponent;
 import jp.go.aist.rtm.toolscommon.model.component.ExecutionContext;
@@ -320,13 +319,9 @@
 				SystemEditorWrapperFactory.getInstance()
 						.getSynchronizationManager()
 						.assignSynchonizationSupport(comp);
-				if (comp instanceof CorbaComponent) {
-					// 同期(SDOOrganization)
-					comp.synchronizeLocalAttribute(ComponentPackage.eINSTANCE
-							.getCorbaComponent_SDOOrganization());
-				}
 				comp.setComponentsR(base.components);
 				// 同期
+				comp.synchronizeRemoteAttribute(null);
 				comp.synchronizeLocalAttribute(null);
 				comp.synchronizeLocalReference();
 				// Constraintを設定する

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -848,12 +848,13 @@
 		// 複合RTCエディタが開かれていたら閉じる
 		if (getSystemDiagram() == null)
 			return;
-		if (getSystemDiagram().getComponents() == null)
-			return;
-		for (Component ac : getSystemDiagram().getComponents()) {
-			ComponentUtil.closeCompositeComponent(ac);
+		if (getSystemDiagram().getComponents() != null) {
+			for (Component ac : getSystemDiagram().getComponents()) {
+				ComponentUtil.closeCompositeComponent(ac);
+			}
 		}
 		getSystemDiagram().clearComponents();
+		getSystemDiagram().dispose();
 		systemDiagram = null;
 	}
 

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -264,12 +264,11 @@
 		}
 		if (targetComponent instanceof CorbaComponent) {
 			CorbaComponent c = (CorbaComponent) targetComponent;
-			c.synchronizeLocalAttribute(
-					ComponentPackage.eINSTANCE
-							.getComponent_ConfigurationSets());
-			c.synchronizeLocalAttribute(
-					ComponentPackage.eINSTANCE
-							.getComponent_ActiveConfigurationSet());
+			c.synchronizeRemoteAttribute(ComponentPackage.eINSTANCE
+					.getComponent_ConfigurationSets());
+			c.synchronizeRemoteAttribute(ComponentPackage.eINSTANCE
+					.getComponent_ActiveConfigurationSet());
+			c.synchronizeLocalAttribute(null);
 		}
 		buildData();
 

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -605,4 +605,14 @@
 		return null;
 	}
 
+	@Override
+	public void synchronizeRemoteAttribute(EStructuralFeature reference) {
+		// TODO Auto-generated method stub
+	}
+
+	@Override
+	public void synchronizeRemoteChildComponents() {
+		// TODO Auto-generated method stub
+	}
+
 }

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/Component.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/Component.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/Component.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -705,12 +705,23 @@
 	void synchronizeManually();
 
 	/**
-	 * 子コンポーネントの同期を手動で行う
+	 * 子コンポーネントのリモートからの同期を手動で行う
 	 */
+	void synchronizeRemoteChildComponents();
+
+	/**
+	 * 指定した属性(nullの場合は全属性)をリモートから同期する
+	 * @param reference
+	 */
+	void synchronizeRemoteAttribute(EStructuralFeature reference);
+
+	/**
+	 * 子コンポーネントのローカルでの同期を手動で行う
+	 */
 	void synchronizeChildComponents();
-	
+
 	/**
-	 * 指定した属性(nullの場合は全属性)の同期を実行する
+	 * 指定した属性(nullの場合は全属性)をローカルで同期する
 	 * @param reference
 	 */
 	void synchronizeLocalAttribute(EStructuralFeature reference);

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/SystemDiagram.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/SystemDiagram.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/SystemDiagram.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -237,6 +237,11 @@
 	RtsProfileExt getProfile();
 
 	/**
+	 * ダイアグラムを終了
+	 */
+	void dispose();
+
+	/**
 	 * @return 複合RTCの内部を表現するダイアグラムでない、RTシステムそのものを表現するダイアグラム
 	 */
 	SystemDiagram getRootDiagram();

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentImpl.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentImpl.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -29,13 +29,13 @@
 import jp.go.aist.rtm.toolscommon.model.core.ModelElement;
 import jp.go.aist.rtm.toolscommon.model.core.Visiter;
 import jp.go.aist.rtm.toolscommon.model.core.impl.WrapperObjectImpl;
-import jp.go.aist.rtm.toolscommon.synchronizationframework.LocalObject;
 
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
 import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
@@ -1487,34 +1487,46 @@
 		return getComponentId().hashCode() * 3 + getPathId().hashCode() + 5;
 	}
 
-	public void synchronizeChildComponents() {
-		for (Object content : eContents()) {
-			if (content instanceof LocalObject) {
-				LocalObject lo = (LocalObject) content;
-				if (lo.getSynchronizationSupport() != null) {
-					lo.getSynchronizationSupport().synchronizeLocal();
-				}
-			}
+	@Override
+	public void synchronizeManually() {
+	}
+
+	@Override
+	public void synchronizeRemoteChildComponents() {
+		if (getComponents() == null) {
+			return;
 		}
-		for (ExecutionContext pc : getParticipationContexts()) {
-			if (pc.getSynchronizationSupport() != null) {
-				pc.getSynchronizationSupport().synchronizeLocal();
-			}
+		for (Component comp : getComponents()) {
+			comp.synchronizeRemoteAttribute(null);
+			comp.synchronizeRemoteChildComponents();
 		}
+	}
 
+	@Override
+	public void synchronizeRemoteAttribute(EStructuralFeature reference) {
+	}
+
+	@Override
+	public void synchronizeChildComponents() {
 		if (getComponents() == null) {
 			return;
 		}
-		for (Object obj : getComponents()) {
-			if (obj instanceof CorbaComponent) {
-				CorbaComponent c = (CorbaComponent) obj;
-				c.synchronizeLocalAttribute(null);
-				c.synchronizeLocalReference();
-				c.synchronizeChildComponents();
-			}
+		for (Component comp : getComponents()) {
+			comp.synchronizeLocalAttribute(null);
+			comp.synchronizeLocalReference();
+			comp.synchronizeChildComponents();
 		}
 	}
 
+	@Override
+	public void synchronizeLocalAttribute(EStructuralFeature reference) {
+	}
+
+	@Override
+	public void synchronizeLocalReference() {
+	}
+
+	@Override
 	public synchronized void addComponent(Component component) {
 		getComponents().add(component);
 	}

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentSpecificationImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentSpecificationImpl.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/ComponentSpecificationImpl.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -31,7 +31,6 @@
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.ui.views.properties.IPropertySource;
@@ -540,10 +539,7 @@
 		};
 	}
 
-	public void synchronizeLocalAttribute(EStructuralFeature reference) {
-		// Nothing to do
-	}
-
+	@Override
 	public void synchronizeLocalReference() {
 		if (!inOnlineSystemDiagram()) return;
 		if (!isGroupingCompositeComponent()) return;
@@ -566,11 +562,6 @@
 	}
 
 	@Override
-	public void synchronizeManually() {
-		//Nothing to do
-	}
-	
-	@Override
 	public Component copy() {
 		Component copy = (Component) EcoreUtil.copy(this);
 		// ExecutionContextとIDの関連付けを複製
@@ -608,5 +599,4 @@
 		return true;
 	}
 
-
 } // ComponentSpecificationImpl

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaComponentImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaComponentImpl.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/CorbaComponentImpl.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -390,10 +390,17 @@
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @generated
+	 * @generated NOT
 	 */
 	@Override
 	public Configuration getSDOConfiguration() {
+		try {
+			RTC.RTObject ro = getCorbaObjectInterface();
+			_SDOPackage.Configuration conf = ro.get_configuration();
+			setSDOConfiguration(conf);
+		} catch (Exception e) {
+			// void
+		}
 		return sDOConfiguration;
 	}
 
@@ -462,10 +469,21 @@
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
-	 * @generated
+	 * @generated NOT
 	 */
 	@Override
 	public Organization getSDOOrganization() {
+		try {
+			RTC.RTObject ro = getCorbaObjectInterface();
+			Organization[] orgs = ro.get_owned_organizations();
+			if (orgs == null || orgs.length == 0) {
+				setSDOOrganization(new NullSDOOrganization());
+			} else {
+				setSDOOrganization(orgs[0]); // 1つ目固定
+			}
+		} catch (Exception e) {
+			setSDOOrganization(new NullSDOOrganization());
+		}
 		return sDOOrganization;
 	}
 
@@ -1388,146 +1406,87 @@
 			}, new AttributeMapping[] {}, new ReferenceMapping[] {});
 
 	@Override
+	public void synchronizeRemoteAttribute(EStructuralFeature reference) {
+		ComponentPackage pkg = ComponentPackage.eINSTANCE;
+		RTC.RTObject ro = getCorbaObjectInterface();
+		//
+		if (pkg.getCorbaComponent_RTCComponentProfile().equals(reference)
+				|| reference == null) {
+			synchronizeRemote_RTCComponentProfile();
+		}
+		//
+		if (pkg.getCorbaComponent_RTCExecutionContexts().equals(reference)
+				|| reference == null) {
+			synchronizeRemote_RTCExecutionContexts();
+			// owned context
+			RTC.ExecutionContext[] oec = CorbaObjectStore.eINSTANCE
+					.findOwnedContexts(ro);
+			if (oec != null) {
+				for (RTC.ExecutionContext ec : oec) {
+					// ec profile
+					synchronizeRemote_EC_ECProfile(ec);
+					// ec state
+					synchronizeRemote_EC_ECState(ec);
+					// component state
+					synchronizeRemote_EC_ComponentState(ec);
+				}
+			}
+			// participating context
+			RTC.ExecutionContext[] pec = CorbaObjectStore.eINSTANCE
+					.findParticipatingContexts(ro);
+			if (pec != null) {
+				for (RTC.ExecutionContext ec : pec) {
+					// component state
+					synchronizeRemote_EC_ComponentState(ec);
+				}
+			}
+		}
+		//
+		if (pkg.getComponent_ConfigurationSets().equals(reference)
+				|| reference == null) {
+			synchronizeRemote_ConfigurationSets();
+		}
+		//
+		if (pkg.getComponent_ActiveConfigurationSet().equals(reference)
+				|| reference == null) {
+			synchronizeRemote_ActiveConfigurationSet();
+		}
+		//
+		if (pkg.getCorbaComponent_RTCRTObjects().equals(reference)
+				|| reference == null) {
+			synchronizeRemote_RTCRTObjects();
+		}
+	}
+
+	@Override
 	public void synchronizeLocalAttribute(EStructuralFeature reference) {
-		if (getStatusObserver() != null) {
-			// オブザーバの場合の更新
+		ComponentPackage pkg = ComponentPackage.eINSTANCE;
+		if (pkg.getCorbaComponent_RTCComponentProfile().equals(reference)
+				|| reference == null) {
 			synchronizeLocal_RTCComponentProfile();
+		}
+		//
+		if (pkg.getCorbaComponent_RTCExecutionContexts().equals(reference)
+				|| reference == null) {
 			synchronizeLocal_RTCExecutionContexts();
+		}
+		//
+		if (pkg.getComponent_ConfigurationSets().equals(reference)
+				|| reference == null) {
 			synchronizeLocal_ConfigurationSets();
+		}
+		//
+		if (pkg.getComponent_ActiveConfigurationSet().equals(reference)
+				|| reference == null) {
 			synchronizeLocal_ActiveConfigurationSet();
+		}
+		//
+		if (pkg.getCorbaComponent_RTCRTObjects().equals(reference)
+				|| reference == null) {
 			synchronizeLocal_RTCRTObjects();
-			return;
 		}
-		for (AttributeMapping attibuteMapping : getAttributeMappings()) {
-			if (reference != null) {
-				if (reference.equals(attibuteMapping.getLocalFeature())) {
-					try {
-						attibuteMapping.syncronizeLocal(this);
-						break;
-					} catch (Exception e) {
-						e.printStackTrace();
-						return;
-					}
-				}
-			} else {
-				try {
-					attibuteMapping.syncronizeLocal(this);
-				} catch (Exception e) {
-					e.printStackTrace();
-					return;
-				}
-			}
-		}
 	}
 
-	private static AttributeMapping[] getAttributeMappings() {
-		return new AttributeMapping[] {
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getCorbaComponent_SDOConfiguration(), true) {
-					@Override
-					public Object getRemoteAttributeValue(
-							LocalObject localObject, Object[] remoteObjects) {
-						Object result = null;
-						try {
-							result = RTC.RTObjectHelper.narrow(
-									(org.omg.CORBA.Object) remoteObjects[0])
-									.get_configuration();
-						} catch (Exception e) {
-							// void
-						}
-						return result;
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getCorbaComponent_SDOOrganization(), true) {
-					@Override
-					public Object getRemoteAttributeValue(
-							LocalObject localObject, Object[] remoteObjects) {
-						try {
-							RTC.RTObject ro = RTC.RTObjectHelper
-									.narrow((org.omg.CORBA.Object) remoteObjects[0]);
-							Organization[] orgs = ro.get_owned_organizations();
-							if (orgs == null || orgs.length == 0) {
-								return new NullSDOOrganization();
-							}
-							return orgs[0]; // 1つ目固定
-						} catch (Exception e) {
-							return new NullSDOOrganization();
-						}
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getCorbaComponent_RTCComponentProfile(), false) {
-					@Override
-					public void syncronizeLocal(LocalObject localObject) {
-						CorbaComponentImpl cc = (CorbaComponentImpl) localObject;
-						cc.synchronizeRemote_RTCComponentProfile();
-						cc.synchronizeLocal_RTCComponentProfile();
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getCorbaComponent_RTCExecutionContexts(), false) {
-					@Override
-					public void syncronizeLocal(LocalObject localObject) {
-						CorbaComponentImpl cc = (CorbaComponentImpl) localObject;
-						cc.synchronizeRemote_RTCExecutionContexts();
-						//
-						RTC.RTObject ro = cc.getCorbaObjectInterface();
-						// owned context
-						RTC.ExecutionContext[] oec = CorbaObjectStore.eINSTANCE
-								.findOwnedContexts(ro);
-						if (oec != null) {
-							for (RTC.ExecutionContext ec : oec) {
-								// ec profile
-								synchronizeRemote_EC_ECProfile(ec);
-								// ec state
-								synchronizeRemote_EC_ECState(ec);
-								// component state
-								cc.synchronizeRemote_EC_ComponentState(ec);
-							}
-						}
-						// participating context
-						RTC.ExecutionContext[] pec = CorbaObjectStore.eINSTANCE
-								.findParticipatingContexts(ro);
-						if (pec != null) {
-							for (RTC.ExecutionContext ec : pec) {
-								// component state
-								cc.synchronizeRemote_EC_ComponentState(ec);
-							}
-						}
-						//
-						cc.synchronizeLocal_RTCExecutionContexts();
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getComponent_ConfigurationSets()) {
-					@Override
-					public void syncronizeLocal(LocalObject localObject) {
-						CorbaComponentImpl cc = (CorbaComponentImpl) localObject;
-						cc.synchronizeRemote_ConfigurationSets();
-						cc.synchronizeLocal_ConfigurationSets();
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getComponent_ActiveConfigurationSet()) {
-					@Override
-					public void syncronizeLocal(LocalObject localObject) {
-						CorbaComponentImpl cc = (CorbaComponentImpl) localObject;
-						cc.synchronizeRemote_ActiveConfigurationSet();
-						cc.synchronizeLocal_ActiveConfigurationSet();
-					}
-				},
-				new AttributeMapping(ComponentPackage.eINSTANCE
-						.getCorbaComponent_RTCRTObjects(), false) {
-					@Override
-					public void syncronizeLocal(LocalObject localObject) {
-						CorbaComponentImpl cc = (CorbaComponentImpl) localObject;
-						cc.synchronizeRemote_RTCRTObjects();
-						cc.synchronizeLocal_RTCRTObjects();
-					}
-				}, };
-	}
-
 	/** RTC.ComponentProfileの同期 (CORBA=>オブジェクトDB) */
 	public void synchronizeRemote_RTCComponentProfile() {
 		RTC.RTObject ro = getCorbaObjectInterface();
@@ -2061,6 +2020,10 @@
 		if (System.currentTimeMillis() - lastExecutedTime < SYNC_MANUAL_INTERVAL) {
 			return;
 		}
+		//
+		synchronizeRemoteAttribute(null);
+		synchronizeRemoteChildComponents();
+		//
 		synchronizeLocalAttribute(null);
 		synchronizeLocalReference();
 		synchronizeChildComponents();
@@ -2107,4 +2070,4 @@
 		return !SynchronizationSupport.ping(getCorbaObject());
 	}
 
-} //CorbaComponentImpl
+} // CorbaComponentImpl

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/SystemDiagramImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/SystemDiagramImpl.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/model/component/impl/SystemDiagramImpl.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -25,7 +25,6 @@
 import jp.go.aist.rtm.toolscommon.model.component.util.CorbaObserverStore;
 import jp.go.aist.rtm.toolscommon.model.component.util.PropertyMap;
 import jp.go.aist.rtm.toolscommon.model.core.impl.ModelElementImpl;
-import jp.go.aist.rtm.toolscommon.synchronizationframework.LocalObject;
 import jp.go.aist.rtm.toolscommon.synchronizationframework.RefreshThread;
 import jp.go.aist.rtm.toolscommon.synchronizationframework.SynchronizationSupport;
 import jp.go.aist.rtm.toolscommon.ui.propertysource.SystemDiagramPropertySource;
@@ -308,7 +307,6 @@
 			eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.SYSTEM_DIAGRAM__COMPOSITE_COMPONENT, oldCompositeComponent, compositeComponent));
 	}
 
-	private RefreshThread refreshThread;
 	/**
 	 * The default value of the '{@link #isConnectorProcessing() <em>Connector Processing</em>}' attribute.
 	 * <!-- begin-user-doc -->
@@ -409,25 +407,42 @@
 	 */
 	protected Component compositeComponent;
 
+	RefreshThread syncRemoteThread;
+	RefreshThread syncLocalThread;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
 	 */
 	@Override
 	public synchronized void setSynchronizeInterval(long milliSecond) {
-		if (!SystemDiagramKind.ONLINE_LITERAL.equals(getKind())) return;
-		if (refreshThread == null) {
-			refreshThread = new RefreshThread(milliSecond){
+		if (!SystemDiagramKind.ONLINE_LITERAL.equals(getKind())) {
+			return;
+		}
+		// CORBAからの同期
+		if (syncRemoteThread == null) {
+			syncRemoteThread = new RefreshThread(milliSecond) {
 				@Override
 				protected void executeCommand() {
-					synchronizeLocal();
+					synchronizeRemote();
 				}
 			};
-			refreshThread.setDaemon(true);
-			refreshThread.start();
+			syncRemoteThread.setDaemon(true);
+			syncRemoteThread.start();
 		} else {
-			refreshThread.setSynchronizeInterval(milliSecond);
+			syncRemoteThread.setSynchronizeInterval(milliSecond);
 		}
+		// モデルへの同期
+		if (syncLocalThread == null) {
+			syncLocalThread = new RefreshThread(1000) {
+				@Override
+				protected void executeCommand() {
+					synchronizeLocal();
+				}
+			};
+			syncLocalThread.setDaemon(true);
+			syncLocalThread.start();
+		}
 	}
 
 	protected synchronized List<Component> getUnmodifiedComponents() {
@@ -831,9 +846,68 @@
 		return connectorMap;
 	}
 
-	private void synchronizeLocal() {
-		// リモートと同期を取る
-		synchronizeFromRemote();
+	@Override
+	public void dispose() {
+		if (syncLocalThread != null) {
+			syncLocalThread.setSynchronizeInterval(-1);
+			syncLocalThread = null;
+		}
+		if (syncRemoteThread != null) {
+			syncRemoteThread.setSynchronizeInterval(-1);
+			syncRemoteThread = null;
+		}
+	}
+
+	void synchronizeRemote() {
+		if (getParentSystemDiagram() == null) {
+			for (Component component : getUnmodifiedComponents()) {
+				if (component instanceof CorbaComponentImpl) {
+					CorbaComponentImpl corbaComp = (CorbaComponentImpl) component;
+					CorbaStatusObserver obs = corbaComp.getStatusObserver();
+					if (obs != null) {
+						continue;
+					}
+				}
+				//
+				SynchronizationSupport support = component
+						.getSynchronizationSupport();
+				if (support == null) {
+					continue;
+				}
+				support.synchronizeRemote();
+			}
+		}
+	}
+
+	void synchronizeLocal() {
+		// // リモートと同期を取る
+		if (getParentSystemDiagram() == null) {
+			for (Component component : getUnmodifiedComponents()) {
+				if (component instanceof CorbaComponentImpl) {
+					CorbaComponentImpl corbaComp = (CorbaComponentImpl) component;
+					CorbaStatusObserver obs = corbaComp.getStatusObserver();
+					if (obs != null) {
+						// 状態通知オブザーバが登録されている場合の同期
+						if (obs.isTimeOut()) {
+							// H.Bがタイムアウトしていたらダイアグラムから削除
+							if (!SynchronizationSupport.ping(corbaComp
+									.getCorbaObjectInterface())) {
+								removeComponent(corbaComp);
+							}
+							continue;
+						}
+					}
+				}
+				//
+				SynchronizationSupport support = component
+						.getSynchronizationSupport();
+				if (support == null) {
+					continue;
+				}
+				support.synchronizeLocal();
+			}
+		}
+		//
 		try {
 			closeIfExit();
 		} catch (Exception e) {
@@ -879,56 +953,12 @@
 		return false;
 	}
 
-	private void synchronizeFromRemote() {
-		if (getParentSystemDiagram() != null) {
-			return;
-		}
-		List<Component> components = getUnmodifiedComponents();
-		for (Component component : components) {
-			if (component instanceof CorbaComponentImpl) {
-				CorbaComponentImpl corbaComp = (CorbaComponentImpl) component;
-				CorbaStatusObserver obs = corbaComp.getStatusObserver();
-				if (obs != null) {
-					// 状態通知オブザーバが登録されている場合の同期
-					if (obs.isTimeOut()) {
-						// H.Bがタイムアウトしていたらダイアグラムから削除
-						if (!SynchronizationSupport.ping(corbaComp
-								.getCorbaObjectInterface())) {
-							removeComponent(corbaComp);
-						}
-						continue;
-					}
-					corbaComp.synchronizeLocalAttribute(null);
-					corbaComp.synchronizeLocalReference();
-					corbaComp.synchronizeChildComponents();
-					for (Object content : corbaComp.eContents()) {
-						if (content instanceof LocalObject) {
-							LocalObject lo = (LocalObject) content;
-							if (lo.getSynchronizationSupport() != null) {
-								lo.getSynchronizationSupport()
-										.synchronizeLocal();
-							}
-						}
-					}
-					continue;
-				}
-			}
-			//
-			SynchronizationSupport support = component
-					.getSynchronizationSupport();
-			if (support == null) {
-				continue;
-			}
-			support.synchronizeLocal();
-		}
-	}
-
 	@Override
 	public synchronized boolean synchronizeManually() {
 		if (!SystemDiagramKind.ONLINE_LITERAL.equals(getKind())) {
 			return false;
 		}
-		if (refreshThread != null && refreshThread.isRunning()) {
+		if (syncRemoteThread != null && syncRemoteThread.isRunning()) {
 			return false;
 		}
 		synchronizeLocal();

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/synchronizationframework/SynchronizationSupport.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/synchronizationframework/SynchronizationSupport.java	2011-05-27 09:35:58 UTC (rev 181)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/synchronizationframework/SynchronizationSupport.java	2011-05-27 09:36:11 UTC (rev 182)
@@ -56,30 +56,40 @@
 	}
 
 	/**
-	 * ローカルオブジェクトを同期する。
-	 * <p>
-	 * 包含参照をたどり、すべてのローカルオブジェクトを同期する
+	 * リモートオブジェクトを同期する。
 	 */
-	public synchronized void synchronizeLocal() {
+	public synchronized void synchronizeRemote() {
 		Object[] remoteObjects = null;
 		try {
 			remoteObjects = getRemoteObjects(); // 例外が発生することがある
 		} catch (Exception e) {
 			// void
 		}
-
 		if (!mappingRule.getClassMapping().allowZombie()
 				&& (remoteObjects == null || !ping(remoteObjects))) {
 			remove();
 			return;
 		}
+		synchronizeRemoteAttribute();
+		if (localObject.eContainer() instanceof SystemDiagram) {
+			if (localObject instanceof Component) {
+				((Component) localObject).synchronizeRemoteChildComponents();
+			}
+		}
+	}
+
+	/**
+	 * ローカルオブジェクトを同期する。
+	 * <p>
+	 * 包含参照をたどり、すべてのローカルオブジェクトを同期する
+	 */
+	public synchronized void synchronizeLocal() {
 		synchronizeLocalAttribute();
 		synchronizeLocalReference();
 		if (localObject.eContainer() instanceof SystemDiagram) {
 			if (localObject instanceof Component) {
 				((Component) localObject).synchronizeChildComponents();
 			}
-			return;
 		}
 		for (Object content : localObject.eContents()) {
 			if (content instanceof LocalObject) {
@@ -102,11 +112,19 @@
 		}
 	}
 
+	private void synchronizeRemoteAttribute() {
+		if (localObject.eContainer() instanceof SystemDiagram) {
+			if (localObject instanceof Component) {
+				((Component) localObject).synchronizeRemoteAttribute(null);
+			}
+		}
+	}
+
 	private void synchronizeLocalAttribute() {
 		if (localObject.eContainer() instanceof SystemDiagram) {
 			if (localObject instanceof Component) {
 				((Component) localObject).synchronizeLocalAttribute(null);
-			} 
+			}
 		}
 		for (AttributeMapping attibuteMapping : mappingRule
 				.getAllAttributeMappings()) {
@@ -121,9 +139,8 @@
 	private void synchronizeLocalReference() {
 		if (localObject.eContainer() instanceof SystemDiagram) {
 			if (localObject instanceof Component) {
-				((Component) localObject)
-						.synchronizeLocalReference();
-			} 
+				((Component) localObject).synchronizeLocalReference();
+			}
 		}
 		for (ReferenceMapping referenceMapping : mappingRule
 				.getAllReferenceMappings()) {



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