<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<axisconfig name="AxisJava2.0" xmlns:svns="http://org.wso2.securevault/configuration">
    <!-- ================================================= -->
    <!-- Parameters -->
    <!-- ================================================= -->
    <parameter name="hotdeployment">true</parameter>
    <parameter name="hotupdate">false</parameter>
    <parameter name="enableMTOM">{{server.enableMTOM}}</parameter>
    <parameter name="enableSwA">{{server.enableSwA}}</parameter>

    <!--Uncomment if you want to enable file caching for attachments -->
    <!--parameter name="cacheAttachments">true</parameter>
    <parameter name="attachmentDIR"></parameter>
    <parameter name="sizeThreshold">4000</parameter-->

    <!--This will give out the timout of the configuration contexts, in milliseconds-->
    <parameter name="ConfigContextTimeoutInterval">30000</parameter>

    <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
    <!--that behavior.-->
    <parameter name="sendStacktraceDetailsWithFaults">false</parameter>

    <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
    <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
    <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
    <!--is set, then Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
    <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>

    <parameter name="userName">admin</parameter>
    <parameter name="password">axis2</parameter>

    <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
    <!--ServicesDirectory only works on the following cases-->
    <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
    <!---When creating URL Based configurator with URL "file://"  -->
    <!--- War based configurator with expanded case , -->

    <!--All the other scenarios it will be ignored.-->
    <!--<parameter name="ServicesDirectory">service</parameter>-->
    <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
    <!--<parameter name="ModulesDirectory">modules</parameter>-->



    <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
    <!--root which can configured using the following contextRoot parameter-->
    <!--<parameter name="contextRoot">axis2</parameter>-->

    <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguiush those endpoints-->
    <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
    <!--context path to proper Axis2 servlets-->
    <parameter name="servicePath" locked="false">services</parameter>
    <parameter name="restPath" locked="false">rest</parameter>

    <!-- Following parameter will completely disable REST handling in Axis2-->
    <parameter name="disableREST" locked="true">false</parameter>

    <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
    <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>

    {% for parameter in  transport.blocking.parameters %}
    <parameter name="{{parameter.name}}" locked="false">{{parameter.value}}</parameter>
    {% endfor %}

    <!-- Following parameter will set the host name for the epr-->
    <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->

    <!-- If you have a frontend host which exposes this webservice using a different public URL  -->
    <!-- use this parameter to override autodetected url -->
    <!--<parameter name="httpFrontendHostUrl">https://someotherhost/context</parameter>-->


    <!--    The way of adding listener to the system-->
    <!--    <listener class="org.apache.axis2.ObserverIMPL">-->
    <!--        <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
    <!--    </listener>-->

    <!-- ================================================= -->
    <!-- Message Receivers -->
    <!-- ================================================= -->
    <!--This is the deafult MessageReceiver for the system , if you want to have MessageReceivers for -->
    <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
    <!--any operation -->
    <!--Note : You can ovrride this for a particular service by adding the same element with your requirement-->
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </messageReceivers>

     <!-- ================================================= -->
    <!--                Message Formatters                 -->
    <!-- ================================================= -->

    <!-- Following content type to message formatter mapping can be used to implement support -->
    <!-- for different message format serializations in Axis2. These message formats are -->
    <!-- expected to be resolved based on the content type. -->
    <messageFormatters>
        <messageFormatter contentType="application/x-www-form-urlencoded"
                          class="{{blocking.message_formatters.form_urlencoded}}"/>
        <messageFormatter contentType="multipart/form-data"
                          class="{{blocking.message_formatters.multipart_form_data}}"/>
        <messageFormatter contentType="application/xml"
                          class="{{blocking.message_formatters.application_xml}}"/>
        <messageFormatter contentType="text/xml"
                          class="{{blocking.message_formatters.text_xml}}"/>
        <messageFormatter contentType="application/soap+xml"
                          class="{{blocking.message_formatters.soap_xml}}"/>
        <messageFormatter contentType="text/plain"
                          class="{{blocking.message_formatters.text_plain}}"/>
        <messageFormatter contentType="application/json"
                          class="{{blocking.message_formatters.application_json}}"/>
        <messageFormatter contentType="application/json/badgerfish"
                          class="{{blocking.message_formatters.json_badgerfish}}"/>
        <messageFormatter contentType="text/javascript"
                          class="{{blocking.message_formatters.text_javascript}}"/>
        <messageFormatter contentType="application/octet-stream"
                          class="{{blocking.message_formatters.octet_stream}}"/>
        <messageFormatter contentType="application/binary"
                          class="{{blocking.message_formatters.application_binary}}"/>
        {% for message_formatter in blocking.custom_message_formatters %}
        <messageFormatter contentType="{{message_formatter.content_type}}"
                          class="{{message_formatter.class}}"/>
        {% endfor %}
    </messageFormatters>
    <!-- ================================================= -->
    <!--                Message Builders                   -->
    <!-- ================================================= -->

    <!-- Following content type to builder mapping can be used to implement support for -->
    <!-- different message formats in Axis2. These message formats are expected to be -->
    <!-- resolved based on the content type. -->
    <messageBuilders>
        <messageBuilder contentType="application/xml"
                        class="{{blocking.message_builders.application_xml}}"/>
        <messageBuilder contentType="application/x-www-form-urlencoded"
                        class="{{blocking.message_builders.form_urlencoded}}"/>
        <messageBuilder contentType="multipart/form-data"
                        class="{{blocking.message_builders.multipart_form_data}}"/>
        <messageBuilder contentType="application/json"
                        class="{{blocking.message_builders.application_json}}"/>
        <messageBuilder contentType="application/json/badgerfish"
                        class="{{blocking.message_builders.json_badgerfish}}"/>
        <messageBuilder contentType="text/javascript"
                        class="{{blocking.message_builders.text_javascript}}"/>
        <messageBuilder contentType="text/plain"
                        class="{{blocking.message_builders.text_plain}}"/>
        <messageBuilder contentType="application/octet-stream"
                        class="{{blocking.message_builders.octet_stream}}"/>
        <messageBuilder contentType="application/binary"
                        class="{{blocking.message_builders.application_binary}}"/>
        {% for message_builder in blocking.custom_message_builders %}
        <messageBuilder contentType="{{message_builder.content_type}}"
                        class="{{message_builder.class}}"/>
        {% endfor %}
    </messageBuilders>

    <!-- ================================================= -->
    <!-- Transport Ins -->
    <!-- ================================================= -->
    {% if transport.blocking.http.listener.enable == true %}
	<transportReceiver name="http"
                       class="org.apache.axis2.transport.http.SimpleHTTPServer">
        {% for parameter_key,parameter_value in transport.blocking.http.listener.parameter.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
    </transportReceiver>
    {% endif %}
    {% if transport.blocking.jms.listener_enable is defined %}
        {% if transport.blocking.jms.listener_enable and transport.blocking.jms.listener|length==0 %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"/>
        {% elif transport.blocking.jms.listener_enable %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
            {% for listener in transport.blocking.jms.listener %}
        <parameter name="{{listener.name}}" locked="false">
                {% for name,value in listener.parameter.items() %}
            <parameter name="{{name}}" locked="false">{{value}}</parameter>
                {% endfor %}
        </parameter>
            {% endfor %}
    </transportReceiver>
        {% endif %}
    {% elif transport.blocking.jms.listener|length>0 %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        {% for listener in transport.blocking.jms.listener %}
        <parameter name="{{listener.name}}" locked="false">
            {% for name,value in listener.parameter.items() %}
            <parameter name="{{name}}" locked="false">{{value}}</parameter>
            {% endfor %}
        </parameter>
        {% endfor %}
    </transportReceiver>
    {% endif %}
    {% if transport.blocking.mail.listener.enable == true %}
    <transportReceiver name="{{transport.blocking.mail.listener.name}}" class="org.apache.axis2.transport.mail.MailTransportListener">
        {% for parameter_key,parameter_value in transport.blocking.mail.listener.parameter.items() %}
        <parameter name="{{parameter_key}}">{{parameter_value}}</parameter>
        {% endfor %}
    </transportReceiver>
    {% endif %}
    {% for transport_item in custom_transport.blocking.listener %}
    <transportReceiver name="{{transport_item.protocol}}" class="{{transport_item.class}}">
        {% for parameter_key,parameter_value in transport_item.parameter.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
    </transportReceiver>
    {% endfor %}
    {% if transport.blocking.tcp.listener.enable == true %}
    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
        {% for parameter_key,parameter_value in transport.blocking.tcp.listener.parameter.items() %}
        <parameter name="{{parameter_key}}">{{parameter_value}}</parameter>
        {% endfor %}
        <parameter name="transport.tcp.contentType">{% for content_item in transport.blocking.tcp.listener.content_type %}{{content_item}}{% if loop.index < transport.blocking.tcp.listener.content_type|length %},{% endif %}{% endfor %}</parameter>
    </transportReceiver>
    {% endif %}
    {% if transport.blocking.udp.listener.enable == true %}
    <transportReceiver name="udp" class="org.apache.axis2.transport.udp.UDPListener">
        {% for parameter_key,parameter_value in transport.blocking.udp.listener.parameter.items() %}
        <parameter name="{{parameter_key}}">{{parameter_value}}</parameter>
        {% endfor %}
    </transportReceiver>
    {% endif %}
	<!--Uncomment if you want to have TCP transport support-->
    <!--transportReceiver name="tcp"
                       class="org.apache.axis2.transport.tcp.TCPServer">
        <parameter name="port">6060</parameter-->
        <!--If you want to give your own host address for EPR generation-->
        <!--uncomment the following paramter , and set it as you required.-->
        <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
    <!-- /transportReceiver -->

    <!-- ================================================= -->
    <!-- Transport Outs -->
    <!-- ================================================= -->

    {% if transport.blocking.http.sender.enable == true %}
	<transportSender name="http"
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        {% for parameter_key,parameter_value in transport.blocking.http.sender.parameter.items() %}
        <parameter name="{{parameter_key}}">{{parameter_value}}</parameter>
        {% endfor %}
    </transportSender>
    {% endif %}

    {% if transport.blocking.http.sender.secured_enable == true %}
    <transportSender name="https"
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
       {% for parameter_key,parameter_value in transport.blocking.https.sender.parameter.items() %}
               <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
       {% endfor %}
    </transportSender>
    {% endif %}
    {% if transport.blocking.jms.sender_enable is defined %}
        {% if transport.blocking.jms.sender_enable and transport.blocking.jms.sender|length==0 %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
        {% elif transport.blocking.jms.sender_enable %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
            {% for sender in transport.blocking.jms.sender %}
        <parameter name="{{sender.name}}" locked="false">
                {% for name,value in sender.parameter.items() %}
            <parameter name="{{name}}" locked="false">{{value}}</parameter>
                {% endfor %}
        </parameter>
            {% endfor %}
    </transportSender>
        {% endif %}
    {% elif transport.blocking.jms.sender|length>0 %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
        {% for sender in transport.blocking.jms.sender %}
        <parameter name="{{sender.name}}" locked="false">
            {% for name,value in sender.parameter.items() %}
            <parameter name="{{name}}" locked="false">{{value}}</parameter>
            {% endfor %}
        </parameter>
        {% endfor %}
    </transportSender>
    {% endif %}
    <!-- configure the SMTP server information
    check com.sun.mail.smtp package documentation for descriptions of properties-->
    {% for mail_sender in transport.blocking.mail.sender %}
    <transportSender name="{{mail_sender.name}}" class="org.apache.axis2.transport.mail.MailTransportSender">
        {% for parameter_key,parameter_value in mail_sender.parameter.items() %}
        <parameter name="{{parameter_key}}">{{parameter_value}}</parameter>
        {% endfor %}
    </transportSender>
    {% endfor %}
    {% for transport_item in custom_transport.blocking.sender %}
    <transportSender name="{{transport_item.protocol}}" class="{{transport_item.class}}">
        {% for parameter_key,parameter_value in transport_item.parameter.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
    </transportSender>
    {% endfor %}
    {% if transport.blocking.tcp.sender.enable == true %}
    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender">
        {% for parameter_key,parameter_value in transport.blocking.tcp.sender.parameter.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
    </transportSender>
    {% endif %}
    {% if transport.blocking.udp.sender.enable == true %}
    <transportSender name="udp" class="org.apache.axis2.transport.udp.UDPSender">
        {% for parameter_key,parameter_value in transport.blocking.udp.sender.parameter.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
    </transportSender>
    {% endif %}
    <!-- ================================================= -->
    <!-- Global Modules  -->
    <!-- ================================================= -->
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System pre defined phases       -->
        <phase name="Transport">
            <handler name="IntegratorStatefulHandler" class="org.wso2.micro.integrator.core.handlers.IntegratorStatefulHandler">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
             <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                 <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="IntegratorStatefulHandler" class="org.wso2.micro.integrator.core.handlers.IntegratorStatefulHandler"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>

            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
             <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                 <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="IntegratorStatefulHandler" class="org.wso2.micro.integrator.core.handlers.IntegratorStatefulHandler"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>

            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>
