Added 'enableAuditPath' and 'disableAuditPath'

- Various tests to see that the recorded data is changed
 - disabledPaths rely entirely on the property caching for fast retrieval


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16271 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-15 10:06:31 +00:00
parent b0aac65e9a
commit 2c33287ea3
9 changed files with 421 additions and 70 deletions

View File

@@ -96,14 +96,6 @@ public class AuditModelRegistry
* Used to lookup the audit application java hierarchy
*/
private final Map<String, AuditApplication> auditApplicationsByName;
/**
* 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
@@ -119,8 +111,6 @@ public class AuditModelRegistry
auditModelUrls = new HashSet<URL>(7);
auditModels = new ArrayList<Audit>(7);
auditApplicationsByName = new HashMap<String, AuditApplication>(7);
auditApplicationIdsByApplicationsName = new HashMap<String, Long>(7);
auditDisabledPathsByApplicationsName = new HashMap<String, Set<String>>(7);
}
/**
@@ -215,7 +205,6 @@ public class AuditModelRegistry
{
auditModels.clear();
auditApplicationsByName.clear();
auditApplicationIdsByApplicationsName.clear();
}
/**
@@ -223,7 +212,8 @@ public class AuditModelRegistry
* the audit models for later retrieval. Models are loaded from the locations given by the
* {@link #registerModel(URL) register} methods.
* <p/>
* Note, the models are loaded in a new transaction.
* Note, the models are loaded in a new transaction, so this method can be called by any code
* at any time.
*/
public void loadAuditModels()
{
@@ -268,7 +258,7 @@ public class AuditModelRegistry
clearCaches();
try
{
transactionService.getRetryingTransactionHelper().doInTransaction(loadModelsCallback);
transactionService.getRetryingTransactionHelper().doInTransaction(loadModelsCallback, false, true);
}
finally
{
@@ -276,25 +266,6 @@ public class AuditModelRegistry
}
}
/**
* Get the ID of the persisted audit application for the given application name
*
* @param applicationName the name of the audited application
* @return the unique ID of the persisted application (<tt>null</tt> if not found)
*/
public Long getAuditApplicationId(String applicationName)
{
readLock.lock();
try
{
return auditApplicationIdsByApplicationsName.get(applicationName);
}
finally
{
readLock.unlock();
}
}
/**
* Get the application model for the given application name
*
@@ -314,25 +285,6 @@ 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.
*
@@ -552,10 +504,13 @@ public class AuditModelRegistry
auditDAO.updateAuditApplicationModel(appInfo.getId(), auditModelId);
}
AuditApplication wrapperApp = new AuditApplication(dataExtractorsByName, dataGeneratorsByName, application);
AuditApplication wrapperApp = new AuditApplication(
dataExtractorsByName,
dataGeneratorsByName,
application,
appInfo.getId(),
appInfo.getDisabledPathsId());
auditApplicationsByName.put(name, wrapperApp);
auditApplicationIdsByApplicationsName.put(name, appInfo.getId());
auditDisabledPathsByApplicationsName.put(name, appInfo.getDisabledPaths());
}
// Store the model itself
auditModels.add(audit);