<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ $Revision$
  ~ $Date$
  ~
  ~ Copyright (C) 1999-2008 Jive Software. All rights reserved.
  ~
  ~ This software is the proprietary information of Jive Software. Use is subject to license terms.
  ~
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:include schemaLocation="http://www.jivesoftware.com/schemas/clearspace/2_0/ui-components.xsd"/>
    <xs:element name="plugin">
        <xs:annotation>
            <xs:documentation>The top level xml element.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:choice maxOccurs="unbounded">
                    <xs:element name="class" type="xs:string" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The name of the class that implements
                                com.jivesoftware.base.plugin.Plugin for this plugin.
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The name of this plugin as it should be displayed when
                                viewed in the admin tool. </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="description" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>A short description of the purpose of this
                            plugin</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="author" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The name of the invidual or company that created this
                                plugin. </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="authorURL" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>URL location relating to the author.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="pluginURL" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>URL of where the plugin lives.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The version of this plugin.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="requireRestart" type="xs:string" minOccurs="1" maxOccurs="1">
                    	<xs:annotation>
                    		<xs:documentation>If this plugin should require a restart upon install and uninstall.</xs:documentation>
                    	</xs:annotation>
                    </xs:element>
                    <xs:element name="minServerVersion" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The minimum version of the server that this plugin
                                requires. </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="maxServerVersion" type="xs:string" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The minimum version of the server that this plugin
                                requires. </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="databaseKey" type="xs:string" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>The jive database key. Used in the jiveVersion table
                                to store schema version information. Only required if the plugin has
                                a db schema. </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="databaseVersion" type="xs:integer" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>
                                The version of the database schema of this current
                                plugin version. Only required if the plugin has a db scema.
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element ref="components" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>
                                Used to define integration points into the Clearspace User Interface.
                                See the ui-components.xsd for information on each of the elements.
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element ref="filter" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                            <xs:documentation>
                                 Used to define a custom filter or macro. See the render or macro documentation for more details.
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element ref="css" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="javascript" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="widget" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="macro" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="urlmapping" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="sitemesh" minOccurs="0" maxOccurs="unbounded" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="filter">
        <xs:annotation>
            <xs:documentation>Used to install a custom filter or filter macro. This is for advanced use only view macro for simple cases.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="class" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The name of the filter or macro to be installed. The filter or
                        macro must extend either com.jivesoftware.community.renderer.BaseFilter or
                        com.jivesoftware.community.renderer.BaseMacro.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="order" use="optional" type="xs:integer">
                <xs:annotation>
                    <xs:documentation>
                        The order in which this macro is processed when rendering the content.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="widget">
        <xs:annotation>
            <xs:documentation>Used to install a widget.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="class" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The widget's fully-qualified class name. The widget class must extend
                        com.jivesoftware.community.widget.BaseWidget.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="macro">
        <xs:annotation>
            <xs:documentation>Used to install a custom macro.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="parameterSet" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" use="required"/>
            <xs:attribute name="type" use="optional"/>
            <xs:attribute name="url" use="optional"/>
            <xs:attribute name="hasBody" use="required"/>
            <xs:attribute name="class" use="optional" >
                <xs:annotation>
                    <xs:documentation>
                        The name of the filter or macro to be installed. The filter or
                        macro must extend either com.jivesoftware.community.renderer.BaseFilter or
                        com.jivesoftware.community.renderer.BaseMacro.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="script" use="optional">
                <xs:annotation>
                    <xs:documentation>
                        A macro script. The following languages are supported:
                        - groovy
                        - python
                        - ruby
                        - javascript
                        - NetRexx
                        - Tcl
                        - XSLT
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="icon" use="optional" >
                <xs:annotation>
                    <xs:documentation>
                        The icon used in the content editor to visually represent the macro. The image will be loaded from
                        the images directory of the plugin. The following image file formats are supported:
                        - gif
                        - jpeg, jpg
                        - png
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="showInRTE" use="optional" type="xs:boolean">
                <xs:annotation>
                    <xs:documentation>
                        This property tells the system that this filter can be used in the editor.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="isButton" use="optional" type="xs:boolean">
                <xs:annotation>
                    <xs:documentation>
                        This property tells the system to render the macro as a button in the RTE toolbar instead
                        of the insert button's menu
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="order" use="optional" type="xs:integer">
                <xs:annotation>
                    <xs:documentation>
                        The order in which this macro is processed when rendering the content.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="css">
        <xs:annotation>
            <xs:documentation>
                Used to define custom CSS information from a plugin.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="src" use="required" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        A path to the CSS file based from the root of the src (ie. /resources/plugin.css ).
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="javascript">
        <xs:annotation>
            <xs:documentation>
                Used to define custom Javascript information from a plugin.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="src" use="required" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        A path to the javascript file based from the root of the src (ie. /resources/plugin.js ).
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="sitemesh">
        <xs:complexType>
            <xs:sequence>
                <xs:choice maxOccurs="unbounded" >
                    <xs:element ref="decorator" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element ref="excludes" minOccurs="0" maxOccurs="1" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="decorator">
        <xs:annotation>
            <xs:documentation>
                Specify a custom SiteMesh decorator for the plugin.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="pattern" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required" >
                <xs:annotation>
                    <xs:documentation>
                        The name of the custom decorator; this must be unique.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="page" type="xs:string" use="required" >
                <xs:annotation>
                    <xs:documentation>
                        The name of the custom decorator page; this must live under the plugin.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="excludes" >
        <xs:annotation>
            <xs:documentation>
                Used to add URL patterns that SiteMesh should not decorate.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="pattern" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="pattern">
        <xs:annotation>
            <xs:documentation>
                A URL pattern used by either of the SiteMesh tag children: decorator or excludes.
                Examples of a pattern would be:
                - /foo*
                - *.bar
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>
    <xs:element name="urlmapping">
        <xs:complexType>
            <xs:attribute name="prefix" use="required" type="xs:string" >
                <xs:annotation>
                    <xs:documentation>
                        The URL prefix to map actions to. An example would be /foo.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="class" use="required" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        The class of the URL mapper.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="parameterSet">
        <xs:annotation>
            <xs:documentation>
                Used to capture named parameter.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="parameter" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="parameter">
        <xs:annotation>
            <xs:documentation>
                Used to capture named parameter.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="defaults">
                    <xs:complexType>
                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="value" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
