예제 #1
0
 def save_xml(self, doc, element):
     '''Save this service port into an xml.dom.Element object.'''
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'connectorId',
                            self.connector_id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
     if self.trans_method:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'transMethod',
                                self.trans_method)
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     new_element = doc.createElementNS(RTS_NS,
                                       RTS_NS_S + 'sourceServicePort')
     self.source_service_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     new_element = doc.createElementNS(RTS_NS,
                                       RTS_NS_S + 'targetServicePort')
     self.target_service_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #2
0
 def save_xml(self, doc, element):
     '''Save this data port into an xml.dom.Element object.'''
     element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:dataport_connector_ext')
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'connectorId',
                            self.connector_id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataType', self.data_type)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'interfaceType',
                            self.interface_type)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataflowType',
                            self.data_flow_type)
     if self.subscription_type:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'subscriptionType',
                                self.subscription_type)
     if self.push_interval != 0.0:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'pushInterval',
                                str(self.push_interval))
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     if self.visible != True:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                                str(self.visible).lower())
     new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'sourceDataPort')
     self.source_data_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'targetDataPort')
     self.target_data_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #3
0
 def save_xml(self, doc, element):
     '''Save this data port into an xml.dom.Element object.'''
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'connectorId',
                            self.connector_id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataType', self.data_type)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'interfaceType',
                            self.interface_type)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'dataflowType',
                            self.data_flow_type)
     if self.subscription_type:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'subscriptionType',
                                self.subscription_type)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'pushInterval',
                            str(self.push_interval))
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'sourceDataPort')
     self.source_data_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'targetDataPort')
     self.target_data_port.save_xml(doc, new_element)
     element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #4
0
 def save_xml(self, doc, element):
     '''Save this target component into an xml.dom.Element object.'''
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'componentId',
                            self.component_id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
                            self.instance_name)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #5
0
 def save_xml(self, doc, element):
     '''Save this component into an xml.dom.Element object.'''
     element.setAttributeNS(XSI_NS, XSI_NS_S + 'type',
                            'rtsExt:component_ext')
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'pathUri', self.path_uri)
     if self.active_configuration_set:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'activeConfigurationSet',
                                self.active_configuration_set)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
                            self.instance_name)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'compositeType',
                            comp_type.to_string(self.composite_type))
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'isRequired',
                            str(self.is_required).lower())
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     for port in self.data_ports:
         new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'DataPorts')
         port.save_xml(doc, new_element)
         element.appendChild(new_element)
     for port in self.service_ports:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ServicePorts')
         port.save_xml(doc, new_element)
         element.appendChild(new_element)
     for cs in self.configuration_sets:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ConfigurationSets')
         cs.save_xml(doc, new_element)
         element.appendChild(new_element)
     for ec in self.execution_contexts:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ExecutionContexts')
         ec.save_xml(doc, new_element)
         element.appendChild(new_element)
     for p in self.participants:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'Participants')
         p.save_xml(doc, new_element)
         element.appendChild(new_element)
     new_element = doc.createElementNS(RTS_EXT_NS,
                                       RTS_EXT_NS_S + 'Location')
     self._location.save_xml(doc, new_element)
     element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #6
0
 def save_xml(self, doc, element):
     '''Save this component into an xml.dom.Element object.'''
     element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:component_ext')
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'pathUri', self.path_uri)
     if self.active_configuration_set:
         element.setAttributeNS(RTS_NS, RTS_NS_S + 'activeConfigurationSet',
                                self.active_configuration_set)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
                            self.instance_name)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'compositeType',
                            comp_type.to_string(self.composite_type))
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'isRequired',
                            str(self.is_required).lower())
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     for port in self.data_ports:
         new_element = doc.createElementNS(RTS_NS, RTS_NS_S + 'DataPorts')
         port.save_xml(doc, new_element)
         element.appendChild(new_element)
     for port in self.service_ports:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ServicePorts')
         port.save_xml(doc, new_element)
         element.appendChild(new_element)
     for cs in self.configuration_sets:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ConfigurationSets')
         cs.save_xml(doc, new_element)
         element.appendChild(new_element)
     for ec in self.execution_contexts:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'ExecutionContexts')
         ec.save_xml(doc, new_element)
         element.appendChild(new_element)
     for p in self.participants:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'Participants')
         p.save_xml(doc, new_element)
         element.appendChild(new_element)
     new_element = doc.createElementNS(RTS_EXT_NS,
                                       RTS_EXT_NS_S + 'Location')
     self._location.save_xml(doc, new_element)
     element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #7
0
 def save_xml(self, doc, element):
     '''Save this service port into an xml.dom.Element object.'''
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #8
0
파일: ports.py 프로젝트: yosuke/rtsprofile
 def save_xml(self, doc, element):
     '''Save this data port into an xml.dom.Element object.'''
     element.setAttributeNS(XSI_NS, XSI_NS_S + 'type',
                            'rtsExt:dataport_ext')
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
     if self.comment:
         element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                self.comment)
     element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                            str(self.visible).lower())
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #9
0
 def save_xml(self, doc, element):
     '''Save this execution context into an xml.dom.Element object.'''
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'kind', self.kind)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'rate', str(self.rate))
     for p in self.participants:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'Participants')
         p.save_xml(doc, new_element)
         element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #10
0
 def save_xml(self, doc, element):
     '''Save this execution context into an xml.dom.Element object.'''
     element.setAttributeNS(XSI_NS, XSI_NS_S + 'type',
                            'rtsExt:execution_context_ext')
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'kind', self.kind)
     element.setAttributeNS(RTS_NS, RTS_NS_S + 'rate', str(self.rate))
     for p in self.participants:
         new_element = doc.createElementNS(RTS_NS,
                                           RTS_NS_S + 'Participants')
         p.save_xml(doc, new_element)
         element.appendChild(new_element)
     for p in self.properties:
         new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                RTS_EXT_NS_S + 'Properties')
         properties_to_xml(new_prop_element, p, self.properties[p])
         element.appendChild(new_prop_element)
예제 #11
0
    def _to_xml_dom(self):
        impl = xml.dom.minidom.getDOMImplementation()
        doc = impl.createDocument(RTS_NS, RTS_NS_S + 'RtsProfile', None)
        doc.documentElement.setAttribute('xmlns:rts', RTS_NS)
        doc.documentElement.setAttribute('xmlns:rtsExt', RTS_EXT_NS)
        doc.documentElement.setAttribute('xmlns:xsi', XSI_NS)

        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'abstract',
                                           self.abstract)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'creationDate',
                                           self.creation_date)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'updateDate',
                                           self.update_date)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'version',
                                           str(self.version))
        if self.comment:
            doc.documentElement.setAttributeNS(RTS_EXT_NS,
                                               RTS_EXT_NS_S + 'comment',
                                               self.comment)
        for c in self.components:
            new_comp_element = doc.createElementNS(RTS_NS,
                                                   RTS_NS_S + 'Components')
            c.save_xml(doc, new_comp_element)
            doc.documentElement.appendChild(new_comp_element)
        for g in self.groups:
            new_group_element = doc.createElementNS(RTS_NS,
                                                    RTS_NS_S + 'Groups')
            g.save_xml(doc, new_group_element)
            doc.documentElement.appendChild(new_group_element)
        for dc in self.data_port_connectors:
            new_conn_element = doc.createElementNS(
                RTS_NS, RTS_NS_S + 'DataPortConnectors')
            dc.save_xml(doc, new_conn_element)
            doc.documentElement.appendChild(new_conn_element)
        for sc in self.service_port_connectors:
            new_conn_element = doc.createElementNS(
                RTS_NS, RTS_NS_S + 'ServicePortConnectors')
            sc.save_xml(doc, new_conn_element)
            doc.documentElement.appendChild(new_conn_element)
        if self.startup:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'StartUp')
            self.startup.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.shutdown:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'ShutDown')
            self.shutdown.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.activation:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Activation')
            self.activation.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.deactivation:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Deactivation')
            self.deactivation.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.resetting:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Resetting')
            self.resetting.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.initializing:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Initializing')
            self.initializing.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.finalizing:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Finalizing')
            self.finalizing.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        for vl in self.version_up_log:
            new_vl_element = doc.createElementNS(RTS_EXT_NS,
                                                 RTS_EXT_NS_S + 'VersionUpLog')
            new_text_node = doc.createTextNode(vl)
            new_vl_element.appendChild(new_text_node)
            doc.documentElement.appendChild(new_vl_element)
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            doc.documentElement.appendChild(new_prop_element)
        return doc
예제 #12
0
    def _to_xml_dom(self):
        impl = xml.dom.minidom.getDOMImplementation()
        doc = impl.createDocument(RTS_NS, RTS_NS_S + 'RtsProfile', None)
        doc.documentElement.setAttribute('xmlns:rts', RTS_NS)
        doc.documentElement.setAttribute('xmlns:rtsExt', RTS_EXT_NS)
        doc.documentElement.setAttribute('xmlns:xsi', XSI_NS)

        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'id', self.id)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'abstract',
                                           self.abstract)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'creationDate',
                                           self.creation_date)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'updateDate',
                                           self.update_date)
        doc.documentElement.setAttributeNS(RTS_NS, RTS_NS_S + 'version',
                                           str(self.version))
        if self.comment:
            doc.documentElement.setAttributeNS(RTS_EXT_NS,
                                               RTS_EXT_NS_S + 'comment',
                                               self.comment)
        for c in self.components:
            new_comp_element = doc.createElementNS(RTS_NS,
                                                   RTS_NS_S + 'Components')
            c.save_xml(doc, new_comp_element)
            doc.documentElement.appendChild(new_comp_element)
        for g in self.groups:
            new_group_element = doc.createElementNS(RTS_NS,
                                                    RTS_NS_S + 'Groups')
            g.save_xml(doc, new_group_element)
            doc.documentElement.appendChild(new_group_element)
        for dc in self.data_port_connectors:
            new_conn_element = doc.createElementNS(RTS_NS,
                    RTS_NS_S + 'DataPortConnectors')
            dc.save_xml(doc, new_conn_element)
            doc.documentElement.appendChild(new_conn_element)
        for sc in self.service_port_connectors:
            new_conn_element = doc.createElementNS(RTS_NS,
                    RTS_NS_S + 'ServicePortConnectors')
            sc.save_xml(doc, new_conn_element)
            doc.documentElement.appendChild(new_conn_element)
        if self.startup:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'StartUp')
            self.startup.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.shutdown:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'ShutDown')
            self.shutdown.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.activation:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Activation')
            self.activation.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.deactivation:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Deactivation')
            self.deactivation.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.resetting:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Resetting')
            self.resetting.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.initializing:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Initializing')
            self.initializing.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        if self.finalizing:
            new_cond = doc.createElementNS(RTS_NS, RTS_NS_S + 'Finalizing')
            self.finalizing.save_xml(doc, new_cond)
            doc.documentElement.appendChild(new_cond)
        for vl in self.version_up_log:
            new_vl_element = doc.createElementNS(RTS_EXT_NS,
                                                 RTS_EXT_NS_S + 'VersionUpLog')
            new_text_node = doc.createTextNode(vl)
            new_vl_element.appendChild(new_text_node)
            doc.documentElement.appendChild(new_vl_element)
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            doc.documentElement.appendChild(new_prop_element)
        return doc