<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~  Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) 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                       -->
    <!-- ================================================= -->

    <!-- Change this to true if you want to enable hot deployment of services -->
    <parameter name="hotdeployment" locked="false">true</parameter>
    <!-- Change this to true if you want to enable hot update of services -->
    <parameter name="hotupdate" locked="false">true</parameter>

    <!-- Change this to true if you want to enable MTOM -->
    <parameter name="enableMTOM" locked="false">{{server.enableMTOM}}</parameter>
    <!-- Change this to true if you want to enable SwA -->
    <parameter name="enableSwA" locked="false">{{server.enableSwA}}</parameter>

    <!-- If you want to enable file caching for attachments change this to true -->
    <parameter name="cacheAttachments" locked="false">false</parameter>
    <!-- Attachment file caching location relative to CARBON_HOME -->
    <parameter name="attachmentDIR" locked="false">work/mtom</parameter>
    <!-- Attachment file cache threshold size -->
    <parameter name="sizeThreshold" locked="false">4000</parameter>

    <!-- Completely disable REST handling in Axis2/Synapse if the value is true -->
    <parameter name="disableREST" locked="false">false</parameter>

    <!-- Sandesha2 persistance storage manager -->
    <parameter name="Sandesha2StorageManager" locked="false">inmemory</parameter>

    <!-- This property will enable strict service URL validation -->
    <parameter name="strictServicePathValidation" locked="false">{{server.strict_service_path_validation}}</parameter>

    <!-- Our HTTP endpoints can handle both REST and SOAP under the following service path. In -->
    <!-- case of a servlet container, 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>

    <!--the directory in which .aar services are deployed inside axis2 repository-->
    <parameter name="ServicesDirectory">axis2services</parameter>

    <!--the directory in which modules are deployed inside axis2 repository-->
    <parameter name="ModulesDirectory">axis2modules</parameter>

    <!-- User agent and the server details to be used in the http communication -->
    <parameter name="userAgent" locked="true">{{server.userAgent}}</parameter>
    <parameter name="server" locked="true">{{server.serverDetails}}</parameter>

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

    <!-- Set the flag to true if you want to enable transport level session management -->
    <parameter name="manageTransportSession" locked="false">true</parameter>

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

    <!-- Synapse Configuration file location relative to CARBON_HOME -->
    <parameter name="SynapseConfig.ConfigurationFile" locked="false">repository/deployment/server/synapse-configs</parameter>
    <!-- Synapse Home parameter -->
    <parameter name="SynapseConfig.HomeDirectory" locked="false">.</parameter>
    <!-- Resolve root used to resolve synapse references like schemas inside a WSDL -->
    <parameter name="SynapseConfig.ResolveRoot" locked="false">.</parameter>
    <!-- Synapse Server name parameter -->
    <parameter name="SynapseConfig.ServerName" locked="false">localhost</parameter>

    <!-- Configuration to include full Security Exception Message -->
    <parameter name="includeFullWSSecurityExceptionMessage" locked="false">true</parameter>

    <!-- To override repository/services you need to uncomment following parameter and value -->
    <!-- SHOULD be absolute file path. -->
    <!--<parameter name="ServicesDirectory" locked="false">service</parameter>-->

    <!-- To override repository/modules you need to uncomment following parameter and value -->
    <!-- SHOULD be absolute file path. -->
    <!--<parameter name="ModulesDirectory" locked="false">modules</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" locked="false">https://someotherhost/context</parameter>-->

    {% for parameter_key,parameter_value in axis2_transport.parameter.items() %}
    <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
    {% endfor %}

    <!-- ================================================= -->
    <!--                  Listeners                        -->
    <!-- ================================================= -->

    <!-- This deployment interceptor will be called whenever before a module is initialized or -->
    <!-- service is deployed -->
    <listener class="org.wso2.carbon.core.deployment.DeploymentInterceptor"/>

    <!-- ================================================= -->
    <!--                  Deployers                        -->
    <!-- ================================================= -->

    <!-- Deployer for the dataservice. -->
    <!--<deployer extension="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->

    <!-- Axis1 deployer for Axis2 -->
    <!--<deployer extension="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->

    <!-- POJO service deployer for Jar -->
    <!--<deployer extension="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->

    <!-- POJO service deployer for Class -->
    <!--<deployer extension="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->

    <!-- JAXWS service deployer -->
    <!--<deployer extension=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->

    <!-- ================================================= -->
    <!--                Message Receivers                  -->
    <!-- ================================================= -->

    <!-- This is the set of default Message Receivers for the system, if you want to have -->
    <!-- message receivers for any of the other Message exchange Patterns (MEP) implement it -->
    <!-- and add the implementation class to here, so that you can refer from any operation -->
    <!-- Note : You can override this for particular service by adding this same element to the -->
    <!-- services.xml with your preferences -->
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
                         class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/robust-in-only"
                         class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
                         class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </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="{{message_formatter.form_urlencoded}}"/>
    <messageFormatter contentType="multipart/form-data"
                              class="{{message_formatter.multipart_form_data}}"/>
    <messageFormatter contentType="application/xml"
                              class="{{message_formatter.application_xml}}"/>
    <messageFormatter contentType="text/xml"
                              class="{{message_formatter.text_xml}}"/>
    <messageFormatter contentType="application/soap+xml"
                              class="{{message_formatter.soap_xml}}"/>
    <messageFormatter contentType="application/json"
                              class="{{message_formatter.json}}"/>
    <messageFormatter contentType="application/json/badgerfish"
                              class="{{message_formatter.json_badgerfish}}"/>
    <messageFormatter contentType="text/javascript"
                              class="{{message_formatter.text_javascript}}"/>
    <messageFormatter contentType="text/plain"
                         class="{{message_formatter.text_plain}}"/>
        <messageFormatter contentType="text/event-stream"
                             class="{{message_formatter.text_eventstream}}"/>
        <messageFormatter contentType="text/html"
                          class="{{message_formatter.text_html}}"/>

        <messageFormatter contentType="application/octet-stream"
                          class="{{message_formatter.octet_stream}}"/>
   {% for message_formatter in 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="{{message_builder.application_xml}}"/>
    <messageBuilder contentType="application/x-www-form-urlencoded"
                            class="{{message_builder.form_urlencoded}}"/>

    <messageBuilder contentType="multipart/form-data"
                            class="{{message_builder.multipart_form_data}}"/>
    <messageBuilder contentType="application/json"
                            class="{{message_builder.json}}"/>
    <messageBuilder contentType="application/json/badgerfish"
                            class="{{message_builder.json_badgerfish}}"/>
    <messageBuilder contentType="text/javascript"
                            class="{{message_builder.text_javascript}}"/>
    <messageBuilder contentType="text/html"
                        class="{{message_builder.text_html}}"/>
        <messageBuilder contentType="text/plain"
                        class="{{message_builder.text_plain}}"/>
        <messageBuilder contentType="text/event-stream"
                                class="{{message_builder.text_eventstream}}"/>
        <messageBuilder contentType="application/octet-stream"
                        class="{{message_builder.octet_stream}}"/>
   {% for message_builder in custom_message_builders %}
    <messageBuilder contentType="{{message_builder.content_type}}"
                          class="{{message_builder.class}}"/>
     {% endfor %}
    </messageBuilders>

    <!-- ================================================= -->
    <!--             Transport Ins (Listeners)             -->
    <!-- ================================================= -->

    {% if transport.passthru_http.listener.enable %}
    <transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
     {% for parameter_key,parameter_value in transport.passthru_http.listener.parameters.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
    {% endfor %}
    </transportReceiver>
    {% endif %}

    {% if transport.passthru_https.listener.enable %}
   <transportReceiver name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpMultiSSLListener">
     {% for parameter_key,parameter_value in transport.passthru_https.listener.parameters.items() %}
        <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
    {% endfor %}
            <parameter name="keystore" locked="false">
            <KeyStore>
                <Location>{{transport.passthru_https.listener.key_store.location}}</Location>
                <Type>{{transport.passthru_https.listener.key_store.type}}</Type>
                <Password>{{transport.passthru_https.listener.key_store.password}}</Password>
                <KeyPassword>{{transport.passthru_https.listener.key_store.key_password}}</KeyPassword>
            </KeyStore>
        </parameter>
        <parameter name="truststore" locked="false">
            <TrustStore>
                <Location>{{transport.passthru_https.listener.trust_store.location}}</Location>
                <Type>{{transport.passthru_https.listener.trust_store.type}}</Type>
                <Password>{{transport.passthru_https.listener.trust_store.password}}</Password>
            </TrustStore>
        </parameter>
       <!-- ============================================== -->
       <!-- Configuration for Listener Dynamic SSL Profile loading. -->
       <!-- Configured for 10 mins. -->
       <!-- ============================================== -->
       <parameter name="dynamicSSLProfilesConfig">
           <filePath>repository/resources/security/listenerprofiles.xml</filePath>
           <fileReadInterval>{{transport.passthru_https.listener.ssl_profile_interval}}</fileReadInterval>
       </parameter>
       {% if transport.passthru_https.listener.cert_revocation_validation.enable %}
       <parameter name="CertificateRevocationVerifier" enable="{{transport.passthru_https.listener.cert_revocation_validation.enable}}">
           <CacheSize>{{transport.passthru_https.listener.cert_revocation_validation.cache_size}}</CacheSize>
           <CacheDelay>{{transport.passthru_https.listener.cert_revocation_validation.cache_delay}}</CacheDelay>
           <FullChainValidation>{{transport.passthru_https.listener.cert_revocation_validation.allow_full_cert_chain_validation}}</FullChainValidation>
           <ExpiryValidation>{{transport.passthru_https.listener.cert_revocation_validation.allow_cert_expiry_validation}}</ExpiryValidation>
       </parameter>
       {% endif %}
    </transportReceiver>
    {% endif %}

    <transportReceiver name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>

    <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)-->
    {% if transport.jms.listener_enable is defined %}
        {% if transport.jms.listener_enable and transport.jms.listener|length==0 %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"/>
        {% elif transport.jms.listener_enable %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
            {% for listener in transport.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.jms.listener|length>0 %}
    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        {% for listener in transport.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 %}


    <!-- ================================================= -->
    <!--             Transport Outs (Senders)              -->
    <!-- ================================================= -->

    {% if transport.passthru_http.sender.enable %}
    <transportSender name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpSender">
         {% for parameter_key,parameter_value in transport.passthru_http.sender.parameters.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
        {% if transport.http.proxy_profile is defined %}
            <parameter name="proxyProfiles">
            {% for profile in transport.http.proxy_profile %}
                <profile>
                    <targetHosts>{% for hostitem in profile.target_hosts.toList() %}{{hostitem}}{% if loop.index < profile.target_hosts.toList()|length %},{% endif %}{% endfor %}</targetHosts>
                    <proxyHost>{{profile.proxy_host}}</proxyHost>
                    <proxyPort>{{profile.proxy_port}}</proxyPort>
                    {% if profile.proxy_username is defined %}
                    <proxyUserName>{{profile.proxy_username}}</proxyUserName>
                    {% endif %}
                    {% if profile.proxy_password is defined %}
                    <proxyPassword>{{profile.proxy_password}}</proxyPassword>
                    {% endif %}
                    {% if profile.bypass_hosts is defined %}
                    <bypass>{% for bypassitem in profile.bypass_hosts.toList() %}{{bypassitem}}{% if loop.index < profile.bypass_hosts.toList()|length %},{% endif %}{% endfor %}</bypass>
                    {% endif %}
                </profile>
            {% endfor %}
            </parameter>
        {% endif %}
    </transportSender>
    {% endif %}

    {% if transport.netty.http.sender.enable == true %}
        <transportSender name="httpws" class="{{transport.netty.http.sender.class}}">
            <parameter name="non-blocking" locked="false">true</parameter>
            {% for parameter_key,parameter_value in transport.netty.http.sender.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
            {% endfor %}
        </transportSender>
    {% endif %}

    <transportSender name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportSender"/>

    {% if transport.passthru_https.sender.enable %}
    <transportSender name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLSender">
         {% for parameter_key,parameter_value in transport.passthru_https.sender.parameters.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
        {% endfor %}
        <parameter name="keystore" locked="false">
            <KeyStore>
                <Location>{{transport.passthru_https.sender.key_store.location}}</Location>
                <Type>{{transport.passthru_https.sender.key_store.type}}</Type>
                <Password>{{transport.passthru_https.sender.key_store.password}}</Password>
                <KeyPassword>{{transport.passthru_https.sender.key_store.key_password}}</KeyPassword>
            </KeyStore>
        </parameter>
        <parameter name="truststore" locked="false">
            <TrustStore>
                <Location>{{transport.passthru_https.sender.trust_store.location}}</Location>
                <Type>{{transport.passthru_https.sender.trust_store.type}}</Type>
                <Password>{{transport.passthru_https.sender.trust_store.password}}</Password>
            </TrustStore>
        </parameter>
        <!-- ============================================== -->
        <!-- Configuration for Dynamic SSL Profile loading. -->
        <!-- Configured for 10 mins. -->
        <!-- ============================================== -->
        <parameter name="dynamicSSLProfilesConfig">
            <filePath>{{transport.passthru_https.sender.ssl_profile.file_path}}</filePath>
            <fileReadInterval>{{transport.passthru_https.sender.ssl_profile.interval}}</fileReadInterval>
        </parameter>
       {% if transport.http.secured_proxy_profile is defined %}
       <parameter name="proxyProfiles">
       {% for profile in transport.http.secured_proxy_profile %}
            <profile>
                <targetHosts>{% for hostitem in profile.target_hosts.toList() %}{{hostitem}}{% if loop.index < profile.target_hosts.toList()|length %},{% endif %}{% endfor %}</targetHosts>
                <proxyHost>{{profile.proxy_host}}</proxyHost>
                <proxyPort>{{profile.proxy_port}}</proxyPort>
                {% if profile.proxy_username is defined %}
                <proxyUserName>{{profile.proxy_username}}</proxyUserName>
                {% endif %}
                {% if profile.proxy_password is defined %}
                <proxyPassword>{{profile.proxy_password}}</proxyPassword>
                {% endif %}
                {% if profile.bypass_hosts is defined %}
                <bypass>{% for bypassitem in profile.bypass_hosts.toList() %}{{bypassitem}}{% if loop.index < profile.bypass_hosts.toList()|length %},{% endif %}{% endfor %}</bypass>
                {% endif %}
            </profile>
            {% endfor %}
        </parameter>
        {% endif %}
    </transportSender>
    {% endif %}

    {% if transport.netty.http.sender.secured_enable == true %}
        <transportSender name="httpswss" class="{{transport.netty.https.sender.class}}">
            <parameter name="non-blocking" locked="false">true</parameter>
            {% for parameter_key,parameter_value in transport.netty.https.sender.parameter.items() %}
            <parameter name="{{parameter_key}}" locked="false">{{parameter_value}}</parameter>
            {% endfor %}
            <parameter name="keystore" locked="false">
                <KeyStore>
                    <Location>{{transport.netty.https.sender.keystore.location}}</Location>
                    <Type>{{transport.netty.https.sender.keystore.type}}</Type>
                    <Password>{{transport.netty.https.sender.keystore.password}}</Password>
                    <KeyPassword>{{transport.netty.https.sender.keystore.key_password}}</KeyPassword>
                </KeyStore>
            </parameter>
            <parameter name="truststore" locked="false">
                <TrustStore>
                    <Location>{{transport.netty.https.sender.truststore.location}}</Location>
                    <Type>{{transport.netty.https.sender.truststore.type}}</Type>
                    <Password>{{transport.netty.https.sender.truststore.password}}</Password>
                </TrustStore>
            </parameter>
            {% if transport.netty.http.sender.certificate_revocation_verifier_enable is defined %}
            <parameter name="CertificateRevocationVerifier" enable="{{transport.netty.http.sender.certificate_revocation_verifier_enable}}">
                <CacheSize>{{transport.netty.http.sender.certificate_revocation_cache_size}}</CacheSize>
                <CacheDelay>{{transport.netty.http.sender.certificate_revocation_cache_delay}}</CacheDelay>
            </parameter>
            {% endif %}
        </transportSender>
    {% endif %}

{% if transport.jms.sender_enable is defined %}
    {% if transport.jms.sender_enable and transport.jms.sender|length==0 %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
    {% elif transport.jms.sender_enable %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
        {% for sender in transport.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.jms.sender|length>0 %}
    <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
        {% for sender in transport.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 %}

{% if transport.ws.sender.enable %}
    <transportSender name="ws" class="org.wso2.carbon.websocket.transport.WebsocketTransportSender">
             {% for name,value in transport.ws.sender.parameters.items() %}
                     <parameter name="{{name}}" locked="false">{{value}}</parameter>
              {% endfor %}
    </transportSender>
{%endif%}
{%if transport.wss.sender.enable %}
    <transportSender name="wss" class="org.wso2.carbon.websocket.transport.WebsocketTransportSender">
  {% for name,value in transport.wss.sender.parameters.items() %}
        <parameter name="{{name}}" locked="false">{{value}}</parameter>
   {% endfor %}
        <parameter name="ws.trust.store" locked="false">
            <ws.trust.store.location>{{transport.wss.sender.trust_store.location}}</ws.trust.store.location>
            <ws.trust.store.Password>{{transport.wss.sender.trust_store.password}}</ws.trust.store.Password>
        </parameter>
    </transportSender>
{%endif%}

    <!-- ================================================= -->
    <!--             Global Engaged Modules                -->
    <!-- ================================================= -->

    <!-- Comment this out to disable Addressing -->
    <module ref="addressing"/>

    {% for module in server.globally_engaged_modules %}
    <module ref="{{module}}"/>
    {% endfor %}

    <!--
    Uncomment out the following entry if SOAP (text/xml and application/soap+xml) messages
    are processed through the message relay.
    -->
    <!--module ref="relay"/-->


    <!-- ================================================= -->
    <!--                Clustering                         -->
    <!-- ================================================= -->
    <!--
     To enable clustering for this node, set the value of "enable" attribute of the "clustering"
     element to "true". The initialization of a node in the cluster is handled by the class
     corresponding to the "class" attribute of the "clustering" element. It is also responsible for
     getting this node to join the cluster.
     -->
    <clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent"
                enable="{{clustering.membership_scheme is defined}}">

        <!--
           This parameter indicates whether the cluster has to be automatically initalized
           when the AxisConfiguration is built. If set to "true" the initialization will not be
           done at that stage, and some other party will have to explictly initialize the cluster.
        -->
        <parameter name="AvoidInitiation">true</parameter>

        <!--
           The membership scheme used in this setup. The only values supported at the moment are
           "multicast" and "wka"

           1. multicast - membership is automatically discovered using multicasting
           2. wka - Well-Known Address based multicasting. Membership is discovered with the help
                    of one or more nodes running at a Well-Known Address. New members joining a
                    cluster will first connect to a well-known node, register with the well-known node
                    and get the membership list from it. When new members join, one of the well-known
                    nodes will notify the others in the group. When a member leaves the cluster or
                    is deemed to have left the cluster, it will be detected by the Group Membership
                    Service (GMS) using a TCP ping mechanism.
        -->
        <parameter name="membershipScheme">{{clustering.membership_scheme | default('multicast')}}</parameter>
        <!--<parameter name="licenseKey">xxx</parameter>-->
        <!--<parameter name="mgtCenterURL">http://localhost:8081/mancenter/</parameter>-->

        <!--
         The clustering domain/group. Nodes in the same group will belong to the same multicast
         domain. There will not be interference between nodes in different groups.
        -->
        <parameter name="domain">{{clustering.domain | default('wso2.carbon.domain')}}</parameter>

        <!-- The multicast address to be used -->
        <!--<parameter name="mcastAddress">228.0.0.4</parameter>-->

        <!-- The multicast port to be used -->
        <parameter name="mcastPort">45564</parameter>

        <parameter name="mcastTTL">100</parameter>

        <parameter name="mcastTimeout">60</parameter>

        <!--
           The IP address of the network interface to which the multicasting has to be bound to.
           Multicasting would be done using this interface.
        -->
        <!--
            <parameter name="mcastBindAddress">127.0.0.1</parameter>
        -->
        <!-- The host name or IP address of this member -->

        <parameter name="localMemberHost">{{clustering.local_member_host}}</parameter>

        <!--
            The bind adress of this member. The difference between localMemberHost & localMemberBindAddress
            is that localMemberHost is the one that is advertised by this member, while localMemberBindAddress
            is the address to which this member is bound to.
        -->
        <!--
        <parameter name="localMemberBindAddress">127.0.0.1</parameter>
        -->

        <!--
        The TCP port used by this member. This is the port through which other nodes will
        contact this member
         -->
        <parameter name="localMemberPort">{{clustering.local_member_port | default('4000')}}</parameter>

        {% for property_name,property_value in clustering.properties.items() %}
        <parameter name="{{property_name}}">{{property_value}}</parameter>
        {% endfor %}

        <!--
            The bind port of this member. The difference between localMemberPort & localMemberBindPort
            is that localMemberPort is the one that is advertised by this member, while localMemberBindPort
            is the port to which this member is bound to.
        -->
        <!--
        <parameter name="localMemberBindPort">4001</parameter>
        -->

        <!--
        Properties specific to this member
        -->
        <parameter name="properties">
            <property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
            <property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
            <property name="subDomain" value="worker"/>
        </parameter>

        <!--
           The list of static or well-known members. These entries will only be valid if the
           "membershipScheme" above is set to "wka"
        -->
          <members>
            {% for member in clustering.members %}
            {% set splittedMember = member.split(':') %}
            <member>
                <hostName>{{splittedMember[0]}}</hostName>
                <port>{{splittedMember[1]}}</port>
            </member>
            {% endfor %}
        </members>

        <!--
        Enable the groupManagement entry if you need to run this node as a cluster manager.
        Multiple application domains with different GroupManagementAgent implementations
        can be defined in this section.
        -->
        <groupManagement enable="false">
            <applicationDomain name="wso2.apim.domain"
                               description="APIM group"
                               agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
                               subDomain="worker"
                               port="2222"/>
        </groupManagement>
    </clustering>

    <!-- ================================================= -->
    <!--                   Transactions                    -->
    <!-- ================================================= -->

    <!--
        Uncomment and configure the following section to enable transactions support
    -->
    <!--<transaction timeout="30000">
        <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
        <parameter name="UserTransactionJNDIName">UserTransaction</parameter>
        <parameter name="TransactionManagerJNDIName">TransactionManager</parameter>
    </transaction>-->

    <!-- ================================================= -->
    <!--                    Phases                         -->
    <!-- ================================================= -->

    <phaseOrder type="InFlow">
        <!--  System pre defined phases       -->
        <!--
           The MsgInObservation phase is used to observe messages as soon as they are
           received. In this phase, we could do some things such as SOAP message tracing & keeping
           track of the time at which a particular message was received

           NOTE: This should be the very first phase in this flow
        -->
	<phase name="MsgInObservation">
		<handler name="TraceMessageBuilderDispatchHandler"
                 	 class="org.apache.synapse.transport.passthru.util.TraceMessageBuilderDispatchHandler"/>
	</phase>
	<phase name="Validation"/>
        <phase name="Transport">
            <!--TEMPORALY-->
            <!--handler name="TenantActiveCheckDispatcher"
                     class="org.wso2.carbon.tenant.dispatcher.TenantActiveCheckDispatcher">
                <order phase="Transport"/>
            </handler-->
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
	    <handler name="CarbonContextConfigurator"
		class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <!--handler name="SMTPFaultHandler"
                     class="org.wso2.carbon.core.transports.smtp.SMTPFaultHandler">
                <order phase="Transport"/>
            </handler-->
            <!-- TEMPORALY-->
            <!--handler name="CacheMessageBuilderDispatchandler"
                     class="org.wso2.carbon.mediation.initializer.handler.CacheMessageBuilderDispatchandler"/-->
            <handler name="CarbonContentConfigurator"
                     class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
        </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="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <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"/>
            <handler name="MultitenantDispatcher"
                     class="org.wso2.carbon.tenant.dispatcher.MultitenantDispatcher"/>
            <handler name="SynapseDispatcher"
                     class="org.apache.synapse.core.axis2.SynapseDispatcher"/>
            <handler name="SynapseMustUnderstandHandler"
                     class="org.apache.synapse.core.axis2.SynapseMustUnderstandHandler"/>
        </phase>
        <!--  System pre defined phases       -->
        <phase name="RMPhase"/>
        <phase name="OpPhase"/>
        <phase name="AuthPhase"/>
        <phase name="MUPhase"/>
        <!-- After Postdispatch phase module author or or service author can add any phase he want -->
        <phase name="OperationInPhase"/>
    </phaseOrder>

    <phaseOrder type="OutFlow">
        <!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
        <phase name="UEPPhase" />
        <!--      user can add his own phases to this area  -->
        <phase name="RMPhase"/>
        <phase name="MUPhase"/>
        <phase name="OpPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="PolicyDetermination"/>
		<!--security handler for pass through -->
		<phase name="PTSecurityOutPhase">
			<handler name="RelaySecuirtyMessageBuilderDispatchandler"
                     class="org.apache.synapse.transport.passthru.util.RelaySecuirtyMessageBuilderDispatchandler"/>
        </phase>
        <phase name="MessageOut"/>
        <phase name="Security"/>

        <!--
           The MsgOutObservation phase is used tju,o observe messages just before the
           responses are sent out. In this phase, we could do some things such as SOAP message
           tracing & keeping track of the time at which a particular response was sent.

           NOTE: This should be the very last phase in this flow
        -->
        <phase name="MsgOutObservation"/>
    </phaseOrder>

    <phaseOrder type="InFaultFlow">
        <!--
           The MsgInObservation phase is used to observe messages as soon as they are
           received. In this phase, we could do some things such as SOAP message tracing & keeping
           track of the time at which a particular message was received

           NOTE: This should be the very first phase in this flow
        -->
        <phase name="MsgInObservation"/>
	<phase name="Validation"/>

        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
	    <handler name="CarbonContentConfigurator"
            class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
           </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="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <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>
        <!--      user can add his own phases to this area  -->
        <phase name="RMPhase"/>
        <phase name="OpPhase"/>
        <phase name="MUPhase"/>
        <phase name="OperationInFaultPhase"/>
    </phaseOrder>

    <phaseOrder type="OutFaultFlow">
        <!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
        <phase name="UEPPhase" />
        <!--      user can add his own phases to this area  -->
        <phase name="RMPhase"/>
        <!-- Must Understand Header processing phase -->
        <phase name="MUPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
	<phase name="Transport"/>
        <!--
           The MsgOutObservation phase is used to observe messages just before the
           responses are sent out. In this phase, we could do some things such as SOAP message
           tracing & keeping track of the time at which a particular response was sent.

           NOTE: This should be the very last phase in this flow
        -->
        <phase name="MsgOutObservation"/>
    </phaseOrder>

</axisconfig>
