<?xml version='1.0' encoding='UTF-8'?>
<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
<config default-supplement="default">
   <extension-module>org.infinispan.extension</extension-module>
   <subsystem xmlns="urn:infinispan:server:core:${infinispan.core.schema.version}" default-cache-container="@@default-cache-container@@">
      <?CACHE-CONTAINERS?>
   </subsystem>
   <supplement name="default">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default" statistics="true">
            <global-state />
            <local-cache name="default" />
            <local-cache name="namedCache" />
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="clustered">
      <replacement placeholder="@@default-cache-container@@" attributeValue="clustered" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="clustered" default-cache="default" statistics="true">
            <transport lock-timeout="60000" />
            <global-state />

            <distributed-cache-configuration name="transactional">
               <transaction mode="NON_XA" locking="PESSIMISTIC"/>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="async" mode="ASYNC" />

            <replicated-cache-configuration name="replicated" />

            <distributed-cache-configuration name="persistent-file-store">
               <file-store shared="false" fetch-state="true" passivation="false"/>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="indexed">
               <indexing index="LOCAL" auto-config="true"/>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="memory-bounded">
               <memory>
                  <binary size="10000000" eviction="MEMORY"/>
               </memory>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="persistent-file-store-passivation">
               <memory>
                  <object size="10000"/>
               </memory>
               <file-store shared="false" fetch-state="true" passivation="true">
                  <write-behind modification-queue-size="1024" thread-pool-size="1" />
               </file-store>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="persistent-file-store-write-behind">
               <file-store shared="false" fetch-state="true" passivation="false">
                  <write-behind modification-queue-size="1024" thread-pool-size="1" />
               </file-store>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="persistent-rocksdb-store">
               <rocksdb-store shared="false" fetch-state="true" passivation="false"/>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="persistent-jdbc-string-keyed">
               <string-keyed-jdbc-store datasource="java:jboss/datasources/ExampleDS" fetch-state="true" preload="false" purge="false" shared="false" passivation="false">
                  <string-keyed-table prefix="ISPN">
                     <id-column name="id" type="VARCHAR" />
                     <data-column name="datum" type="BINARY" />
                     <timestamp-column name="version" type="BIGINT" />
                  </string-keyed-table>
                  <write-behind modification-queue-size="1024" thread-pool-size="1" />
               </string-keyed-jdbc-store>
            </distributed-cache-configuration>

            <distributed-cache name="default" />

            <replicated-cache name="repl" configuration="replicated"/>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="services">
      <replacement placeholder="@@default-cache-container@@" attributeValue="clustered" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="clustered" default-cache="default" statistics="true">
            <transport lock-timeout="60000" />
            <global-state />

            <distributed-cache-configuration name="shared-memory-service" owners="2">
               <partition-handling when-split="ALLOW_READ_WRITES" merge-policy="REMOVE_ALL"/>
            </distributed-cache-configuration>

            <distributed-cache-configuration name="caching-service" owners="1">
               <partition-handling when-split="ALLOW_READ_WRITES" merge-policy="REMOVE_ALL"/>
            </distributed-cache-configuration>

            <distributed-cache name="default" />
            <distributed-cache name="memcachedCache" />
         </cache-container>
      </replacement>
   </supplement>
   <!-- Examples -->
   <supplement name="fcs-local">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <locking acquire-timeout="30000" concurrency-level="1000" striping="false" />
               <memory>
                  <object size="1000"/>
               </memory>
               <file-store passivation="true" path="dc" purge="true" shared="false" />
            </local-cache>
            <local-cache name="namedCache">
               <expiration lifespan="2000"/>
               <file-store passivation="false" path="nc" purge="true" shared="false">
                  <write-behind modification-queue-size="1024" thread-pool-size="1" />
               </file-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="counters">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <locking acquire-timeout="30000" concurrency-level="1000" striping="false" />
               <memory>
                  <object size="1000"/>
               </memory>
               <file-store passivation="true" path="dc" purge="true" shared="false" />
            </local-cache>
            <local-cache name="namedCache">
               <expiration lifespan="2000"/>
            </local-cache>
            <counters>
                <strong-counter name="c1" initial-value="0"
                    storage="VOLATILE">
                    <lower-bound value="0" />
                </strong-counter>
                <weak-counter name="c2" initial-value="0" storage="VOLATILE"
                    concurrency-level="32" />
            </counters>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="rocksdb-cs-local">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <memory>
                  <object size="1000"/>
               </memory>
               <rocksdb-store passivation="true" path="rocksdb-dc" purge="true" shared="false" />
            </local-cache>
            <local-cache name="namedCache">
               <expiration lifespan="2000" />
               <rocksdb-store path="rocksdb-nc" block-size="1024" cache-size="50000" clear-threshold="100000">
                  <expiration path="rocksdb-nc-expired" queue-size="2000"/>
                  <compression type="SNAPPY"/>
               </rocksdb-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="hotrod-rolling-upgrade">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <remote-store cache="default" socket-timeout="60000" tcp-no-delay="true" shared="true" hotrod-wrapping="true" purge="false" passivation="false">
                  <remote-server outbound-socket-binding="remote-store-hotrod-server" />
               </remote-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="hotrod-rolling-upgrade-ssl">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <remote-store cache="default" socket-timeout="60000" tcp-no-delay="true" shared="true" hotrod-wrapping="true" purge="false" passivation="false">
                  <remote-server outbound-socket-binding="remote-store-hotrod-server" />
                  <encryption security-realm="ApplicationRealm"/>
               </remote-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="jdbc-clustered">
      <replacement placeholder="@@default-cache-container@@" attributeValue="clustered" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="clustered" default-cache="default" >
            <transport lock-timeout="60000" />
            <global-state />
            <distributed-cache name="default" remote-timeout="30000">
               <locking acquire-timeout="30000" concurrency-level="1000" striping="false" />
                <memory>
                    <object size="1000"/>
                </memory>
               <string-keyed-jdbc-store datasource="java:jboss/datasources/ExampleDS" dialect="H2" passivation="true" fetch-state="true" preload="true" purge="false">
                  <string-keyed-table prefix="ISPN_STR" create-on-start="true" drop-on-exit="false">
                     <id-column name="id" type="VARCHAR" />
                     <data-column name="datum" type="BINARY" />
                     <timestamp-column name="version" type="BIGINT" />
                  </string-keyed-table>
               </string-keyed-jdbc-store>
            </distributed-cache>

            <distributed-cache name="namedCache">
               <expiration lifespan="2000" max-idle="1000" />
               <string-keyed-jdbc-store datasource="java:jboss/datasources/ExampleDS" dialect="H2" passivation="false" fetch-state="true" preload="true" purge="false" shared="false">
                  <string-keyed-table prefix="ISPN_NC_SK">
                     <id-column name="id" type="VARCHAR" />
                     <data-column name="datum" type="BINARY" />
                     <timestamp-column name="version" type="BIGINT" />
                  </string-keyed-table>
               </string-keyed-jdbc-store>
            </distributed-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="rcs-local">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <memory>
                  <object size="1000"/>
               </memory>
               <remote-store cache="default" socket-timeout="60000" tcp-no-delay="true" passivation="true">
                  <remote-server outbound-socket-binding="remote-store-hotrod-server" />
               </remote-store>
            </local-cache>
            <local-cache name="namedCache">
               <expiration lifespan="3000"/>
               <remote-store cache="namedCache" socket-timeout="60000" tcp-no-delay="true" passivation="false">
                  <remote-server outbound-socket-binding="remote-store-hotrod-server" />
               </remote-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="rest-auth">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <memory>
                  <object size="1000"/>
               </memory>
            </local-cache>
            <local-cache name="namedCache">
               <expiration lifespan="2000" max-idle="1000" />
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="rest-rolling-upgrade">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <encoding>
                    <key media-type="application/x-java-object;type=java.lang.String"/>
               </encoding>
               <rest-store path="/rest/default" shared="true" purge="false" passivation="false">
                  <connection-pool connection-timeout="60000" socket-timeout="60000" tcp-no-delay="true" max-connections-per-host="4" max-total-connections="20" />
                  <remote-server outbound-socket-binding="remote-store-rest-server" />
               </rest-store>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="xsite">
      <replacement placeholder="@@default-cache-container@@" attributeValue="clustered" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="clustered" default-cache="default" >
            <global-state />
            <transport lock-timeout="60000"/>
            <distributed-cache name="default" remote-timeout="30000">
               <backups>
                  <backup site="NYC" strategy="SYNC" />
                  <backup site="SFO" strategy="ASYNC" />
               </backups>
            </distributed-cache>

            <distributed-cache name="namedCache">
               <expiration lifespan="2000" max-idle="1000" />
               <backups>
                  <backup site="NYC" strategy="SYNC" />
                  <backup site="SFO" strategy="ASYNC" />
               </backups>
            </distributed-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="compatibility-mode">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <local-cache name="default">
               <compatibility enabled="true" />
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="auth">
      <replacement placeholder="@@default-cache-container@@" attributeValue="local" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="local" default-cache="default">
            <global-state />
            <security>
                <authorization>
                    <identity-role-mapper />
                    <role name="admin" permissions="ALL" />
                    <role name="reader" permissions="READ" />
                    <role name="writer" permissions="WRITE" />
                    <role name="supervisor" permissions="ALL_READ ALL_WRITE"/>
                </authorization>
            </security>
            <local-cache name="default" />
            <local-cache name="secured">
                <security>
                    <authorization roles="admin reader writer supervisor" />
                </security>
            </local-cache>
         </cache-container>
      </replacement>
   </supplement>
   <supplement name="indexing">
      <replacement placeholder="@@default-cache-container@@" attributeValue="clustered" />
      <replacement placeholder="CACHE-CONTAINERS">
         <cache-container name="clustered" default-cache="default" statistics="true">
            <transport lock-timeout="60000"/>
            <global-state />
            <distributed-cache name="default"/>
            <!-- Indexes are local to each node, stored on the filesystem -->
            <replicated-cache name="OnDiskNonSharedIndex">
               <indexing index="ALL">
                  <property name="default.indexmanager">near-real-time</property>
                  <property name="default.indexBase">${java.io.tmpdir}/OnDiskNonSharedIndex</property>
               </indexing>
            </replicated-cache>
            <!-- Indexes are local to each node, stored in memory -->
            <replicated-cache name="InMemoryNonSharedIndex">
               <indexing index="ALL">
                  <property name="default.directory_provider">local-heap</property>
               </indexing>
            </replicated-cache>
            <!-- Indexes are local to each node, stored on infinispan itself on configured caches -->
            <replicated-cache name="InfinispanCustomNonSharedIndex">
               <indexing index="ALL">
                  <property name="default.directory_provider">infinispan</property>
                  <property name="default.metadata_cachename">indexMetadata</property>
                  <property name="default.data_cachename">indexData</property>
                  <property name="default.locking_cachename">indexLocking</property>
               </indexing>
            </replicated-cache>
            <local-cache name="indexMetadata">
            </local-cache>
            <local-cache name="indexData">
            </local-cache>
            <local-cache name="indexLocking">
            </local-cache>
            <!-- Indexes are shared between all nodes, stored on infinispan itself -->
            <distributed-cache name="InfinispanSharedIndex">
               <indexing index="LOCAL">
                  <property name="default.indexmanager">org.infinispan.query.indexmanager.InfinispanIndexManager</property>
               </indexing>
            </distributed-cache>
            <!-- Auto config based on cache type -->
            <distributed-cache name="sharedIndexInfinispanDirectory">
               <indexing index="LOCAL" auto-config="true"/>
            </distributed-cache>
            <replicated-cache name="nearRealtimeFileSystemIndex">
               <indexing index="ALL" auto-config="true"/>
            </replicated-cache>
         </cache-container>
      </replacement>
   </supplement>
   <outbound-socket-binding name="remote-store-hotrod-server">
      <remote-destination host="remote-host" port="11222" />
   </outbound-socket-binding>
   <outbound-socket-binding name="remote-store-rest-server">
      <remote-destination host="remote-host" port="8080" />
   </outbound-socket-binding>
</config>
