Class AuditModelRegistryImpl

  • All Implemented Interfaces:
    java.util.EventListener, AuditModelRegistry, PropertyBackedBean, PropertyBackedBeanState, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

    public class AuditModelRegistryImpl
    extends AbstractPropertyBackedBean
    implements AuditModelRegistry
    Component used to store audit model definitions. It ensures that duplicate application and converter definitions are detected and provides a single lookup for code using the Audit model. It is factored as a subsystem and exposes a global enablement property plus enablement properties for each individual audit application.
    Since:
    3.2
    Author:
    Derek Hulley, dward
    • Field Detail

      • PROPERTY_AUDIT_ENABLED

        public static final java.lang.String PROPERTY_AUDIT_ENABLED
        The name of the global enablement property.
        See Also:
        Constant Field Values
      • PROPERTY_AUDIT_CONFIG_STRICT

        public static final java.lang.String PROPERTY_AUDIT_CONFIG_STRICT
        The name of the strict loading flag.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AuditModelRegistryImpl

        public AuditModelRegistryImpl()
        Default constructor.
    • Method Detail

      • setSearchPath

        public void setSearchPath​(java.lang.String[] searchPath)
        Sets the search path for config files.
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
        Service to ensure DAO calls are transactionally wrapped.
      • setAuditDAO

        public void setAuditDAO​(AuditDAO auditDAO)
        Set the DAO used to persisted the registered audit models.
      • setDataExtractors

        public void setDataExtractors​(org.alfresco.util.registry.NamedObjectRegistry<DataExtractor> dataExtractors)
        Set the registry of data extractors.
      • setDataGenerators

        public void setDataGenerators​(org.alfresco.util.registry.NamedObjectRegistry<DataGenerator> dataGenerators)
        Set the registry of data generators.
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class AbstractPropertyBackedBean
        Throws:
        java.lang.Exception
      • getAuditApplicationByKey

        public AuditApplication getAuditApplicationByKey​(java.lang.String key)
        Get the application model for the given root key (as defined on the application)
        Specified by:
        getAuditApplicationByKey in interface AuditModelRegistry
        Parameters:
        key - the key defined on the application
        Returns:
        the java model (null if not found)
      • getAuditApplicationByName

        public AuditApplication getAuditApplicationByName​(java.lang.String applicationName)
        Get the application model for the given application name
        Specified by:
        getAuditApplicationByName in interface AuditModelRegistry
        Parameters:
        applicationName - the name of the audited application
        Returns:
        the java model (null if not found)
      • getAuditPathMapper

        public org.alfresco.util.PathMapper getAuditPathMapper()
        Get the path mapper.
        Specified by:
        getAuditPathMapper in interface AuditModelRegistry
        Returns:
        the path mapper
      • loadAuditModels

        public void loadAuditModels()
        Method to load audit models into memory. This method is also responsible for persisting the audit models for later retrieval.

        Note, the models are loaded in a new transaction, so this method can be called by any code at any time.

        Specified by:
        loadAuditModels in interface AuditModelRegistry
      • isAuditEnabled

        public boolean isAuditEnabled()
        Determines whether audit is globally enabled or disabled.
        Specified by:
        isAuditEnabled in interface AuditModelRegistry
        Returns:
        true if audit is enabled
      • registerModel

        public void registerModel​(java.net.URL auditModelUrl)
        Enables audit and registers an audit model at a given URL. Does not register across the cluster and should only be used for unit test purposes.
        Parameters:
        auditModelUrl - the source of the model
      • unmarshallModel

        public static Audit unmarshallModel​(java.net.URL configUrl)
        Unmarshalls the Audit model from the URL.
        Parameters:
        configUrl - the config url
        Returns:
        the audit model
        Throws:
        org.alfresco.error.AlfrescoRuntimeException - if an IOException occurs