<!--
  ~ 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 -->
    <!-- ================================================= -->

    {% if transport.blocking.http.sender.proxy_host is defined %}
    <parameter name="Proxy">
        <parameters>
            <ProxyHost>{{transport.blocking.http.sender.proxy_host}}</ProxyHost>
            <ProxyPort>{{transport.blocking.http.sender.proxy_port}}</ProxyPort>
            {% if transport.blocking.http.sender.proxy_username is defined %}
            <ProxyUser>{{transport.blocking.http.sender.proxy_username}}</ProxyUser>
            {% endif %}
            {% if transport.blocking.http.sender.proxy_password is defined %}
            <ProxyPassword>{{transport.blocking.http.sender.proxy_password}}</ProxyPassword>
            {% endif %}
        </parameters>
    </parameter>
    {% endif %}

    <parameter name="hotdeployment">{{server.blocking.hot_deployment}}</parameter>
    <parameter name="hotupdate">{{server.blocking.hot_update}}</parameter>
    <parameter name="enableMTOM">{{server.blocking.enableMTOM}}</parameter>
    <parameter name="enableSwA">{{server.blocking.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">{{server.blocking.config_context_timeout_interval}}</parameter>

    <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
    <!--that behavior.-->
    <parameter name="sendStacktraceDetailsWithFaults">{{server.blocking.send_stacktrace_details_with_faults}}</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">{{server.blocking.drill_down_to_root_cause_for_fault_reason}}</parameter>

    <parameter name="userName">{{server.blocking.username}}</parameter>
    <parameter name="password">{{server.blocking.password}}</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">{{server.blocking.service_path}}</parameter>
    <parameter name="restPath" locked="false">{{server.blocking.rest_path}}</parameter>

    <!-- Following parameter will completely disable REST handling in Axis2-->
    <parameter name="disableREST" locked="true">{{server.blocking.disable_rest}}</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 %}
     <!-- SAP Transport Listeners -->
     {% if transport.blocking.sap.listener.idoc.enable == true %}
     <transportReceiver name="idoc" class="{{transport.blocking.sap.listener.idoc.class}}">
            {% for parameter_key,parameter_value in transport.blocking.sap.listener.idoc.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
            {% endfor %}
     </transportReceiver>
     {% endif %}
     {% if transport.blocking.sap.listener.bapi.enable == true %}
     <transportReceiver name="bapi" class="{{transport.blocking.sap.listener.bapi.class}}">
            {% for parameter_key,parameter_value in transport.blocking.sap.listener.bapi.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
            {% endfor %}
     </transportReceiver>
     {% endif %}
    {% 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 %}
    {% if transport.blocking.rabbitmq.listener_enable is defined %}
        {% if transport.blocking.rabbitmq.listener_enable and transport.blocking.rabbitmq.listener|length==0 %}
    <transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener"/>
        {% elif transport.blocking.rabbitmq.listener_enable %}
    <transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener">
            {% for listener in transport.blocking.rabbitmq.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.rabbitmq.listener|length>0 %}
    <transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener">
        {% for listener in transport.blocking.rabbitmq.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 %}
	<!--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 %}
     <!-- SAP Transport Senders -->
     {% if transport.blocking.sap.sender.idoc.enable == true %}
     <transportSender name="idoc" class="{{transport.blocking.sap.sender.idoc.class}}">
            {% for parameter_key,parameter_value in transport.blocking.sap.sender.idoc.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
            {% endfor %}
     </transportSender>
     {% endif %}
     {% if transport.blocking.sap.sender.bapi.enable == true %}
     <transportSender name="bapi" class="{{transport.blocking.sap.sender.bapi.class}}">
            {% for parameter_key,parameter_value in transport.blocking.sap.sender.bapi.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</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 %}
    {% if transport.blocking.rabbitmq.sender_enable is defined %}
           {% if transport.blocking.rabbitmq.sender_enable and transport.blocking.rabbitmq.sender|length==0 %}
       <transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/>
           {% elif transport.blocking.rabbitmq.sender_enable %}
       <transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender">
               {% for sender in transport.blocking.rabbitmq.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.rabbitmq.sender|length>0 %}
       <transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender">
           {% for sender in transport.blocking.rabbitmq.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 %}
    <!-- ================================================= -->
    <!-- Global Modules  -->
    <!-- ================================================= -->
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    {% for phaseOrder in transport.blocking.phase_order %}
           <phaseOrder type="{{phaseOrder.phase_type}}">
               {% for phase in phaseOrder.phases %}
               <phase name="{{phase.phase_name}}" {% if phase.phase_class is defined %} class="{{phase.phase_class}}"{% endif %}>
                   {% for handler in phase.handlers %}
                   <handler name="{{handler.handler_name}}" class="{{handler.handler_class}}">
                       {% if handler.handler_order_phase is defined %}
                       <order {% if handler.handler_order_phase is defined %} phase = "{{handler.handler_order_phase}}" {% endif %} {% if handler.order_before is defined %} before = "{{handler.order_before}}"{% endif %} {% if handler.order_after is defined %} after = "{{handler.order_after}}"{% endif %} {% if handler.order_phase_first is defined %} phaseFirst = "{{handler.order_phase_first}}"{% endif %} {% if handler.order_phase_last is defined %} phaseLast = "{{handler.order_phase_last}}"{% endif %} />
                       {% endif %}
                       {% for handler_handler in handler.handler_handlers %}
                       <handler name="{{handler_handler.handler_name}}" class="{{handler_handler.handler_class}}" />
                       {% endfor %}
                   </handler>
                   {% endfor %}
               </phase>
               {% endfor %}
           </phaseOrder>
       {% endfor %}
</axisconfig>
