<commit_before><?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:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <!-- 
    ===========================================================================
       Spring Wiring for James Server: Annotation, Bean Post-Processors...
    ===========================================================================
    -->

    <!-- Enable Java Annotations processing. -->
    <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor">
        <property name="order" value="3"/>
    </bean>

    <!-- Enable support for Persistence Annotations processing. -->
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>

    <import resource="classpath:META-INF/spring/loaders-context.xml"/>

    <!-- 
    ===========================================================================
       Authenticator
    ===========================================================================
    -->

    <import resource="classpath:META-INF/org/apache/james/spring-mailbox-authenticator.xml"/>

    <!-- 
    ===========================================================================
       Queues
    ===========================================================================
    -->

    <!-- 
      Alternative queue is FileMailQueueFactory - Can be used instead of the default one.
    <import resource="classpath:META-INF/spring/file-queue-context.xml"/>
     -->

    <!-- Default Mail Queue Factory is the ActiveMQMailQueueFactory -->
    <import resource="classpath:META-INF/spring/activemq-queue-context.xml"/>

    <!-- Mailet Container -->
    <import resource="classpath:META-INF/spring/mailetcontainer-context.xml"/>

    <!-- Camel Context -->
    <camel:camelContext id="jamesCamelContext" trace="false">
        <camel:jmxAgent id="agent" disabled="false" createConnector="false" serviceUrlPath="/jmxrmi/jamescamel"/>
    </camel:camelContext>

    <!-- DNS Service -->
    <import resource="classpath:META-INF/spring/dns-context.xml"/>

    <!-- FetchMail -->
    <import resource="classpath:META-INF/spring/fetchmail-context.xml"/>

    <!--
    ===========================================================================
       Mail Protocol Servers
    ===========================================================================
    -->

    <!-- SMTP Server -->
    <import resource="classpath:META-INF/spring/smtpserver-context.xml"/>

    <!-- LMTP Server -->
    <import resource="classpath:META-INF/spring/lmtpserver-context.xml"/>

    <!-- POP3 Server -->
    <import resource="classpath:META-INF/spring/pop3server-context.xml"/>

    <!-- IMAP4 Server -->
    <import resource="classpath:META-INF/spring/imapserver-context.xml"/>

    <!-- The imapProcessor configuration will be reviewed when IMAP will be integrated into Protocols project -->
    <!-- Temporary configuration - see IMAP-357 -->
    <bean id="imapProcessor" class="org.apache.james.imap.processor.main.DefaultImapProcessorFactory"
          factory-method="createXListSupportingProcessor">
        <constructor-arg index="0" ref="mailboxmanager"/>
        <constructor-arg index="1" ref="subscriptionManager"/>
        <!-- The mailboxTyper -->
        <constructor-arg index="2" value="#{null}"/>
        <!-- The idleKeepAlive -->
        <constructor-arg index="3" value="120"/>
        <!-- The list of disabled capabilities -->
        <constructor-arg index="4">
            <set>
                <value>ACL</value>
                <value>MOVE</value>
            </set>
        </constructor-arg>
    </bean>

    <bean id="imapDecoderFactory" class="org.apache.james.imap.main.DefaultImapDecoderFactory"/>
    <bean id="imapDecoder" factory-bean="imapDecoderFactory" factory-method="buildImapDecoder"/>

    <bean id="imapEncoderFactory" class="org.apache.james.imap.encode.main.DefaultImapEncoderFactory"/>
    <bean id="imapEncoder" factory-bean="imapEncoderFactory" factory-method="buildImapEncoder"/>

    <!--
    ===========================================================================
       Mailbox
    ===========================================================================
    -->

    <!-- Mailbox Managers -->
    <bean class="org.apache.james.container.spring.bean.factorypostprocessor.MailboxConfigurationBeanFactoryPostProcessor"/>

    <bean id="locker" class="org.apache.james.mailbox.store.JVMMailboxPathLocker"/>

    <!-- Mailbox Copier -->
    <bean id="mailboxcopier" class="org.apache.james.mailbox.copier.MailboxCopierImpl"/>

    <!-- Mailbox Importer -->
    <!--
       <bean id="james23importer" class="org.apache.james.container.spring.tool.James23Importer"/>
    -->
    <!-- 
    ===========================================================================
       Database DataSource
    ===========================================================================
    -->

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="location" value="classpath:james-database.properties"/>
    </bean>

    <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${database.driverClassName}"/>
        <property name="url" value="${database.url}"/>
        <property name="username" value="${database.username}"/>
        <property name="password" value="${<PASSWORD>.password}"/>
        <!--The value for maxActive should always be larger than the number of spooler threads. The-->
        <!--reason is that a spooler thread normally requires 1 connection to process a mail, however-->
        <!--sometimes OpenJPA requires 1 connection to finish the processing on top of that. If-->
        <!--    maxActive <= num spooler threads,--><commit_msg>Readd the authenticator removed by error for POP3/IMAP4 authentication (JAMES-1504)<commit_after><?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:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <!-- 
    ===========================================================================
       Spring Wiring for James Server: Annotation, Bean Post-Processors...
    ===========================================================================
    -->

    <!-- Enable Java Annotations processing. -->
    <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor">
        <property name="order" value="3"/>
    </bean>

    <!-- Enable support for Persistence Annotations processing. -->
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>

    <import resource="classpath:META-INF/spring/loaders-context.xml"/>

    <!-- 
    ===========================================================================
       Authenticator
    ===========================================================================
    -->

    <import resource="classpath:META-INF/org/apache/james/spring-mailbox-authenticator.xml"/>

    <!-- 
    ===========================================================================
       Queues
    ===========================================================================
    -->

    <!-- 
      Alternative queue is FileMailQueueFactory - Can be used instead of the default one.
    <import resource="classpath:META-INF/spring/file-queue-context.xml"/>
     -->

    <!-- Default Mail Queue Factory is the ActiveMQMailQueueFactory -->
    <import resource="classpath:META-INF/spring/activemq-queue-context.xml"/>

    <!-- Mailet Container -->
    <import resource="classpath:META-INF/spring/mailetcontainer-context.xml"/>

    <!-- Camel Context -->
    <camel:camelContext id="jamesCamelContext" trace="false">
        <camel:jmxAgent id="agent" disabled="false" createConnector="false" serviceUrlPath="/jmxrmi/jamescamel"/>
    </camel:camelContext>

    <!-- DNS Service -->
    <import resource="classpath:META-INF/spring/dns-context.xml"/>

    <!-- FetchMail -->
    <import resource="classpath:META-INF/spring/fetchmail-context.xml"/>

    <!--
    ===========================================================================
       Mail Protocol Servers
    ===========================================================================
    -->

    <!-- SMTP Server -->
    <import resource="classpath:META-INF/spring/smtpserver-context.xml"/>

    <!-- LMTP Server -->
    <import resource="classpath:META-INF/spring/lmtpserver-context.xml"/>

    <!-- POP3 Server -->
    <import resource="classpath:META-INF/spring/pop3server-context.xml"/>

    <!-- IMAP4 Server -->
    <import resource="classpath:META-INF/spring/imapserver-context.xml"/>

    <!-- The imapProcessor configuration will be reviewed when IMAP will be integrated into Protocols project -->
    <!-- Temporary configuration - see IMAP-357 -->
    <bean id="imapProcessor" class="org.apache.james.imap.processor.main.DefaultImapProcessorFactory"
          factory-method="createXListSupportingProcessor">
        <constructor-arg index="0" ref="mailboxmanager"/>
        <constructor-arg index="1" ref="subscriptionManager"/>
        <!-- The mailboxTyper -->
        <constructor-arg index="2" value="#{null}"/>
        <!-- The idleKeepAlive -->
        <constructor-arg index="3" value="120"/>
        <!-- The list of disabled capabilities -->
        <constructor-arg index="4">
            <set>
                <value>ACL</value>
                <value>MOVE</value>
            </set>
        </constructor-arg>
    </bean>

    <bean id="imapDecoderFactory" class="org.apache.james.imap.main.DefaultImapDecoderFactory"/>
    <bean id="imapDecoder" factory-bean="imapDecoderFactory" factory-method="buildImapDecoder"/>

    <bean id="imapEncoderFactory" class="org.apache.james.imap.encode.main.DefaultImapEncoderFactory"/>
    <bean id="imapEncoder" factory-bean="imapEncoderFactory" factory-method="buildImapEncoder"/>

    <!--
    ===========================================================================
       Mailbox
    ===========================================================================
    -->

    <!-- Mailbox Managers -->
    <bean class="org.apache.james.container.spring.bean.factorypostprocessor.MailboxConfigurationBeanFactoryPostProcessor"/>

    <bean id="locker" class="org.apache.james.mailbox.store.JVMMailboxPathLocker"/>

    <import resource="classpath:META-INF/spring/spring-mailbox.xml"/>

    <!-- Mailbox Copier -->
    <bean id="mailboxcopier" class="org.apache.james.mailbox.copier.MailboxCopierImpl"/>

    <!-- Mailbox Importer -->
    <!--
       <bean id="james23importer" class="org.apache.james.container.spring.tool.James23Importer"/>
    -->
    <!-- 
    ===========================================================================
       Database DataSource
    ===========================================================================
    -->

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
        <property name="location" value="classpath:james-database.properties"/>
    </bean>

    <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${database.driverClassName}"/>
        <property name="url" value="${database.url}"/>
        <property name="username" value="${database.username}"/>
        <property name="password" value="${database.password}"/>
        <!--The value for maxActive should always be larger than the number of spooler threads. The-->
        <!--reason is that a spooler thread normally requires 1 connection to process a mail, however-->
        <!--sometimes OpenJPA requires 1 connection to finish the processing on top of that. If-->
        <!--    maxActive <= num spooler threads,-->
{'fraction_non_alphanumeric': 0.24802184720957915, 'fraction_numerical': 0.005041663749037182, 'mean_word_length': 3.635507951963648, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 2, '>': 171, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 31}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2373644', 'n_tokens_mistral': 3758, 'n_tokens_neox': 3495, 'n_words': 766}