[openrtm-commit:00581] r238 - in trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles: META-INF schema src/jp/go/aist/rtm/toolscommon/profiles/util src/org/openrtp/namespaces src/org/openrtp/namespaces/deploy

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


Author: sakamoto
Date: 2012-01-14 00:31:45 +0900 (Sat, 14 Jan 2012)
New Revision: 238

Added:
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/schema/DeployProfile.xsd
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/Component.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/DeployProfile.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/ObjectFactory.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/package-info.java
Modified:
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/META-INF/MANIFEST.MF
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/NamespacePrefixMapperImpl.java
   trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/XmlHandler.java
Log:
The addition of Deploy function from OFFLINE Profile

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/META-INF/MANIFEST.MF
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/META-INF/MANIFEST.MF	2012-01-06 15:50:45 UTC (rev 237)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/META-INF/MANIFEST.MF	2012-01-13 15:31:45 UTC (rev 238)
@@ -52,6 +52,7 @@
  com.sun.xml.bind.v2.schemagen.xmlschema,
  com.sun.xml.bind.v2.util,
  jp.go.aist.rtm.toolscommon.profiles.util;uses:="junit.framework",
+ org.openrtp.namespaces.deploy,
  org.openrtp.namespaces.rtc.version01;uses:="javax.xml.bind,javax.xml.datatype",
  org.openrtp.namespaces.rtc.version02;uses:="javax.xml.bind,javax.xml.datatype",
  org.openrtp.namespaces.rts.version01;uses:="javax.xml.bind,javax.xml.datatype",

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/schema/DeployProfile.xsd
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/schema/DeployProfile.xsd	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/schema/DeployProfile.xsd	2012-01-13 15:31:45 UTC (rev 238)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:deploy="http://www.openrtp.org/namespaces/deploy"
+	targetNamespace="http://www.openrtp.org/namespaces/deploy"
+	elementFormDefault="qualified"
+	attributeFormDefault="qualified">
+
+	<xsd:element name="DeployProfile" type="deploy:deploy_profile"/>
+	<xsd:complexType name="deploy_profile">
+		<xsd:sequence>
+			<xsd:element name="Components" type="deploy:component" minOccurs="0" maxOccurs="unbounded"/>
+		</xsd:sequence>
+		<xsd:attribute name="id" type="xsd:string" use="required"/>
+		<xsd:attribute name="version" type="xsd:string" use="required"/>
+		<xsd:attribute name="creationDate" type="xsd:dateTime" use="required"/>
+		<xsd:attribute name="updateDate" type="xsd:dateTime" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="component">
+		<xsd:attribute name="id" type="xsd:string" use="required"/>
+		<xsd:attribute name="instanceName" type="xsd:string" use="required"/>
+		<xsd:attribute name="deployType">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="None"/>
+					<xsd:enumeration value="Component"/>
+					<xsd:enumeration value="Manager"/>
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="target" type="xsd:string" use="optional"/>
+		<xsd:attribute name="ior" type="xsd:string" use="optional"/>
+	</xsd:complexType>
+
+</xsd:schema>

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/NamespacePrefixMapperImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/NamespacePrefixMapperImpl.java	2012-01-06 15:50:45 UTC (rev 237)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/NamespacePrefixMapperImpl.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -31,6 +31,9 @@
         if (namespaceUri.equalsIgnoreCase("http://www.openrtp.org/namespaces/rtc_ext")){
             return "rtcExt";
         }
+        if (namespaceUri.equalsIgnoreCase("http://www.openrtp.org/namespaces/deploy")){
+            return "deploy";
+        }
         if (namespaceUri.equalsIgnoreCase("http://www.w3.org/2001/XMLSchema-instance") ){
 	      return "xsi";
 	    }

Modified: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/XmlHandler.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/XmlHandler.java	2012-01-06 15:50:45 UTC (rev 237)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/jp/go/aist/rtm/toolscommon/profiles/util/XmlHandler.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -30,6 +30,7 @@
 
 import jp.go.aist.rtm.toolscommon.profiles.nl.Messages;
 
+import org.openrtp.namespaces.deploy.DeployProfile;
 import org.openrtp.namespaces.rtc.version02.ActionStatusDoc;
 import org.openrtp.namespaces.rtc.version02.Actions;
 import org.openrtp.namespaces.rtc.version02.And;
@@ -249,6 +250,69 @@
 	    return result;
 	}
 	
+	public String convertToXmlDeploy(DeployProfile profile) throws Exception {
+	    String xmlString = "";
+		try {
+			JAXBContext jaxbContext = JAXBContext.newInstance("org.openrtp.namespaces.deploy");
+			Marshaller marshaller = jaxbContext.createMarshaller();
+		    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT , new Boolean(true));
+		    marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper",
+					new NamespacePrefixMapperImpl(
+							"http://www.openrtp.org/namespaces/deploy"));
+		    StringWriter xmlFileWriter = new StringWriter();
+		    marshaller.marshal(profile, xmlFileWriter);
+		    xmlString = xmlFileWriter.toString();
+		} catch (JAXBException exception) {
+			throw new Exception(Messages.getString("XmlHandler.17"), exception);
+		}
+		return xmlString;
+	}
+	
+	public DeployProfile restoreFromXmlDeploy(String targetXML) throws Exception {
+		DeployProfile result = null;
+		JAXBContext jc = JAXBContext.newInstance("org.openrtp.namespaces.deploy");
+		Unmarshaller unmarshaller = jc.createUnmarshaller();
+		unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
+	    StringReader xmlReader = new StringReader(targetXML);
+		Object profile = unmarshaller.unmarshal(xmlReader);
+		//
+		result = (DeployProfile) ((JAXBElement<?>) profile).getValue();
+		return result;
+	}
+
+	public DeployProfile loadXmlDeploy(String targetFile) throws Exception {
+		
+		StringBuffer stbRet = new StringBuffer();
+		InputStreamReader isr = new InputStreamReader(new FileInputStream(targetFile), "UTF-8");
+		BufferedReader br = new BufferedReader(isr);
+
+		String str = new String();
+		while( (str = br.readLine()) != null ){
+			stbRet.append(str + "\n");
+		}
+		br.close();
+		isr.close();
+		return restoreFromXmlDeploy(stbRet.toString());
+	}
+
+	public boolean saveXmlDeploy(DeployProfile profile, String targetFile) throws Exception {
+		String xmlString = convertToXmlDeploy(profile);
+
+		String lineSeparator = System.getProperty( "line.separator" );
+		if( lineSeparator==null || lineSeparator.equals("") ) lineSeparator = "\n";
+		String xmlSplit[] = xmlString.split(lineSeparator);
+
+		BufferedWriter outputFile = new BufferedWriter(
+					new OutputStreamWriter(new FileOutputStream(targetFile), "UTF-8"));
+		for(int intIdx=0;intIdx<xmlSplit.length;intIdx++) {
+			outputFile.write(xmlSplit[intIdx]);
+			outputFile.newLine();
+		}
+		outputFile.close();
+		
+		return true;
+	}
+	
 	private class RtsXMLParser extends DefaultHandler {
 		private String version = "";
 

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/Component.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/Component.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/Component.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -0,0 +1,174 @@
+
+package org.openrtp.namespaces.deploy;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for component complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * <complexType name="component">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="instanceName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="deployType">
+ *         <simpleType>
+ *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *             <enumeration value="None"/>
+ *             <enumeration value="Component"/>
+ *             <enumeration value="Manager"/>
+ *           </restriction>
+ *         </simpleType>
+ *       </attribute>
+ *       <attribute name="target" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="ior" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "component")
+public class Component {
+
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected String id;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected String instanceName;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy")
+    protected String deployType;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy")
+    protected String target;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy")
+    protected String ior;
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setId(String value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the instanceName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    /**
+     * Sets the value of the instanceName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setInstanceName(String value) {
+        this.instanceName = value;
+    }
+
+    /**
+     * Gets the value of the deployType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getDeployType() {
+        return deployType;
+    }
+
+    /**
+     * Sets the value of the deployType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setDeployType(String value) {
+        this.deployType = value;
+    }
+
+    /**
+     * Gets the value of the target property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTarget() {
+        return target;
+    }
+
+    /**
+     * Sets the value of the target property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTarget(String value) {
+        this.target = value;
+    }
+
+    /**
+     * Gets the value of the ior property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getIor() {
+        return ior;
+    }
+
+    /**
+     * Sets the value of the ior property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setIor(String value) {
+        this.ior = value;
+    }
+
+}

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/DeployProfile.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/DeployProfile.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/DeployProfile.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -0,0 +1,181 @@
+
+package org.openrtp.namespaces.deploy;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+
+/**
+ * <p>Java class for deploy_profile complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * <complexType name="deploy_profile">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Components" type="{http://www.openrtp.org/namespaces/deploy}component" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="creationDate" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ *       <attribute name="updateDate" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlRootElement(name="DeployProfile")
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "deploy_profile", propOrder = {
+    "components"
+})
+public class DeployProfile {
+
+    @XmlElement(name = "Components")
+    protected List<Component> components;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected String id;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected String version;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected XMLGregorianCalendar creationDate;
+    @XmlAttribute(namespace = "http://www.openrtp.org/namespaces/deploy", required = true)
+    protected XMLGregorianCalendar updateDate;
+
+    /**
+     * Gets the value of the components property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the components property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getComponents().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Component }
+     * 
+     * 
+     */
+    public List<Component> getComponents() {
+        if (components == null) {
+            components = new ArrayList<Component>();
+        }
+        return this.components;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setId(String value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the version property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the value of the version property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setVersion(String value) {
+        this.version = value;
+    }
+
+    /**
+     * Gets the value of the creationDate property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link XMLGregorianCalendar }
+     *     
+     */
+    public XMLGregorianCalendar getCreationDate() {
+        return creationDate;
+    }
+
+    /**
+     * Sets the value of the creationDate property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link XMLGregorianCalendar }
+     *     
+     */
+    public void setCreationDate(XMLGregorianCalendar value) {
+        this.creationDate = value;
+    }
+
+    /**
+     * Gets the value of the updateDate property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link XMLGregorianCalendar }
+     *     
+     */
+    public XMLGregorianCalendar getUpdateDate() {
+        return updateDate;
+    }
+
+    /**
+     * Sets the value of the updateDate property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link XMLGregorianCalendar }
+     *     
+     */
+    public void setUpdateDate(XMLGregorianCalendar value) {
+        this.updateDate = value;
+    }
+
+}

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/ObjectFactory.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/ObjectFactory.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/ObjectFactory.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -0,0 +1,61 @@
+
+package org.openrtp.namespaces.deploy;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the org.openrtp.namespaces.deploy package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+ at XmlRegistry
+public class ObjectFactory {
+
+    private final static QName _DeployProfile_QNAME = new QName("http://www.openrtp.org/namespaces/deploy", "DeployProfile");
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openrtp.namespaces.deploy
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link Component }
+     * 
+     */
+    public Component createComponent() {
+        return new Component();
+    }
+
+    /**
+     * Create an instance of {@link DeployProfile }
+     * 
+     */
+    public DeployProfile createDeployProfile() {
+        return new DeployProfile();
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link DeployProfile }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://www.openrtp.org/namespaces/deploy", name = "DeployProfile")
+    public JAXBElement<DeployProfile> createDeployProfile(DeployProfile value) {
+        return new JAXBElement<DeployProfile>(_DeployProfile_QNAME, DeployProfile.class, null, value);
+    }
+
+}

Added: trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/package-info.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/package-info.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.toolscommon.profiles/src/org/openrtp/namespaces/deploy/package-info.java	2012-01-13 15:31:45 UTC (rev 238)
@@ -0,0 +1,2 @@
+ at javax.xml.bind.annotation.XmlSchema(namespace = "http://www.openrtp.org/namespaces/deploy", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.openrtp.namespaces.deploy;



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