Audit and Prop table enhancements

- alf_prop_xxx tables
   - Added alf_prop_root table
   - alf_prop_value_xxx tables enforce uniqueness
   - Better splitting up of Collections and Maps (attempt to use exact storage type)
   - Moved some indexes around to reduce size but maintain index data lookups
   - Allow updates and deletes of properties via alf_prop_root (entry-point table)
 - Audit Application
   - Unique by name
   - Add 'disabled paths' to control audit behaviour (not wired into services)
   - Added concurrency checks for updates to the Audit Application (model change, etc)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16217 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-11 13:59:45 +00:00
parent de1e940d73
commit 29b94cf0d7
23 changed files with 1496 additions and 653 deletions

View File

@@ -55,6 +55,7 @@ import org.alfresco.repo.audit.model._3.DataExtractors;
import org.alfresco.repo.audit.model._3.DataGenerators;
import org.alfresco.repo.audit.model._3.ObjectFactory;
import org.alfresco.repo.domain.audit.AuditDAO;
import org.alfresco.repo.domain.audit.AuditDAO.AuditApplicationInfo;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.transaction.TransactionService;
@@ -99,6 +100,10 @@ public class AuditModelRegistry
* Used to lookup a reference to the application
*/
private final Map<String, Long> auditApplicationIdsByApplicationsName;
/**
* Used to lookup application disabled paths
*/
private final Map<String, Set<String>> auditDisabledPathsByApplicationsName;
/**
* Default constructor
@@ -115,6 +120,7 @@ public class AuditModelRegistry
auditModels = new ArrayList<Audit>(7);
auditApplicationsByName = new HashMap<String, AuditApplication>(7);
auditApplicationIdsByApplicationsName = new HashMap<String, Long>(7);
auditDisabledPathsByApplicationsName = new HashMap<String, Set<String>>(7);
}
/**
@@ -246,8 +252,8 @@ public class AuditModelRegistry
clearCaches();
throw new AuditModelException(
"Failed to load audit model: " + auditModelUrl + "\n" +
e.getMessage());
"Failed to load audit model: " + auditModelUrl,
e);
}
}
// NOTE: If we support other types of loading, then that will have to go here, too
@@ -308,6 +314,25 @@ public class AuditModelRegistry
}
}
/**
* Get all disabled paths for the given application name
*
* @param applicationName the name of the audited application
* @return a set of paths for which logging is disabled
*/
public Set<String> getAuditDisabledPaths(String applicationName)
{
readLock.lock();
try
{
return auditDisabledPathsByApplicationsName.get(applicationName);
}
finally
{
readLock.unlock();
}
}
/**
* Unmarshalls the Audit model from the URL.
*
@@ -516,11 +541,21 @@ public class AuditModelRegistry
}
// Get the ID of the application
Long appId = auditDAO.getOrCreateAuditApplication(auditModelId, name);
AuditApplicationInfo appInfo = auditDAO.getAuditApplication(name);
if (appInfo == null)
{
appInfo = auditDAO.createAuditApplication(name, auditModelId);
}
else
{
// Update it with the new model ID
auditDAO.updateAuditApplicationModel(appInfo.getId(), auditModelId);
}
AuditApplication wrapperApp = new AuditApplication(dataExtractorsByName, dataGeneratorsByName, application);
auditApplicationsByName.put(name, wrapperApp);
auditApplicationIdsByApplicationsName.put(name, appId);
auditApplicationIdsByApplicationsName.put(name, appInfo.getId());
auditDisabledPathsByApplicationsName.put(name, appInfo.getDisabledPaths());
}
// Store the model itself
auditModels.add(audit);