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:
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAuditModelRegistryImpl.AuditModelRegistryStateA 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
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_AUDIT_CONFIG_STRICTThe name of the strict loading flag.static java.lang.StringPROPERTY_AUDIT_ENABLEDThe name of the global enablement property.-
Fields inherited from class org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
DEFAULT_INSTANCE_NAME, lock, runtimeState
-
Fields inherited from interface org.alfresco.repo.audit.model.AuditModelRegistry
AUDIT_PROPERTY_AUDIT_ENABLED, AUDIT_RESERVED_KEY_SYSTEMTIME, AUDIT_RESERVED_KEY_USERNAME
-
-
Constructor Summary
Constructors Constructor Description AuditModelRegistryImpl()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected PropertyBackedBeanStatecreateInitialState()Creates the initial state.AuditApplicationgetAuditApplicationByKey(java.lang.String key)Get the application model for the given root key (as defined on the application)AuditApplicationgetAuditApplicationByName(java.lang.String applicationName)Get the application model for the given application namejava.util.Map<java.lang.String,AuditApplication>getAuditApplications()Get a map of all audit applications key by nameorg.alfresco.util.PathMappergetAuditPathMapper()Get the path mapper.booleanisAuditEnabled()Determines whether audit is globally enabled or disabled.voidloadAuditModels()Method to load audit models into memory.voidregisterModel(java.net.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(java.lang.String[] searchPath)Sets the search path for config files.voidsetTransactionService(TransactionService transactionService)Service to ensure DAO calls are transactionally wrapped.static AuditunmarshallModel(java.net.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, stop
-
-
-
-
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
-
-
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 ofdata extractors.
-
setDataGenerators
public void setDataGenerators(org.alfresco.util.registry.NamedObjectRegistry<DataGenerator> dataGenerators)
Set the registry ofdata generators.
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classAbstractPropertyBackedBean- Throws:
java.lang.Exception
-
getAuditApplications
public java.util.Map<java.lang.String,AuditApplication> getAuditApplications()
Get a map of all audit applications key by name- Specified by:
getAuditApplicationsin interfaceAuditModelRegistry- Returns:
- the audit applications
-
getAuditApplicationByKey
public AuditApplication getAuditApplicationByKey(java.lang.String key)
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
public AuditApplication getAuditApplicationByName(java.lang.String applicationName)
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
public org.alfresco.util.PathMapper 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
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
-
createInitialState
protected PropertyBackedBeanState createInitialState() throws java.io.IOException
Creates the initial state.- Specified by:
createInitialStatein classAbstractPropertyBackedBean- Returns:
- the property backed bean state
- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
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
-
-