<?xml version="1.0" encoding="UTF-8"?>
<!--
 This file is part of the Meeds project (https://meeds.io/).

 Copyright (C) 2020 - 2025 Meeds Association contact@meeds.io

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 3 of the License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
  xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">

  <component>
    <key>org.exoplatform.services.organization.idm.api.ExternalStoreService</key>
    <type>org.exoplatform.services.organization.idm.externalstore.PicketLinkIDMExternalStoreService</type>
    <init-params>
      <value-param>
        <name>update.user.onlogin</name>
        <description>Whether update user on login when the information changes on external store or not</description>
        <value>${exo.idm.update.onlogin:true}</value>
      </value-param>
      <value-param>
        <name>exo.idm.externalStore.import.cronExpression</name>
        <description>Cron expression used to schedule the job that will import periodically data from external store</description>
        <value>${exo.idm.externalStore.import.cronExpression:0 59 23 ? * *}</value>
      </value-param>
			<value-param>
				<name>exo.idm.externalStore.authorizelogin</name>
				<description>Does the authentication against the externalStore is authorized ?</description>
				<value>${exo.idm.externalStore.authorizelogin:true}</value>
			</value-param>
    </init-params>
  </component>

	<component>
		<type>org.exoplatform.services.organization.externalstore.IDMExternalStoreImportService</type>
		<init-params>
			<value-param>
				<name>exo.idm.externalStore.import.cronExpression</name>
				<description>Cron expression used to schedule the job that will import periodically data from external store (Default value = every ten minutes)</description>
				<value>${exo.idm.externalStore.import.cronExpression:0 */10 * ? * *}</value>
			</value-param>
			<value-param>
				<name>exo.idm.externalStore.delete.cronExpression</name>
				<description>Cron expression used to schedule the job that will delete periodically data from internal store that has been deleted from external store (Default value = every day at 23:59 PM)</description>
				<value>${exo.idm.externalStore.delete.cronExpression:0 59 23 ? * *}</value>
			</value-param>
			<value-param>
				<name>exo.idm.externalStore.queue.processing.cronExpression</name>
				<description>Cron expression used to schedule the job that will process periodically data injected in queue (Default value = every minute)</description>
				<value>${exo.idm.externalStore.queue.processing.cronExpression:0 */1 * ? * *}</value>
			</value-param>
			<value-param>
				<name>exo.idm.externalStore.entries.missing.delete</name>
				<description>If TRUE delete users if they are not present in external store, otherwise disable them (Default : delete users)</description>
				<value>${exo.idm.externalStore.entries.missing.delete:true}</value>
			</value-param>
		</init-params>
	</component>

	<component>
		<type>org.exoplatform.services.organization.idm.externalstore.jpa.IDMQueueDAO</type>
	</component>

	<component>
		<key>org.exoplatform.services.organization.externalstore.IDMQueueService</key>
		<type>org.exoplatform.services.organization.idm.externalstore.jpa.IDMQueueServiceImpl</type>
		<init-params>
			<value-param>
				<name>exo.idm.queue.processing.error.retries.max</name>
				<description>Max retries for a queue entry processing when it throws an exception</description>
				<value>${exo.idm.externalStore.queue.processing.error.retries.max:5}</value>
			</value-param>
		</init-params>
	</component>

	<component>
		<type>org.exoplatform.services.organization.externalstore.IDMExternalStoreManagedBean</type>
	</component>

  <!-- Data Initialization -->
  <external-component-plugins>
    <target-component>org.exoplatform.commons.api.persistence.DataInitializer</target-component>
    <component-plugin>
      <name>CommonsChangeLogsPlugin</name>
      <set-method>addChangeLogsPlugin</set-method>
      <type>org.exoplatform.commons.persistence.impl.ChangeLogsPlugin</type>
      <init-params>
        <values-param>
          <name>changelogs</name>
          <description>Change logs of idm queue</description>
          <value>db/changelog/idm.queue.db.changelog-1.0.0.xml</value>
        </values-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
</configuration>
