<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:py="http://genshi.edgewall.org/" xml:lang="en">

  <xsd:annotation>
    <xsd:documentation>
      bundle schema for bcfg2
      Narayan Desai, Argonne National Laboratory
    </xsd:documentation>
  </xsd:annotation>

  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>
  <xsd:import namespace="http://genshi.edgewall.org/"
              schemaLocation="genshi.xsd"/>

  <xsd:include schemaLocation="atom.xsd"/>
  <xsd:include schemaLocation="pathentry.xsd"/>
  <xsd:include schemaLocation="rules.xsd"/>
  <xsd:include schemaLocation="types.xsd"/>
  <xsd:include schemaLocation="servicetype.xsd"/>

  <xsd:group name="bundleElements">
    <xsd:choice>
      <xsd:group ref="py:genshiElements"/>
      <xsd:element name='Package' type='PackageStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract implementation of a Package entry.  The full
            specification will be generated by a plugin such as
            Packages.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Path' type='PathEntry'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract implementation of a Path entry.  The entry will
            either be handled by Cfg, TGenshi, or another
            Generator plugin; or handled by Rules, in which case
            the full specification of this entry will be included in
            Rules.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Service' type='StructureEntry'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract implementation of a Service entry.  The full
            specification will be included in Rules.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Action' type='StructureEntry'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract implementation of an Action entry.  The full
            specification will be included in Rules.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='POSIXUser' type='StructureEntry'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract description of a POSIXUser entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='POSIXGroup' type='StructureEntry'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract description of a POSIXGroup entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='PostInstall' type='StructureEntry'>
        <xsd:annotation>
          <xsd:documentation>
            PostInstall entries are deprecated in favor of Action
            entries. Actions can do everything PostInstall entries can
            do and more.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEBoolean' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux boolean entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEPort' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux port entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEFcontext' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux file context ("fcontext") entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SENode' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux node entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SELogin' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux login entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEUser' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux user entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEInterface' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux interface entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEPermissive' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux permissive domain entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='SEModule' type='SELinuxStructure'>
        <xsd:annotation>
          <xsd:documentation>
            Abstract SELinux module entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundPackage' type='PackageType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a software package to be managed.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundPath' type='PathType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a filesystem path to be handled
            by the POSIX driver.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundService' type='ServiceType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a system service to be managed.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundAction' type='ActionType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a command to be run.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEBoolean' type='SEBooleanType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux boolean entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEPort' type='SEPortType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux port entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEFcontext' type='SEFcontextType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux file context entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSENode' type='SENodeType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux node entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSELogin' type='SELoginType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux login entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEUser' type='SEUserType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux user entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEInterface' type='SEInterfaceType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux interface entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEPermissive' type='SEPermissiveType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux permissive domain entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundSEModule' type='SEModuleType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of an SELinux module entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundPOSIXUser' type='POSIXUserType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a POSIXUser entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='BoundPOSIXGroup' type='POSIXGroupType'>
        <xsd:annotation>
          <xsd:documentation>
            Fully bound description of a POSIXGroup entry.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Group' type='BundlerGroupType'>
        <xsd:annotation>
          <xsd:documentation>
            Elements within Group tags only apply to clients that are
            members of that group (or vice-versa; see #element_negate
            below)
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Client' type='BundlerGroupType'>
        <xsd:annotation>
          <xsd:documentation>
            Elements within Client tags only apply to the named client
            (or vice-versa; see #element_negate below)
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name='Bundle' type='BundleType'>
        <xsd:annotation>
          <xsd:documentation>
            Nesting Bundle tags is allowed in order to support
            XInclude within Bundles.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name='BundlerGroupType'>
    <xsd:annotation>
      <xsd:documentation>
        A **BundlerGroupType** is a tag used to provide logic.  Child
        entries of a BundlerGroupType tag only apply to machines that
        match the condition specified -- either membership in a group,
        or a matching client name.
        :xml:attribute:`BundlerGroupType:negate` can be set to negate
        the sense of the match.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice minOccurs='0' maxOccurs='unbounded'>
      <xsd:group ref="bundleElements"/>
    </xsd:choice>
    <xsd:attribute type='xsd:string' name='name' use='required'>
      <xsd:annotation>
        <xsd:documentation>
          The group name
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute type='xsd:string' name='negate'>
      <xsd:annotation>
        <xsd:documentation>
          Negate the sense of this group or client; i.e., entries
          within this tag are only used on clients that are not
          members of the group, or that have hostnames that do not
          match.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attributeGroup ref="py:genshiAttrs"/>
  </xsd:complexType>

  <xsd:complexType name='BundleType'>
    <xsd:choice minOccurs='0' maxOccurs='unbounded'>
      <xsd:group ref="bundleElements"/>
    </xsd:choice>
    <xsd:attribute type='xsd:string' name='description'>
      <xsd:annotation>
        <xsd:documentation>
          Freeform description of the bundle.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute type='xsd:string' name='name' use='required'>
      <xsd:annotation>
        <xsd:documentation>
          The name of the bundle.  This must match the bundle
          filename, minus the extension.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute type='xsd:string' name='version'>
      <xsd:annotation>
        <xsd:documentation>
          Bundle schema version.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute type='xsd:anyURI' name='origin'>
      <xsd:annotation>
        <xsd:documentation>
          URL of master version (for common repo)
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute type='xsd:string' name='revision'>
      <xsd:annotation>
        <xsd:documentation>
          Master version control revision.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attributeGroup ref="py:genshiAttrs"/>
    <xsd:attribute ref="xml:base"/>
  </xsd:complexType>

  <xsd:element name='Bundle' type='BundleType'>
    <xsd:annotation>
      <xsd:documentation>
        A bundle describes a group of inter-dependent configuration
        entries, such as the combination of packages, configuration
        files, and service activations that comprise typical Unix
        daemons. Bundles are used to add groups of configuration
        entries to the inventory of client configurations, as opposed
        to describing particular versions of those entries. For
        example, a bundle could say that the configuration file
        ``/etc/passwd`` should be included in a configuration, but
        will not describe the particular version of ``/etc/passwd``
        that a given client will receive.
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>
</xsd:schema>
