<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2011, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="urn:jboss:domain:security-manager:1.0"
           xmlns="urn:jboss:domain:security-manager:1.0"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="1.0">

    <!-- The security manager subsystem root element -->
    <xs:element name="subsystem" type="securityManagerSubsystemType"/>

    <xs:complexType name="securityManagerSubsystemType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The security manager subsystem configuration.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="deployment-permissions" minOccurs="0" maxOccurs="1" type="deploymentPermissionsConfigType"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="deploymentPermissionsConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The deploymentPermissionConfigType specifies the elements and attributes that can be used to configure
                the minimum and maximum set of permissions for deployments.

                - minimum-set: this element allows for the configuration of the minimum set of permissions that are to
                be granted to all deployments.
                - maximum-set: this element allows for the configuration of the maximum set of permissions that a deployment
                can have. This set defines the maximum scope of permissions that can be granted to a deployment and acts
                as a validation mechanims that prevents deployments from acquiring undesirable permissions.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="minimum-set" minOccurs="0" maxOccurs="1" type="permissionSetType"/>
            <xs:element name="maximum-set" minOccurs="0" maxOccurs="1" type="permissionSetType"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="permissionSetType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The permissionSetConfigType defines a sequence of permission elements that can be used to specify the
                permissions that are to be granted to deployments or external jars.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="permission" minOccurs="0" maxOccurs="unbounded" type="permissionType"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="permissionType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The permission specifies the attributes used to declare a security permission.

                * class: the permission fully-qualified class name (e.g. java.util.PropertyPermission).
                * name: the name  of permission target (e.g. java.* for a PropertyPermission).
                * actions: the permission actions (e.g. read, write)
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="class" type="xs:string" use="required"/>
        <xs:attribute name="name" type="xs:string" use="optional"/>
        <xs:attribute name="actions" type="xs:string" use="optional"/>
        <xs:attribute name="module" type="xs:string" use="optional"/>
    </xs:complexType>

</xs:schema>
