[openrtm-commit:00582] r239 - trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util

openrtm @ openrtm.org openrtm @ openrtm.org
2012年 1月 14日 (土) 00:32:35 JST


Author: sakamoto
Date: 2012-01-14 00:32:35 +0900 (Sat, 14 Jan 2012)
New Revision: 239

Added:
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/DeployProfileHandler.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ProfileHandlerBase.java
Modified:
   trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java
Log:
The addition of Deploy function from OFFLINE Profile

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/DeployProfileHandler.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/DeployProfileHandler.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/DeployProfileHandler.java	2012-01-13 15:32:35 UTC (rev 239)
@@ -0,0 +1,50 @@
+package jp.go.aist.rtm.toolscommon.util;
+
+import javax.xml.datatype.DatatypeFactory;
+
+import org.openrtp.namespaces.deploy.Component;
+import org.openrtp.namespaces.deploy.DeployProfile;
+import org.openrtp.namespaces.deploy.ObjectFactory;
+
+import com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl;
+
+public class DeployProfileHandler extends ProfileHandlerBase {
+	
+	public DeployProfile save(
+			jp.go.aist.rtm.toolscommon.model.component.SystemDiagram eDiagram) {
+		
+		ObjectFactory factory = new ObjectFactory();
+		DeployProfile profile = factory.createDeployProfile();
+		profile.setId(eDiagram.getSystemId());
+		DatatypeFactory dateFactory = new DatatypeFactoryImpl();
+		profile.setCreationDate(dateFactory.newXMLGregorianCalendar(eDiagram.getCreationDate()));
+		profile.setUpdateDate(dateFactory.newXMLGregorianCalendar(eDiagram.getUpdateDate()));
+		profile.setVersion("0.1");
+		//
+		for (jp.go.aist.rtm.toolscommon.model.component.Component eComp:
+				eDiagram.getRegisteredComponents()) {
+			String type = eComp.getProperty(KEY_DEPLOY_TYPE);
+			Component target = factory.createComponent();
+			target.setId(eComp.getComponentId());
+			target.setInstanceName(eComp.getInstanceNameL());
+			if( type==null || type.length()==0 ) {
+				target.setDeployType("None");
+				profile.getComponents().add(target);
+				continue;
+				
+			} else 	if( type.equals("Component")) {
+				target.setDeployType("Component");
+				
+			} else if( type.equals("Manager")) {
+				target.setDeployType("Manager");
+				
+			}
+			target.setTarget(eComp.getProperty(KEY_DEPLOY_TARGET));
+			target.setIor(eComp.getProperty(KEY_DEPLOY_IOR));
+			profile.getComponents().add(target);
+		}
+		
+		return profile;
+	}
+
+}

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ProfileHandlerBase.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ProfileHandlerBase.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/ProfileHandlerBase.java	2012-01-13 15:32:35 UTC (rev 239)
@@ -0,0 +1,8 @@
+package jp.go.aist.rtm.toolscommon.util;
+
+public class ProfileHandlerBase {
+	final static protected String KEY_DEPLOY_TYPE = "DeployType";
+	final static protected String KEY_DEPLOY_TARGET = "DeployTarget";
+	final static protected String KEY_DEPLOY_IOR = "DeployIOR";
+
+}

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-01-13 15:31:45 UTC (rev 238)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon/src/jp/go/aist/rtm/toolscommon/util/RtsProfileHandler.java	2012-01-13 15:32:35 UTC (rev 239)
@@ -61,7 +61,7 @@
  * RTSプロファイルの入出力を司るクラス
  * 
  */
-public class RtsProfileHandler {
+public class RtsProfileHandler extends ProfileHandlerBase {
 	
 	private boolean online;
 	private RtsProfileExt originalProfile;
@@ -704,6 +704,10 @@
 			ComponentExt target, Component original) {
 		// プロパティ設定
 		for (String key : eComp.getPropertyKeys()) {
+			//デプロイ情報は除外
+			if(key.equals(KEY_DEPLOY_TYPE) || key.equals(KEY_DEPLOY_TARGET)
+					|| key.equals(KEY_DEPLOY_IOR)) continue;
+			//
 			setProperty(key, eComp.getProperty(key), target.getProperties());
 		}
 		populateIOR(target.getProperties(), eComp);



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