<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
            xmlns:Deployment="http://www.omg.org/Deployment"
            xmlns:xmi="http://www.omg.org/XMI"
            targetNamespace="http://www.omg.org/Deployment">

  <xsd:import namespace="http://www.omg.org/XMI"
              schemaLocation="XMI.xsd" />

  <xsd:complexType name="IdRef">
    <xsd:attributeGroup ref="xmi:LinkAttribs" />
  </xsd:complexType>

  <xsd:simpleType name="TCKind">
    <xsd:restriction base="xsd:NCName"> <!-- std says xsd:string -->
      <xsd:enumeration value="tk_null"/>
      <xsd:enumeration value="tk_void"/>
      <xsd:enumeration value="tk_short"/>
      <xsd:enumeration value="tk_long"/>
      <xsd:enumeration value="tk_ushort"/>
      <xsd:enumeration value="tk_ulong"/>
      <xsd:enumeration value="tk_float"/>
      <xsd:enumeration value="tk_double"/>
      <xsd:enumeration value="tk_boolean"/>
      <xsd:enumeration value="tk_char"/>
      <xsd:enumeration value="tk_octet"/>
      <xsd:enumeration value="tk_any"/>
      <xsd:enumeration value="tk_TypeCode"/>
      <xsd:enumeration value="tk_Principal"/>
      <xsd:enumeration value="tk_objref"/>
      <xsd:enumeration value="tk_struct"/>
      <xsd:enumeration value="tk_union"/>
      <xsd:enumeration value="tk_enum"/>
      <xsd:enumeration value="tk_string"/>
      <xsd:enumeration value="tk_sequence"/>
      <xsd:enumeration value="tk_array"/>
      <xsd:enumeration value="tk_alias"/>
      <xsd:enumeration value="tk_except"/>
      <xsd:enumeration value="tk_longlong"/>
      <xsd:enumeration value="tk_ulonglong"/>
      <xsd:enumeration value="tk_longdouble"/>
      <xsd:enumeration value="tk_wchar"/>
      <xsd:enumeration value="tk_wstring"/>
      <xsd:enumeration value="tk_fixed"/>
      <xsd:enumeration value="tk_value"/>
      <xsd:enumeration value="tk_value_box"/>
      <xsd:enumeration value="tk_native"/>
      <xsd:enumeration value="tk_abstract_interface"/>
      <xsd:enumeration value="tk_local_interface"/>
      <xsd:enumeration value="tk_component"/>
      <xsd:enumeration value="tk_home"/>
      <xsd:enumeration value="tk_event"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="DataType">
    <xsd:sequence>
      <xsd:element name="kind" type="Deployment:TCKind"/>
      <xsd:choice minOccurs="0">
        <xsd:element name="enum" type="Deployment:EnumType" />
        <xsd:element name="struct" type="Deployment:StructType"/>
        <xsd:element name="value" type="Deployment:ValueType"/>
        <xsd:element name="sequence" type="Deployment:SequenceType"/>
        <xsd:element name="alias" type="Deployment:AliasType"/>
      </xsd:choice>

<!--
@@ not supported now..

      <xsd:element name="objref" type="Deployment:ObjrefType"/>
      <xsd:element name="boundedString" type="Deployment:BoundedStringType"/>
      <xsd:element name="fixed" type="Deployment:FixedType"/>
      <xsd:element name="array" type="Deployment:ArrayType"/>

      <xsd:element name="union" type="Deployment:UnionType"/>
-->
    </xsd:sequence>
    <xsd:attribute ref="xmi:id" />
  </xsd:complexType>

  <xsd:complexType name="DataValue">
    <xsd:choice maxOccurs="unbounded">
      <xsd:element name="short" type="xsd:short"/>
      <xsd:element name="long" type="xsd:int"/>
      <xsd:element name="ushort" type="xsd:unsignedShort"/>
      <xsd:element name="ulong" type="xsd:unsignedInt"/>
      <xsd:element name="float" type="xsd:float"/>
      <xsd:element name="double" type="xsd:double"/>
      <xsd:element name="boolean" type="xsd:boolean"/>
      <xsd:element name="octet" type="xsd:unsignedByte"/>
      <!-- xsd:element name="opaque" type="xsd:base64Binary"/ -->
      <!-- <xsd:element name="objref" type="xsd:string"/> -->
      <xsd:element name="enum" type="xsd:string"/>
      <xsd:element name="string" type="xsd:string"/>
      <xsd:element name="longlong" type="xsd:long"/>
      <xsd:element name="ulonglong" type="xsd:unsignedLong"/>
      <xsd:element name="longdouble" type="xsd:double"/>
      <!-- <xsd:element name="fixed" type="xsd:string"/> -->
      <!-- <xsd:element name="any" type="Deployment:Any"/> -->
      <!-- <xsd:element name="typecode" type="Deployment:DataType"/> -->
      <xsd:element name="element" type="Deployment:DataValue"/>
      <!-- <xsd:element name="discriminator" type="Deployment:DataValue"/> -->
      <!-- <xsd:element name="value" type="Deployment:DataValue"/> -->
      <!-- <xsd:element name="boxedValue" type="Deployment:DataValue"/> -->
      <xsd:element name="member" type="Deployment:NamedValue"/>
    </xsd:choice>
  </xsd:complexType>

  <xsd:complexType name="AliasType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="typeId" type="xsd:string"/>
      <xsd:element name="elementType" type="Deployment:DataType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="EnumType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="typeId" type="xsd:string"/>
      <xsd:element name="member" type="xsd:string" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="StructType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="typeId" type="xsd:string"/>
      <xsd:element name="member" type="Deployment:StructMemberType" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="StructMemberType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="type" type="Deployment:DataType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ValueType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="typeId" type="xsd:string"/>
      <xsd:element name="modifier" type="xsd:string"/>
      <xsd:element name="baseType" type="Deployment:DataType"/>
      <xsd:element name="member" type="Deployment:ValueMemberType" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ValueMemberType">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="visibility" type="xsd:string"/>
      <xsd:element name="type" type="Deployment:DataType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="NamedValue">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="value" type="Deployment:DataValue"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="SequenceType">
    <xsd:sequence>
      <xsd:element name="bound" type="xsd:unsignedInt" minOccurs="0" />
      <xsd:element name="elementType" type="Deployment:DataType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Any">
    <xsd:sequence>
      <xsd:element name="type" type="Deployment:DataType"/>
      <xsd:element name="value" type="Deployment:DataValue"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Property">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="value" type="Deployment:Any"/>
    </xsd:sequence>
  </xsd:complexType>

<!-- End of base definitions. -->

  <xsd:simpleType name="SatisfierPropertyKind">
    <xsd:restriction base="xsd:NCName">
      <xsd:enumeration value="Quantity"/>
      <xsd:enumeration value="Capacity"/>
      <xsd:enumeration value="Minimum"/>
      <xsd:enumeration value="Maximum"/>
      <xsd:enumeration value="Attribute"/>
      <xsd:enumeration value="Selection"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="SatisfierProperty">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="kind" type="Deployment:SatisfierPropertyKind"/>
      <xsd:element name="dynamic" type="xsd:boolean" />
      <xsd:element name="value" type="Deployment:Any"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Resource">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="resourceType" type="xsd:string" maxOccurs="unbounded" />
      <xsd:element name="property" type="Deployment:SatisfierProperty" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Requirement">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="resourceType" type="xsd:string"/>
      <xsd:element name="property" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

<!-- Deployment -->

  <xsd:complexType name="ResourceDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="requirementName" type="xsd:string"/>
      <xsd:element name="resourceName" type="xsd:string"/>
      <xsd:element name="property" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ArtifactDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="source" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="node" type="xsd:string" />
      <xsd:element name="location" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployedResource" type="Deployment:ResourceDeploymentDescription" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute ref="xmi:id" />
  </xsd:complexType>

  <xsd:complexType name="MonolithicDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="source" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="artifact" type="Deployment:IdRef" minOccurs="0" maxOccurs="unbounded"/> <!-- ArtifactDeploymentDescription -->
      <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute ref="xmi:id" />
  </xsd:complexType>

  <xsd:simpleType name="ResourceUsageKind">
    <xsd:restriction base="xsd:NCName">
      <xsd:enumeration value="None"/>
      <xsd:enumeration value="InstanceUsesResource"/>
      <xsd:enumeration value="ResourceUsesInstance"/>
      <xsd:enumeration value="PortUsesResource"/>
      <xsd:enumeration value="ResourceUsesPort"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="InstanceResourceDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="resourceUsage" type="Deployment:ResourceUsageKind"/>
      <xsd:element name="requirementName" type="xsd:string"/>
      <xsd:element name="resourceName" type="xsd:string"/>
      <xsd:element name="property" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="InstanceDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="node" type="xsd:string"/>
      <xsd:element name="source" type="xsd:string"/>
      <xsd:element name="implementation" type="Deployment:IdRef"/> <!-- MonolithicDeploymentDescription -->
      <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployedResource" type="Deployment:InstanceResourceDeploymentDescription" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployedSharedResource" type="Deployment:InstanceResourceDeploymentDescription" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute ref="xmi:id" />
  </xsd:complexType>

  <xsd:simpleType name="CCMComponentPortKind">
    <xsd:restriction base="xsd:NCName">
      <xsd:enumeration value="Facet"/>
      <xsd:enumeration value="SimplexReceptacle"/>
      <xsd:enumeration value="MultiplexReceptacle"/>
      <xsd:enumeration value="EventEmitter"/>
      <xsd:enumeration value="EventPublisher"/>
      <xsd:enumeration value="EventConsumer"/>
      <xsd:enumeration value="ExtendedPort"/>
      <xsd:enumeration value="MirrorPort"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="ComponentPortDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <!-- @@MAJO:  Hack - specific/supported types should be required. -->
      <xsd:element name="specificType" type="xsd:string" minOccurs="0"/>
      <xsd:element name="supportedType" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="provider" type="xsd:boolean"/>
      <xsd:element name="exclusiveProvider" type="xsd:boolean"/>
      <xsd:element name="exclusiveUser" type="xsd:boolean"/>
      <xsd:element name="optional" type="xsd:boolean"/>
      <xsd:element name="kind" type="Deployment:CCMComponentPortKind"/>
      <xsd:element name="templateParam" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ComponentPropertyDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="type" type="Deployment:DataType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ComponentExternalPortEndpoint">
    <xsd:sequence>
      <xsd:element name="portName" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="PlanSubcomponentPortEndpoint">
    <xsd:sequence>
      <xsd:element name="portName" type="xsd:string"/>
      <xsd:element name="provider" type="xsd:string" minOccurs="0"/>
      <xsd:element name="kind" type="Deployment:CCMComponentPortKind"/>
      <xsd:element name="instance" type="Deployment:IdRef"/> <!-- InstanceDeploymentDescription -->
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ExternalReferenceEndpoint">
    <xsd:sequence>
      <xsd:element name="location" type="xsd:string"/>
      <xsd:element name="provider" type="xsd:boolean"/>
      <xsd:element name="portName" type="xsd:string" minOccurs="0" />
      <xsd:element name="supportedType" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ConnectionResourceDeploymentDescription">
    <xsd:sequence>
      <xsd:element name="targetName" type="xsd:string"/>
      <xsd:element name="requirementName" type="xsd:string"/>
      <xsd:element name="resourceName" type="xsd:string"/>
      <xsd:element name="property" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="PlanConnectionDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="source" type="xsd:string" minOccurs="0"/>
      <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="externalEndpoint" type="Deployment:ComponentExternalPortEndpoint" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="internalEndpoint" type="Deployment:PlanSubcomponentPortEndpoint" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="externalReference" type="Deployment:ExternalReferenceEndpoint" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="deployedResource" type="Deployment:ConnectionResourceDeploymentDescription" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ImplementationDependency">
    <xsd:sequence>
      <xsd:element name="requiredType" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

<!-- Implementation -->

  <xsd:complexType name="Capability">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="resourceType" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="property" type="Deployment:SatisfierProperty" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ImplementationRequirement">
    <xsd:sequence>
      <xsd:element name="resourceUsage" type="Deployment:ResourceUsageKind" minOccurs="0"/>
      <xsd:element name="resourcePort" type="xsd:string" minOccurs="0" />
      <xsd:element name="componentPort" type="xsd:string" minOccurs="0"/>
      <xsd:element name="resourceType" type="xsd:string"/>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="property" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="SubcomponentPortEndpoint">
    <xsd:sequence>
      <xsd:element name="portName" type="xsd:string"/>
      <xsd:element name="instance" type="Deployment:IdRef"/> <!-- SubcomponentInstantiationDescription -->
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="AssemblyConnectionDescription">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="internalEndpoint" type="Deployment:SubcomponentPortEndpoint" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="externalEndpoint" type="Deployment:ComponentExternalPortEndpoint" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="externalReference" type="Deployment:ExternalReferenceEndpoint" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:simpleType name="PlanLocalityKind">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="SameProcess"/>
      <xsd:enumeration value="DifferentProcess"/>
      <xsd:enumeration value="NoConstraint"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="PlanLocality">
    <xsd:sequence>
      <xsd:element name="constraint" type="Deployment:PlanLocalityKind"/>
      <xsd:element name="constrainedInstance" type="Deployment:IdRef" maxOccurs="unbounded" /> <!-- InstanceDeploymentDescription -->
    </xsd:sequence>
  </xsd:complexType>

</xsd:schema>
