Configuration example

Configuration example

<config xmlns="http://software.in2p3.fr/lavoisier/config.xsd" xmlns:xi="http://www.w3.org/2001/XInclude" version="12">
    <xi:include href="lavoisier-console.xml" xpointer="element(/1/*)"/>

    <view name="restricted" authorized="user()='lavoisier'">
        <connector type="StringConnector">
            <parameter name="content">SECRET</parameter>
        </connector>
        <serializer type="EncapsulateSerializer">
            <parameter name="cdata">false</parameter>
        </serializer>
    </view>
    <view name="sendback">
        <info>
            <category>Hidden</category>
        </info>
        <connector type="XMLConnector">
            <parameter name="content" eval="post()"/>
        </connector>
        <renderers>
            <renderer type="DefaultRenderer">
                <parameter name="contentType">application/xml</parameter>
            </renderer>
        </renderers>
    </view>
    <view name="example">
        <info>
            <accept>chart</accept>
        </info>
        <argument name="axis" path-format="none" pattern="normal|inverted|polar">polar</argument>
        <argument name="stacking" path-format="none" pattern="none|normal|percent">none</argument>
        <connector type="XMLConnector">
            <parameter name="content">
                &lt;data&gt;
                    &lt;products month="January"&gt;&lt;A&gt;8343&lt;/A&gt;&lt;B&gt;2446&lt;/B&gt;&lt;/products&gt;
                    &lt;products month="February"&gt;&lt;A&gt;7684&lt;/A&gt;&lt;B&gt;3935&lt;/B&gt;&lt;/products&gt;
                    &lt;products month="March"&gt;&lt;A&gt;6983&lt;/A&gt;&lt;B&gt;3452&lt;/B&gt;&lt;/products&gt;
                    &lt;products month="April"&gt;&lt;A&gt;8345&lt;/A&gt;&lt;B&gt;4424&lt;/B&gt;&lt;/products&gt;
                    &lt;products month="May"&gt;&lt;A&gt;8195&lt;/A&gt;&lt;B&gt;4925&lt;/B&gt;&lt;/products&gt;
                    &lt;products month="June"&gt;&lt;A&gt;6983&lt;/A&gt;&lt;B&gt;4328&lt;/B&gt;&lt;/products&gt;
                &lt;/data&gt;
            </parameter>
        </connector>
        <processors>
            <insert match="/data/products[B]" nodes="new_element('average', sum(*/text()) div count(*))"/>
        </processors>
        <cache type="FileCache">
            <trigger type="ViewCreatedAndDeltaTimeTrigger">
                <parameter name="hours">1</parameter>
            </trigger>
            <trigger type="ViewNotifiedTrigger"/>
        </cache>
        <renderers>
            <renderer type="ChartRenderer">
                <parameter name="types">
                    <entry>area</entry>
                    <entry>spline</entry>
                </parameter>
                <parameter name="axis" eval="$axis"/>
                <parameter name="stacking" eval="$stacking"/>
            </renderer>
            <renderer type="CsvRenderer">
                <parameter name="separator">;</parameter>
            </renderer>
        </renderers>
    </view>
    <view name="logo">
        <argument name="ratio" pattern="\d+"/>
        <argument name="hair" path-format="name_value">grey</argument>
        <connector type="XMLConnector">
            <parameter name="content" eval="document('rsc/logo.svg')"/>
        </connector>
        <processors xmlns:svg="http://www.w3.org/2000/svg">
            <!-- use ratio to change height and width -->
            <replace match="/svg:svg/@height" nodes="concat(substring-before(., 'px') * number($ratio div 100), 'px')"/>
            <replace match="/svg:svg/@width" nodes="concat(substring-before(., 'px') * number($ratio div 100), 'px')"/>
            <!-- change hair color -->
            <replace match="//svg:path[@id='hair']/@fill" nodes="$hair"/>
        </processors>
        <renderers>
            <renderer type="DefaultRenderer">
                <parameter name="contentType">image/svg+xml</parameter>
            </renderer>
        </renderers>
    </view>
</config>