<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:beans="http://www.springframework.org/schema/beans"
             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <beans:beans profile="extension-foia">
        <!-- FOIA Request Broker -->
        <beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQSslConnectionFactory">
            <beans:property name="brokerURL"
                            value="#{foiaRequestBrokerConfig.url}?jms.blobTransferPolicy.uploadUrl=#{foiaRequestBrokerConfig.fileUploadUrl}"/>
            <beans:property name="keyStore" value="#{foiaRequestBrokerConfig.keystore}"/>
            <beans:property name="keyStorePassword" value="#{foiaRequestBrokerConfig.keystorePassword}"/>
            <beans:property name="trustStore" value="#{foiaRequestBrokerConfig.truststore}"/>
            <beans:property name="trustStorePassword" value="#{foiaRequestBrokerConfig.truststorePassword}"/>
            <beans:property name="userName" value="#{foiaRequestBrokerConfig.userName}"/>
            <beans:property name="password" value="#{foiaRequestBrokerConfig.password}"/>
        </beans:bean>

        <beans:bean id="portalEntity" class="gov.foia.model.PortalFOIARequest"/>

        <beans:bean id="foiaRequestBrokerClient" class="gov.foia.broker.FOIARequestBrokerClient">
            <beans:constructor-arg index="0" ref="connectionFactory"/>
            <beans:constructor-arg index="1" value="#{foiaRequestBrokerConfig.queuesExternalRequestStatusUpdates}"/>
            <beans:constructor-arg index="2" value="#{foiaRequestBrokerConfig.queuesExternalRequests}"/>
            <beans:property name="createRequestService" ref="portalCreateRequestService"/>
            <beans:property name="maxConcurrentWorkers" value="#{foiaRequestBrokerConfig.maxConcurrentWorkers}"/>
            <beans:property name="maxConcurrentConsumers" value="#{foiaRequestBrokerConfig.maxConcurrentListeners}"/>
            <beans:lookup-method name="getEntity" bean="portalEntity"/>
        </beans:bean>

        <beans:bean id="foiaRequestFileBrokerClient" class="gov.foia.broker.FOIARequestFileBrokerClient">
            <beans:constructor-arg index="0" ref="connectionFactory"/>
            <beans:constructor-arg index="1" value="#{foiaRequestBrokerConfig.queuesExternalRequestFiles}"/>
            <beans:constructor-arg index="2">
                <null/>
            </beans:constructor-arg>
            <beans:property name="fileUploadUrl" value="#{foiaRequestBrokerConfig.fileUploadUrl}"/>
            <beans:property name="caseFileDao" ref="caseFileDao"/>
            <beans:property name="responseFolderCompressorService" ref="responseFolderCompressorService"/>
            <beans:property name="requestResponseFolderService" ref="requestResponseFolderService"/>
        </beans:bean>

        <!-- FOIA Request Update Notifier -->
        <beans:bean id="foiaRequestUpdateNotifier" class="gov.foia.service.FOIARequestUpdateNotifier">
            <beans:property name="brokerClient" ref="foiaRequestBrokerClient"/>
        </beans:bean>
    </beans:beans>

</beans:beans>