org.alfresco.repo.audit.model
Class AuditModelRegistryImpl

java.lang.Object
  extended by org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
      extended by org.alfresco.repo.audit.model.AuditModelRegistryImpl
All Implemented Interfaces:
java.util.EventListener, AuditModelRegistry, PropertyBackedBean, PropertyBackedBeanState, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

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

Nested Class Summary
 class AuditModelRegistryImpl.AuditModelRegistryState
          A 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
 
Field Summary
static java.lang.String PROPERTY_AUDIT_CONFIG_STRICT
          The name of the strict loading flag.
static java.lang.String PROPERTY_AUDIT_ENABLED
          The name of the global enablement property.
 
Fields inherited from class org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
DEFAULT_INSTANCE_NAME, lock
 
Fields inherited from interface org.alfresco.repo.audit.model.AuditModelRegistry
AUDIT_PROPERTY_AUDIT_ENABLED, AUDIT_RESERVED_KEY_SYSTEMTIME, AUDIT_RESERVED_KEY_USERNAME
 
Constructor Summary
AuditModelRegistryImpl()
          Default constructor.
 
Method Summary
 void afterPropertiesSet()
          
protected  PropertyBackedBeanState createInitialState()
          Creates the initial state.
 AuditApplication getAuditApplicationByKey(java.lang.String key)
          Get the application model for the given root key (as defined on the application)
 AuditApplication getAuditApplicationByName(java.lang.String applicationName)
          Get the application model for the given application name
 java.util.Map getAuditApplications()
          Get a map of all audit applications key by name
 org.alfresco.util.PathMapper getAuditPathMapper()
          Get the path mapper.
 boolean isAuditEnabled()
          Determines whether audit is globally enabled or disabled.
 void loadAuditModels()
          Method to load audit models into memory.
 void registerModel(java.net.URL auditModelUrl)
          Enables audit and registers an audit model at a given URL.
 void setAuditDAO(AuditDAO auditDAO)
          Set the DAO used to persisted the registered audit models.
 void setDataExtractors(org.alfresco.util.registry.NamedObjectRegistry dataExtractors)
          Set the registry of data extractors.
 void setDataGenerators(org.alfresco.util.registry.NamedObjectRegistry dataGenerators)
          Set the registry of data generators.
 void setSearchPath(java.lang.String[] searchPath)
          Sets the search path for config files.
 void setTransactionService(TransactionService transactionService)
          Service to ensure DAO calls are transactionally wrapped.
static Audit unmarshallModel(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, getId, getInstancePath, getParent, getProperty, getPropertyDefaults, getPropertyNames, getRegistry, getState, init, isUpdateable, onApplicationEvent, resolveDefault, revert, setApplicationContext, setAutoStart, setBeanName, setCategory, setInstancePath, setProperties, setProperty, setPropertyDefaults, setRegistry, start, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 dataExtractors)
Set the registry of data extractors.


setDataGenerators

public void setDataGenerators(org.alfresco.util.registry.NamedObjectRegistry 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

getAuditApplications

public java.util.Map getAuditApplications()
Get a map of all audit applications key by name

Specified by:
getAuditApplications in interface AuditModelRegistry
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:
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

createInitialState

protected PropertyBackedBeanState createInitialState()
                                              throws java.io.IOException
Creates the initial state.

Specified by:
createInitialState in class AbstractPropertyBackedBean
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


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.