<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    
    <!-- Base audit service - non TX -->
    
    <bean id="auditService" class="org.alfresco.repo.audit.AuditServiceImpl">
        <property name="auditComponent">
            <ref bean="auditComponent"/>
        </property>
    </bean>
    
    
    <!-- Audit component -->
    
    <bean id="auditComponent" class="org.alfresco.repo.audit.AuditComponentImpl">
        <property name="publicServiceIdentifier">
            <ref bean="publicServiceIdentifier"/>
        </property>
        <property name="auditDAO">
            <ref bean="auditDAO"/>
        </property>
        <property name="transactionService">
            <ref bean="transactionService"/>
        </property>
        <property name="nodeService">
            <ref bean="nodeService"/>
        </property>
		<property name="namespacePrefixResolver">
            <ref bean="namespaceService"/>
        </property>
        <property name="auditConfiguration">
            <ref bean="auditConfiguration"/>
        </property>
        <property name="auditModel">
            <ref bean="auditModel"/>
        </property>
        <!-- V3.2 specific -->
        <property name="auditModelRegistry" ref="auditModel.modelRegistry"/>
        <property name="propertyValueDAO" ref="propertyValueDAO"/>
    </bean>
    
    <!-- Public service idntifier -->
    
    <bean id="publicServiceIdentifier" class="org.alfresco.repo.audit.PublicServiceIdentifierImpl"/>
    
    <!-- The configuration of the audit model -->
    
    <bean id="auditConfiguration" class="org.alfresco.repo.audit.AuditConfigurationImpl">
        <property name="config">
            <value>classpath:alfresco/auditConfig.xml</value>
        </property>
    </bean>
    
    <!-- The content store in which to store audit information -->
    
    <bean id="auditFileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
        <constructor-arg>
            <value>${dir.auditcontentstore}</value>
        </constructor-arg>
        <property name="applicationEventPublisher">
            <ref bean="applicationEventPublisher"/>
        </property>
    </bean>
    
    <!-- The audit model -->
    
    <bean id="auditModel" class="org.alfresco.repo.audit.model.AuditEntry">
        <property name="auditConfiguration">
            <ref bean="auditConfiguration"/>
        </property>
        <property name="namespacePrefixResolver">
            <ref bean="namespaceService"/>
        </property>
         <property name="publicServiceIdentifier">
            <ref bean="publicServiceIdentifier"/>
        </property>
    </bean>
    
    <!--                           -->
    <!-- Audit V3.2 implementation -->
    <!--                           -->
    
    <!-- Data extractors -->
    <bean id="auditModel.extractorRegistry" class="org.alfresco.util.registry.NamedObjectRegistry">
        <property name="storageType" value="org.alfresco.repo.audit.extractor.DataExtractor" />
    </bean>
    <bean name="auditModel.extractor.simpleValue" class="org.alfresco.repo.audit.extractor.SimpleValueDataExtractor">
        <property name="registry" ref="auditModel.extractorRegistry" />
    </bean>
    <bean name="auditModel.extractor.nullValue" class="org.alfresco.repo.audit.extractor.NullValueDataExtractor">
        <property name="registry" ref="auditModel.extractorRegistry" />
    </bean>
    <bean name="auditModel.extractor.nodeName" class="org.alfresco.repo.audit.extractor.NodeNameDataExtractor">
        <property name="registry" ref="auditModel.extractorRegistry" />
        <property name="nodeService" ref="nodeService" />
    </bean>
    <bean name="auditModel.extractor.nodeType" class="org.alfresco.repo.audit.extractor.NodeTypeDataExtractor">
        <property name="registry" ref="auditModel.extractorRegistry" />
        <property name="nodeService" ref="nodeService" />
    </bean>
    
    <!-- Data Generators -->
    <bean id="auditModel.generatorRegistry" class="org.alfresco.util.registry.NamedObjectRegistry">
        <property name="storageType" value="org.alfresco.repo.audit.generator.DataGenerator" />
    </bean>
    <bean name="auditModel.generator.time" class="org.alfresco.repo.audit.generator.SystemTimeDataGenerator">
        <property name="registry" ref="auditModel.generatorRegistry" />
    </bean>
    <bean name="auditModel.generator.user" class="org.alfresco.repo.audit.generator.AuthenticatedUserDataGenerator">
        <property name="registry" ref="auditModel.generatorRegistry" />
    </bean>
    <bean name="auditModel.generator.personFullName" class="org.alfresco.repo.audit.generator.AuthenticatedPersonDataGenerator">
        <property name="registry" ref="auditModel.generatorRegistry" />
        <property name="personService" ref="personService" />
        <property name="nodeService" ref="nodeService" />
    </bean>

    <!-- Reference in the audit registry managed bean -->
    <alias name="Audit" alias="auditModel.modelRegistry"/>
      
</beans>