<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.mulesource.org/schema/mule/management/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:mule="http://www.mulesource.org/schema/mule/core/2.0"
            xmlns:spring="http://www.springframework.org/schema/beans"
            targetNamespace="http://www.mulesource.org/schema/mule/management/2.0" elementFormDefault="qualified"
            attributeFormDefault="unqualified">

    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:import namespace="http://www.mulesource.org/schema/mule/core/2.0"
                schemaLocation="http://www.mulesource.org/schema/mule/core/2.0/mule.xsd" />
    <xsd:import namespace="http://www.springframework.org/schema/beans"
                schemaLocation="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"/>

    <!-- JMX Agent-->
    <xsd:element name="jmx-server" type="jmxServerType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="jmxServerType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:sequence>
                    <xsd:element name="connector-server" type="connectorServerType" minOccurs="0" />
                    <xsd:element name="credentials" type="mule:mapType" minOccurs="0" />
                </xsd:sequence>
                <xsd:attribute name="server-ref" type="xsd:NMTOKEN"/>
                <xsd:attribute name="locateServer" type="mule:substitutableBoolean" default="true" />
                <xsd:attribute name="createServer" type="mule:substitutableBoolean" default="true" />
                <xsd:attribute name="enableStatistics" type="mule:substitutableBoolean" default="true" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="connectorServerType">
        <xsd:attribute name="url" type="xsd:string" use="required" />
        <xsd:attribute name="rebind" type="mule:substitutableBoolean" use="optional" default="true" />
    </xsd:complexType>

    <!-- JMX Adaptors -->
    <xsd:element name="jmx-mx4j-adaptor" type="jmxMx4jAdaptorType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="jmxMx4jAdaptorType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:sequence>
                    <xsd:element name="socketFactoryProperties" type="mule:mapType" minOccurs="0" />
                </xsd:sequence>
                <xsd:attribute name="jmxAdaptorUrl" type="xsd:string" />
                <xsd:attribute name="login" type="xsd:string" />
                <xsd:attribute name="password" type="xsd:string" />
                <xsd:attribute name="authenticationMethod" default="basic">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:NMTOKEN">
                            <xsd:enumeration value="none" />
                            <xsd:enumeration value="basic" />
                            <xsd:enumeration value="digest" />
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:attribute>
                <xsd:attribute name="cacheXsl" type="xsd:string" default="true" />
                <xsd:attribute name="xslFilePath" type="xsd:string" />
                <xsd:attribute name="pathInJar" type="xsd:string" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>


    <!--  JMX Agents -->

    <!-- Rmi Registry Agent -->
    <xsd:element name="rmi-server" type="rmiServerTyper" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="rmiServerTyper">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:attribute name="serverUri" type="xsd:string" />
                <xsd:attribute name="createRegistry" type="mule:substitutableBoolean" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="jmx-log4j" type="jmxLog4jType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="jmxLog4jType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType" />
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="jmx-default-config" type="jmxDefaultConfigType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="jmxDefaultConfigType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:sequence>
                    <xsd:element name="credentials" type="mule:mapType" minOccurs="0" />
                </xsd:sequence>
                <xsd:attribute name="registerMx4jAdapter" type="mule:substitutableBoolean" />
                <xsd:attribute name="host" type="xsd:string" />
                <xsd:attribute name="port" type="mule:substitutablePortNumber" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>


    <!-- JMX Notifications -->

    <xsd:complexType name="notificationLoggerAgentType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:attribute name="ignoreManagerNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreModelNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreComponentNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreConnectionNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreSecurityNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreManagementNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreCustomNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreAdminNotifications" type="mule:substitutableBoolean" default="false"/>
                <xsd:attribute name="ignoreMessageNotifications" type="mule:substitutableBoolean" default="false"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="jmx-notifications" type="jmxNotificationType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="jmxNotificationType">
        <xsd:complexContent>
            <xsd:extension base="notificationLoggerAgentType" />
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="log4j-notifications" type="log4jNotificationType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="log4jNotificationType">
        <xsd:complexContent>
            <xsd:extension base="notificationLoggerAgentType">
                <xsd:sequence>
                    <xsd:element name="level-mapping" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:attribute name="severity" type="serveritySimpleType" default="INFO" />
                            <xsd:attribute name="eventId" type="xsd:string" use="required" />
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="logName" type="xsd:string" />
                <xsd:attribute name="logConfigFile" type="xsd:string" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="chainsaw-notifications" type="chainsawNotificationType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="chainsawNotificationType">
        <xsd:complexContent>
            <xsd:extension base="notificationLoggerAgentType">
                <xsd:sequence>
                    <xsd:element name="level-mapping" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:attribute name="severity" type="serveritySimpleType" default="INFO" />
                            <xsd:attribute name="eventId" type="xsd:string" use="required" />
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="chainsawHost" type="xsd:string" use="required" />
                <xsd:attribute name="chainsawPort" type="mule:substitutablePortNumber" use="required" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:simpleType name="serveritySimpleType">
        <xsd:restriction base="xsd:NMTOKEN">
            <xsd:enumeration value="DEBUG" />
            <xsd:enumeration value="INFO" />
            <xsd:enumeration value="WARN" />
            <xsd:enumeration value="ERROR" />
            <xsd:enumeration value="FATAL" />
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="publish-notifications" type="publishNotificationType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="publishNotificationType">
        <xsd:complexContent>
            <xsd:extension base="notificationLoggerAgentType">
                <xsd:attribute name="endpointAddress" type="xsd:string" use="required" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="yourkit-profiler" substitutionGroup="mule:abstract-extension"/>

    <xsd:element name="custom-agent" type="customAgentType" substitutionGroup="mule:abstract-extension"/>
    <xsd:complexType name="customAgentType">
        <xsd:complexContent>
            <xsd:extension base="mule:abstractAgentType">
                <xsd:sequence>
                    <xsd:element ref="spring:property" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
                <xsd:attribute name="class" type="xsd:NMTOKEN" use="required"/>
                <xsd:attribute name="name" type="mule:substitutableName" use="required">
                    <xsd:annotation>
                        <xsd:documentation>
                            Identifies the agent in the registry.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

</xsd:schema>
