diff --git a/config/alfresco/audit-services-context.xml b/config/alfresco/audit-services-context.xml
index 96ab0a584e..2b889fa114 100644
--- a/config/alfresco/audit-services-context.xml
+++ b/config/alfresco/audit-services-context.xml
@@ -21,8 +21,8 @@
-
-
+
+
@@ -66,22 +66,5 @@
-
-
-
-
- org.alfresco.repo.audit.AuditDAO
-
-
-
-
-
-
-
-
-
- ${server.transaction.mode.default}, PROPAGATION_REQUIRES_NEW
-
-
-
+
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/audit/AuditComponentImpl.java b/source/java/org/alfresco/repo/audit/AuditComponentImpl.java
index 4b2b946002..3060830b70 100644
--- a/source/java/org/alfresco/repo/audit/AuditComponentImpl.java
+++ b/source/java/org/alfresco/repo/audit/AuditComponentImpl.java
@@ -35,6 +35,7 @@ import org.alfresco.repo.audit.model.AuditEntry;
import org.alfresco.repo.audit.model.TrueFalseUnset;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
+import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.Auditable;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.PublicService;
@@ -43,13 +44,14 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchParameters;
+import org.alfresco.service.transaction.TransactionService;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- * The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment these filters are ignired. TODO: Respect audit internal - at the
- * moment audit internal is fixed to false.
+ * The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment
+ * these filters are ignired. TODO: Respect audit internal - at the moment audit internal is fixed to false.
*
* @author Andy Hind
*/
@@ -79,7 +81,7 @@ public class AuditComponentImpl implements AuditComponent
private AuditDAO auditDAO;
- private AuditDAO auditFailedDAO;
+ private TransactionService transactionService;
private AuditModel auditModel;
@@ -91,7 +93,6 @@ public class AuditComponentImpl implements AuditComponent
/**
* Default constructor
- *
*/
public AuditComponentImpl()
{
@@ -113,7 +114,8 @@ public class AuditComponentImpl implements AuditComponent
/**
* Set the DAO for recording auditable information when no exception occurs.
- * @param auditDAO
+ *
+ * @param auditDAO
*/
public void setAuditDAO(AuditDAO auditDAO)
{
@@ -122,11 +124,12 @@ public class AuditComponentImpl implements AuditComponent
/**
* Set the DAO for recording failed actions - this is done in another transaction.
+ *
* @param auditFailedDAO
*/
- public void setAuditFailedDAO(AuditDAO auditFailedDAO)
+ public void setTransactionService(TransactionService transactionService)
{
- this.auditFailedDAO = auditFailedDAO;
+ this.transactionService = transactionService;
}
/**
@@ -141,6 +144,7 @@ public class AuditComponentImpl implements AuditComponent
/**
* Set the helper used to identify public services
+ *
* @param publicServiceIdentifier
*/
public void setPublicServiceIdentifier(PublicServiceIdentifier publicServiceIdentifier)
@@ -148,8 +152,9 @@ public class AuditComponentImpl implements AuditComponent
this.publicServiceIdentifier = publicServiceIdentifier;
}
- /**
+ /**
* Set the audit model.
+ *
* @param auditModel
*/
public void setAuditModel(AuditModel auditModel)
@@ -161,7 +166,7 @@ public class AuditComponentImpl implements AuditComponent
{
if ((auditFlag.get() == null) || (!auditFlag.get().booleanValue()))
{
- if (auditModel instanceof AuditEntry && ((AuditEntry)auditModel).getEnabled() == TrueFalseUnset.TRUE)
+ if (auditModel instanceof AuditEntry && ((AuditEntry) auditModel).getEnabled() == TrueFalseUnset.TRUE)
{
boolean auditInternal = (auditModel.getAuditInternalServiceMethods(mi) == TrueFalseUnset.TRUE);
try
@@ -217,8 +222,7 @@ public class AuditComponentImpl implements AuditComponent
{
s_logger.debug("Unannotated service method " + serviceName + "." + methodName);
}
- if (method.getDeclaringClass().isInterface()
- && method.getDeclaringClass().isAnnotationPresent(PublicService.class))
+ if (method.getDeclaringClass().isInterface() && method.getDeclaringClass().isAnnotationPresent(PublicService.class))
{
throw new RuntimeException("Unannotated service method " + serviceName + "." + methodName);
}
@@ -249,13 +253,16 @@ public class AuditComponentImpl implements AuditComponent
/**
* Internal audit of a method invocation
- * @param mi - the method to audit
+ *
+ * @param mi -
+ * the method to audit
* @return - the return object from the audited method
- * @throws Throwable - any Throwable that can be thrown by th audtied method.
+ * @throws Throwable -
+ * any Throwable that can be thrown by th audtied method.
*/
public Object auditImpl(MethodInvocation mi) throws Throwable
{
- AuditState auditInfo = new AuditState(auditConfiguration);
+ final AuditState auditInfo = new AuditState(auditConfiguration);
// RecordOptions recordOptions = auditModel.getAuditRecordOptions(mi);
AuditMode auditMode = AuditMode.UNSET;
try
@@ -265,7 +272,15 @@ public class AuditComponentImpl implements AuditComponent
auditMode = postInvocation(auditMode, auditInfo, mi, o);
if ((auditMode == AuditMode.ALL) || (auditMode == AuditMode.SUCCESS))
{
- auditDAO.audit(auditInfo);
+ RetryingTransactionCallback