blob: 01665db1eedb1ab9978d329b221f9e4ffae19abb [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF 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.
-->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean name="cache-store-session-listener" class="javax.cache.configuration.FactoryBuilder.ClassFactory">
<constructor-arg value="org.apache.nlpcraft.server.tx.NCTxCacheStoreSessionListener"/>
</bean>
<bean name="tcp-disco" class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="networkTimeout" value="10000"/>
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<!--
List all IP/port configurations that can be started first.
-->
<value>127.0.0.1:47500</value>
<value>127.0.0.1:47501</value>
<value>127.0.0.1:47502</value>
</list>
</property>
</bean>
</property>
</bean>
<bean id="oneDayPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MILLISECONDS"/>
<constructor-arg value="86400000"/>
</bean>
</constructor-arg>
</bean>
<bean id="threeHourPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MILLISECONDS"/>
<constructor-arg value="10800000"/>
</bean>
</constructor-arg>
</bean>
<bean id="fiveMinsPolicy" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MILLISECONDS"/>
<constructor-arg value="300000"/>
</bean>
</constructor-arg>
</bean>
<bean name="user-token-signin-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="user-token-signin-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="oneDayPolicy"/>
</bean>
<bean name="user-id-signin-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="user-id-signin-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="oneDayPolicy"/>
</bean>
<bean name="qry-state-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="qry-state-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="threeHourPolicy"/>
</bean>
<bean name="sentence-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="sentence-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
</bean>
<bean name="stanford-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="stanford-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
</bean>
<bean name="opennlp-cache" class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="opennlp-cache"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="expiryPolicyFactory" ref="fiveMinsPolicy"/>
</bean>
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="igniteInstanceName" value="nlpcraft"/>
<property name="consistentId" value="nlpcraft-#{T(org.apache.nlpcraft.common.version.NCVersion).current.version()}"/>
<!--
Change this path to store Ignite DB files elsewhere.
-->
<property name="workDirectory" value="#{systemProperties['user.home']}/.nlpcraft/ignite/v#{T(org.apache.nlpcraft.common.version.NCVersion).current.version()}"/>
<property name="sqlConfiguration.sqlSchemas">
<list>
<value>nlpcraft</value>
</list>
</property>
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
</bean>
</property>
<!--
Change these paths to store Ignite DB elsewhere.
-->
<property name="walPath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/v#{T(org.apache.nlpcraft.common.version.NCVersion).current.version()}/wal"/>
<property name="walArchivePath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/v#{T(org.apache.nlpcraft.common.version.NCVersion).current.version()}/wal-archive"/>
<property name="storagePath" value="#{systemProperties['user.home']}/.nlpcraft/ignite/v#{T(org.apache.nlpcraft.common.version.NCVersion).current.version()}/storage"/>
</bean>
</property>
<!-- Note that 'shutdownHook' option doesn't work when Ignite is used with log4j2 for some reasons. -->
<property name="gridLogger">
<bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
<constructor-arg type="java.net.URL" value="classpath:log4j2.xml"/>
</bean>
</property>
<property name="localHost" value="127.0.0.1"/>
<property name="communicationSpi">
<bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
<!-- Override local port. -->
<property name="sharedMemoryPort" value="-1"/>
</bean>
</property>
<!-- Global cache store session listener. -->
<property name="CacheStoreSessionListenerFactories">
<list>
<ref bean="cache-store-session-listener"/>
</list>
</property>
<property name="discoverySpi" ref="tcp-disco"/>
<!-- Enable all events. -->
<property name="includeEventTypes">
<util:constant static-field="org.apache.ignite.events.EventType.EVTS_ALL"/>
</property>
<!-- Caches. -->
<property name="cacheConfiguration">
<list>
<ref bean="user-token-signin-cache"/>
<ref bean="user-id-signin-cache"/>
<ref bean="qry-state-cache"/>
<ref bean="sentence-cache"/>
<ref bean="stanford-cache"/>
<ref bean="opennlp-cache"/>
</list>
</property>
</bean>
</beans>