AuditComponent implementation and fallout

- alf_prop_string_value now includes a CRC column and handles Oracle empty string issues
 - All property values are/must now be Serializable for auditing
 - Pushing data into audit is working


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15915 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-08-26 06:01:52 +00:00
parent 1bba527f56
commit ef67ac777a
29 changed files with 767 additions and 118 deletions

View File

@@ -179,6 +179,25 @@ public class AuditApplication
}
}
/**
* Compile a path or part of a path into a single string which always starts with the
* {@link #AUDIT_PATH_SEPARATOR}. This can be a relative path so need not always start with
* the application root key.
*
* @param pathElements the elements of the path e.g. <code>"a", "b", "c"</code>.
* @return Returns the compiled path e.g <code>"/a/b/c"</code>.
*/
public String buildPath(String ... pathComponents)
{
StringBuilder sb = new StringBuilder(pathComponents.length * 10);
for (String pathComponent : pathComponents)
{
sb.append(AUDIT_PATH_SEPARATOR).append(pathComponent);
}
// Done
return sb.toString();
}
/**
* Get all data extractors applicable to a given path and scope.
*
@@ -325,6 +344,11 @@ public class AuditApplication
}
// All the extractors apply to the current path
dataExtractors.put(currentPath, upperExtractorsByPath);
// // Data extractors only apply directly to data in which they appear.
// // TODO: Examine this assumption. If it is not true, i.e. data extractors apply to
// // data anywhere down the hierarchy, then the followin line of code should be
// // removed and the use-cases tested appropriately.
// upperExtractorsByPath.clear();
// Get the data generators declared for this key
for (GenerateValue element : auditPath.getGenerateValue())

View File

@@ -73,14 +73,17 @@ import org.xml.sax.SAXParseException;
public class AuditModelRegistry
{
public static final String AUDIT_SCHEMA_LOCATION = "classpath:alfresco/audit/alfresco-audit-3.2.xsd";
public static final String AUDIT_RESERVED_KEY_USERNAME = "username";
public static final String AUDIT_RESERVED_KEY_SYSTEMTIME = "systemTime";
private static final Log logger = LogFactory.getLog(AuditModelRegistry.class);
private TransactionService transactionService;
private AuditDAO auditDAO;
private static final Log logger = LogFactory.getLog(AuditModelRegistry.class);
private final ReentrantReadWriteLock.ReadLock readLock;
private final ReentrantReadWriteLock.WriteLock writeLock;
private final ObjectFactory objectFactory;
private final Set<URL> auditModelUrls;
private final List<Audit> auditModels;
@@ -104,6 +107,8 @@ public class AuditModelRegistry
readLock = lock.readLock();
writeLock = lock.writeLock();
objectFactory = new ObjectFactory();
auditModelUrls = new HashSet<URL>(7);
auditModels = new ArrayList<Audit>(7);
dataExtractorsByName = new HashMap<String, DataExtractor>(13);
@@ -239,15 +244,15 @@ public class AuditModelRegistry
/**
* Get the ID of the persisted audit model for the given application name
*
* @param application the name of the audited application
* @param applicationName the name of the audited application
* @return the unique ID of the persisted model (<tt>null</tt> if not found)
*/
public Long getAuditModelId(String application)
public Long getAuditModelId(String applicationName)
{
readLock.lock();
try
{
return auditModelIdsByApplicationsName.get(application);
return auditModelIdsByApplicationsName.get(applicationName);
}
finally
{
@@ -258,15 +263,15 @@ public class AuditModelRegistry
/**
* Get the application model for the given application name
*
* @param application the name of the audited application
* @param applicationName the name of the audited application
* @return the java model (<tt>null</tt> if not found)
*/
public AuditApplication getAuditApplication(String application)
public AuditApplication getAuditApplication(String applicationName)
{
readLock.lock();
try
{
return auditApplicationsByName.get(application);
return auditApplicationsByName.get(applicationName);
}
finally
{
@@ -364,7 +369,7 @@ public class AuditModelRegistry
DataExtractors extractorsElement = audit.getDataExtractors();
if (extractorsElement == null)
{
extractorsElement = new ObjectFactory().createDataExtractors();
extractorsElement = objectFactory.createDataExtractors();
}
List<org.alfresco.repo.audit.model._3.DataExtractor> converterElements = extractorsElement.getDataExtractor();
for (org.alfresco.repo.audit.model._3.DataExtractor converterElement : converterElements)
@@ -404,7 +409,7 @@ public class AuditModelRegistry
DataGenerators generatorsElement = audit.getDataGenerators();
if (generatorsElement == null)
{
generatorsElement = new ObjectFactory().createDataGenerators();
generatorsElement = objectFactory.createDataGenerators();
}
List<org.alfresco.repo.audit.model._3.DataGenerator> generatorElements = generatorsElement.getDataGenerator();
for (org.alfresco.repo.audit.model._3.DataGenerator generatorElement : generatorElements)