Package org.alfresco.repo.audit.model
Class AuditModelRegistryImpl
java.lang.Object
org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
org.alfresco.repo.audit.model.AuditModelRegistryImpl
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA class encapsulating the disposable/resettable state of the audit model registry.Nested classes/interfaces inherited from class org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
AbstractPropertyBackedBean.DefaultResolver, AbstractPropertyBackedBean.RuntimeState -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the strict loading flag.static final StringThe name of the global enablement property.Fields inherited from class org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
DEFAULT_INSTANCE_NAME, lock, runtimeStateFields inherited from interface org.alfresco.repo.audit.model.AuditModelRegistry
AUDIT_PROPERTY_AUDIT_ENABLED, AUDIT_RESERVED_KEY_SYSTEMTIME, AUDIT_RESERVED_KEY_USERNAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected PropertyBackedBeanStateCreates the initial state.Get the application model for the given root key (as defined on the application)getAuditApplicationByName(String applicationName) Get the application model for the given application nameGet a map of all audit applications key by nameGet the path mapper.booleanDetermines whether audit is globally enabled or disabled.voidMethod to load audit models into memory.voidregisterModel(URL auditModelUrl) Enables audit and registers an audit model at a given URL.voidsetAuditDAO(AuditDAO auditDAO) Set the DAO used to persisted the registered audit models.voidsetDataExtractors(org.alfresco.util.registry.NamedObjectRegistry<DataExtractor> dataExtractors) Set the registry ofdata extractors.voidsetDataGenerators(org.alfresco.util.registry.NamedObjectRegistry<DataGenerator> dataGenerators) Set the registry ofdata generators.voidsetSearchPath(String[] searchPath) Sets the search path for config files.voidsetTransactionService(TransactionService transactionService) Service to ensure DAO calls are transactionally wrapped.static AuditunmarshallModel(URL configUrl) Unmarshalls the Audit model from the URL.Methods inherited from class org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
applyDefaultOverrides, destroy, destroy, doInit, getCategory, getDescription, getEncryptedPropertyDefaults, getId, getInstancePath, getParent, getProperty, getPropertyDefaults, getPropertyNames, getRegistry, getState, init, isUpdateable, onApplicationEvent, performEarlyPropertyChecks, removeProperties, removeProperty, resolveDefault, revert, setApplicationContext, setAutoStart, setBeanName, setCategory, setEarlyPropertyCheckers, setEncryptedPropertyDefaults, setInstancePath, setProperties, setProperty, setPropertyDefaults, setRegistry, setSaveSetProperty, start, start, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Field Details
-
PROPERTY_AUDIT_ENABLED
The name of the global enablement property.- See Also:
-
PROPERTY_AUDIT_CONFIG_STRICT
The name of the strict loading flag.- See Also:
-
-
Constructor Details
-
AuditModelRegistryImpl
public AuditModelRegistryImpl()Default constructor.
-
-
Method Details
-
setSearchPath
Sets the search path for config files. -
setTransactionService
Service to ensure DAO calls are transactionally wrapped. -
setAuditDAO
Set the DAO used to persisted the registered audit models. -
setDataExtractors
public void setDataExtractors(org.alfresco.util.registry.NamedObjectRegistry<DataExtractor> dataExtractors) Set the registry ofdata extractors. -
setDataGenerators
public void setDataGenerators(org.alfresco.util.registry.NamedObjectRegistry<DataGenerator> dataGenerators) Set the registry ofdata generators. -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classAbstractPropertyBackedBean- Throws:
Exception
-
getAuditApplications
Get a map of all audit applications key by name- Specified by:
getAuditApplicationsin interfaceAuditModelRegistry- Returns:
- the audit applications
-
getAuditApplicationByKey
Get the application model for the given root key (as defined on the application)- Specified by:
getAuditApplicationByKeyin interfaceAuditModelRegistry- Parameters:
key- the key defined on the application- Returns:
- the java model (null if not found)
-
getAuditApplicationByName
Get the application model for the given application name- Specified by:
getAuditApplicationByNamein interfaceAuditModelRegistry- Parameters:
applicationName- the name of the audited application- Returns:
- the java model (null if not found)
-
getAuditPathMapper
Get the path mapper.- Specified by:
getAuditPathMapperin interfaceAuditModelRegistry- 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:
loadAuditModelsin interfaceAuditModelRegistry
-
isAuditEnabled
public boolean isAuditEnabled()Determines whether audit is globally enabled or disabled.- Specified by:
isAuditEnabledin interfaceAuditModelRegistry- Returns:
trueif audit is enabled
-
registerModel
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
-
createInitialState
Creates the initial state.- Specified by:
createInitialStatein classAbstractPropertyBackedBean- Returns:
- the property backed bean state
- Throws:
IOException- Signals that an I/O exception has occurred.
-
unmarshallModel
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
-