mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4106 (ALF-4103): AuditService REST API
- Enable/disable auditing and tests - TODO: Use .ftl to generate JSON from model git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21520 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<bean id="auditComponent" class="org.alfresco.repo.audit.AuditComponentImpl">
|
<bean id="auditComponent" class="org.alfresco.repo.audit.AuditComponentImpl">
|
||||||
<property name="transactionService" ref="transactionService"/>
|
<property name="transactionService" ref="transactionService"/>
|
||||||
<property name="auditDAO" ref="auditDAO"/>
|
<property name="auditDAO" ref="auditDAO"/>
|
||||||
<property name="auditModelRegistry" ref="auditModel.modelRegistry"/>
|
<property name="auditModelRegistry" ref="Audit"/>
|
||||||
<property name="propertyValueDAO" ref="propertyValueDAO"/>
|
<property name="propertyValueDAO" ref="propertyValueDAO"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -35,6 +35,24 @@ import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
|
|||||||
*/
|
*/
|
||||||
public interface AuditComponent
|
public interface AuditComponent
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Determines whether audit is globally enabled or disabled.
|
||||||
|
*
|
||||||
|
* @return Returns <code>true</code> if audit is enabled
|
||||||
|
*
|
||||||
|
* @since 3.3
|
||||||
|
*/
|
||||||
|
public boolean isAuditEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch auditing on or off
|
||||||
|
*
|
||||||
|
* @param enable <tt>true</tt> to enable auditing or <tt>false</tt> to disable
|
||||||
|
*
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public void setAuditEnabled(boolean enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all registered audit applications, whether active or not.
|
* Get all registered audit applications, whether active or not.
|
||||||
*
|
*
|
||||||
@@ -44,15 +62,6 @@ public interface AuditComponent
|
|||||||
*/
|
*/
|
||||||
public Set<String> getAuditApplications();
|
public Set<String> getAuditApplications();
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether audit is globally enabled or disabled.
|
|
||||||
*
|
|
||||||
* @return Returns <code>true</code> if audit is enabled
|
|
||||||
*
|
|
||||||
* @since 3.3
|
|
||||||
*/
|
|
||||||
public boolean isAuditEnabled();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the given source path is mapped to any audit applications. Allows optimizations to be made in
|
* Determines whether the given source path is mapped to any audit applications. Allows optimizations to be made in
|
||||||
* calling components.
|
* calling components.
|
||||||
@@ -81,7 +90,8 @@ public interface AuditComponent
|
|||||||
* data is audited.
|
* data is audited.
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application being logged to
|
* @param applicationName the name of the application being logged to
|
||||||
* @param path the audit path to check
|
* @param path the audit path to check or <tt>null</tt> to assume the
|
||||||
|
* application's root path
|
||||||
* @return Returns <tt>true</tt> if the audit path has been disabled
|
* @return Returns <tt>true</tt> if the audit path has been disabled
|
||||||
*
|
*
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
@@ -97,7 +107,8 @@ public interface AuditComponent
|
|||||||
* If the enabled
|
* If the enabled
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application being logged to
|
* @param applicationName the name of the application being logged to
|
||||||
* @param path the audit path to enable auditing on
|
* @param path the audit path to check or <tt>null</tt> to assume the
|
||||||
|
* application's root path
|
||||||
*
|
*
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
@@ -114,7 +125,8 @@ public interface AuditComponent
|
|||||||
* the root path of the application, then auditing for that application is effectively disabled.
|
* the root path of the application, then auditing for that application is effectively disabled.
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application being logged to
|
* @param applicationName the name of the application being logged to
|
||||||
* @param path the audit path to enable auditing on
|
* @param path the audit path to check or <tt>null</tt> to assume the
|
||||||
|
* application's root path
|
||||||
*
|
*
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
|
@@ -31,6 +31,7 @@ import org.alfresco.repo.audit.extractor.DataExtractor;
|
|||||||
import org.alfresco.repo.audit.generator.DataGenerator;
|
import org.alfresco.repo.audit.generator.DataGenerator;
|
||||||
import org.alfresco.repo.audit.model.AuditApplication;
|
import org.alfresco.repo.audit.model.AuditApplication;
|
||||||
import org.alfresco.repo.audit.model.AuditModelRegistry;
|
import org.alfresco.repo.audit.model.AuditModelRegistry;
|
||||||
|
import org.alfresco.repo.audit.model.AuditModelRegistryImpl;
|
||||||
import org.alfresco.repo.domain.audit.AuditDAO;
|
import org.alfresco.repo.domain.audit.AuditDAO;
|
||||||
import org.alfresco.repo.domain.propval.PropertyValueDAO;
|
import org.alfresco.repo.domain.propval.PropertyValueDAO;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
@@ -60,7 +61,7 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(AuditComponentImpl.class);
|
private static Log logger = LogFactory.getLog(AuditComponentImpl.class);
|
||||||
|
|
||||||
private AuditModelRegistry auditModelRegistry;
|
private AuditModelRegistryImpl auditModelRegistry;
|
||||||
private PropertyValueDAO propertyValueDAO;
|
private PropertyValueDAO propertyValueDAO;
|
||||||
private AuditDAO auditDAO;
|
private AuditDAO auditDAO;
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
@@ -76,7 +77,7 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
* Set the registry holding the audit models
|
* Set the registry holding the audit models
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public void setAuditModelRegistry(AuditModelRegistry auditModelRegistry)
|
public void setAuditModelRegistry(AuditModelRegistryImpl auditModelRegistry)
|
||||||
{
|
{
|
||||||
this.auditModelRegistry = auditModelRegistry;
|
this.auditModelRegistry = auditModelRegistry;
|
||||||
}
|
}
|
||||||
@@ -157,6 +158,34 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public boolean isAuditEnabled()
|
||||||
|
{
|
||||||
|
return auditModelRegistry.isAuditEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setAuditEnabled(boolean enable)
|
||||||
|
{
|
||||||
|
boolean alreadyEnabled = auditModelRegistry.isAuditEnabled();
|
||||||
|
if (alreadyEnabled != enable)
|
||||||
|
{
|
||||||
|
// It is changing
|
||||||
|
auditModelRegistry.stop();
|
||||||
|
auditModelRegistry.setProperty(
|
||||||
|
AuditModelRegistry.AUDIT_PROPERTY_AUDIT_ENABLED,
|
||||||
|
Boolean.toString(enable).toLowerCase());
|
||||||
|
auditModelRegistry.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.4
|
* @since 3.4
|
||||||
@@ -167,15 +196,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
return auditApps.keySet();
|
return auditApps.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
public boolean isAuditEnabled()
|
|
||||||
{
|
|
||||||
return auditModelRegistry.isAuditEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
@@ -192,7 +212,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
public boolean isAuditPathEnabled(String applicationName, String path)
|
public boolean isAuditPathEnabled(String applicationName, String path)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("applicationName", applicationName);
|
ParameterCheck.mandatory("applicationName", applicationName);
|
||||||
ParameterCheck.mandatory("path", path);
|
|
||||||
AlfrescoTransactionSupport.checkTransactionReadState(false);
|
AlfrescoTransactionSupport.checkTransactionReadState(false);
|
||||||
|
|
||||||
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
||||||
@@ -204,8 +223,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check the path against the application
|
// Ensure that the path gets a valid value
|
||||||
application.checkPath(path);
|
if (path == null)
|
||||||
|
{
|
||||||
|
path = AuditApplication.AUDIT_PATH_SEPARATOR + application.getApplicationKey();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check the path against the application
|
||||||
|
application.checkPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
Set<String> disabledPaths = getDisabledPaths(application);
|
Set<String> disabledPaths = getDisabledPaths(application);
|
||||||
|
|
||||||
@@ -238,7 +265,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
public void enableAudit(String applicationName, String path)
|
public void enableAudit(String applicationName, String path)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("applicationName", applicationName);
|
ParameterCheck.mandatory("applicationName", applicationName);
|
||||||
ParameterCheck.mandatory("path", path);
|
|
||||||
AlfrescoTransactionSupport.checkTransactionReadState(true);
|
AlfrescoTransactionSupport.checkTransactionReadState(true);
|
||||||
|
|
||||||
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
||||||
@@ -250,8 +276,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check the path against the application
|
// Ensure that the path gets a valid value
|
||||||
application.checkPath(path);
|
if (path == null)
|
||||||
|
{
|
||||||
|
path = AuditApplication.AUDIT_PATH_SEPARATOR + application.getApplicationKey();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check the path against the application
|
||||||
|
application.checkPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
Long disabledPathsId = application.getDisabledPathsId();
|
Long disabledPathsId = application.getDisabledPathsId();
|
||||||
Set<String> disabledPaths = getDisabledPaths(application);
|
Set<String> disabledPaths = getDisabledPaths(application);
|
||||||
@@ -290,7 +324,6 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
public void disableAudit(String applicationName, String path)
|
public void disableAudit(String applicationName, String path)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("applicationName", applicationName);
|
ParameterCheck.mandatory("applicationName", applicationName);
|
||||||
ParameterCheck.mandatory("path", path);
|
|
||||||
AlfrescoTransactionSupport.checkTransactionReadState(true);
|
AlfrescoTransactionSupport.checkTransactionReadState(true);
|
||||||
|
|
||||||
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
|
||||||
@@ -302,8 +335,16 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check the path against the application
|
// Ensure that the path gets a valid value
|
||||||
application.checkPath(path);
|
if (path == null)
|
||||||
|
{
|
||||||
|
path = AuditApplication.AUDIT_PATH_SEPARATOR + application.getApplicationKey();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check the path against the application
|
||||||
|
application.checkPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
Long disabledPathsId = application.getDisabledPathsId();
|
Long disabledPathsId = application.getDisabledPathsId();
|
||||||
Set<String> disabledPaths = getDisabledPaths(application);
|
Set<String> disabledPaths = getDisabledPaths(application);
|
||||||
|
@@ -455,6 +455,18 @@ public class AuditComponentTest extends TestCase
|
|||||||
result = auditTestAction("action-01", nodeRef, parameters);
|
result = auditTestAction("action-01", nodeRef, parameters);
|
||||||
checkAuditMaps(result, expectedInner);
|
checkAuditMaps(result, expectedInner);
|
||||||
|
|
||||||
|
// Disable using the root of the application by passing a null root
|
||||||
|
auditComponent.disableAudit(APPLICATION_ACTIONS_TEST, null);
|
||||||
|
expectedInner.clear();
|
||||||
|
result = auditTestAction("action-01", nodeRef, parameters);
|
||||||
|
checkAuditMaps(result, expectedInner);
|
||||||
|
|
||||||
|
// Enabling the root using a null root parameter should give back everything
|
||||||
|
auditComponent.enableAudit(APPLICATION_ACTIONS_TEST, null);
|
||||||
|
expectedInner = new HashMap<String, Serializable>(expected);
|
||||||
|
result = auditTestAction("action-01", nodeRef, parameters);
|
||||||
|
checkAuditMaps(result, expectedInner);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -619,7 +631,7 @@ public class AuditComponentTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
auditService.clearAudit(applicationName);
|
auditService.clearAudit(applicationName, null, null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -43,6 +43,25 @@ public class AuditServiceImpl implements AuditService
|
|||||||
this.auditComponent = auditComponent;
|
this.auditComponent = auditComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
public boolean isAuditEnabled()
|
||||||
|
{
|
||||||
|
return auditComponent.isAuditEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setAuditEnabled(boolean enable)
|
||||||
|
{
|
||||||
|
auditComponent.setAuditEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.4
|
* @since 3.4
|
||||||
@@ -53,22 +72,12 @@ public class AuditServiceImpl implements AuditService
|
|||||||
return auditComponent.getAuditApplications();
|
return auditComponent.getAuditApplications();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
* @since 3.4
|
|
||||||
*/
|
|
||||||
public boolean isAuditEnabled()
|
|
||||||
{
|
|
||||||
return auditComponent.isAuditEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public boolean isAuditEnabled(String applicationName, String path)
|
public boolean isAuditEnabled(String applicationName, String path)
|
||||||
{
|
{
|
||||||
// Get the root path for the application
|
|
||||||
return auditComponent.isAuditPathEnabled(applicationName, path);
|
return auditComponent.isAuditPathEnabled(applicationName, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +109,17 @@ public class AuditServiceImpl implements AuditService
|
|||||||
auditComponent.deleteAuditEntries(applicationName, null, now);
|
auditComponent.deleteAuditEntries(applicationName, null, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearAudit(String applicationName, Long fromTime, Long toTime)
|
||||||
|
{
|
||||||
|
toTime = (toTime == null) ? Long.valueOf(System.currentTimeMillis()) : toTime;
|
||||||
|
auditComponent.deleteAuditEntries(applicationName, fromTime, toTime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 3.3
|
* @since 3.3
|
||||||
|
@@ -30,6 +30,10 @@ import org.alfresco.util.PathMapper;
|
|||||||
*/
|
*/
|
||||||
public interface AuditModelRegistry
|
public interface AuditModelRegistry
|
||||||
{
|
{
|
||||||
|
/** The name of the global enablement property. */
|
||||||
|
public static final String AUDIT_PROPERTY_AUDIT_ENABLED = "audit.enabled";
|
||||||
|
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_USERNAME = "username";
|
||||||
public static final String AUDIT_RESERVED_KEY_SYSTEMTIME = "systemTime";
|
public static final String AUDIT_RESERVED_KEY_SYSTEMTIME = "systemTime";
|
||||||
|
|
||||||
|
@@ -77,10 +77,6 @@ import org.xml.sax.SAXParseException;
|
|||||||
*/
|
*/
|
||||||
public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implements AuditModelRegistry
|
public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implements AuditModelRegistry
|
||||||
{
|
{
|
||||||
/** The name of the global enablement property. */
|
|
||||||
private static final String PROPERTY_AUDIT_ENABLED = "audit.enabled";
|
|
||||||
private static final String AUDIT_SCHEMA_LOCATION = "classpath:alfresco/audit/alfresco-audit-3.2.xsd";
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(AuditModelRegistryImpl.class);
|
private static final Log logger = LogFactory.getLog(AuditModelRegistryImpl.class);
|
||||||
|
|
||||||
private String[] searchPath;
|
private String[] searchPath;
|
||||||
@@ -213,7 +209,7 @@ public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implement
|
|||||||
@Override
|
@Override
|
||||||
public boolean isAuditEnabled()
|
public boolean isAuditEnabled()
|
||||||
{
|
{
|
||||||
String value = getProperty(PROPERTY_AUDIT_ENABLED);
|
String value = getProperty(AUDIT_PROPERTY_AUDIT_ENABLED);
|
||||||
return value != null && value.equalsIgnoreCase("true");
|
return value != null && value.equalsIgnoreCase("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +222,7 @@ public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implement
|
|||||||
public synchronized void registerModel(URL auditModelUrl)
|
public synchronized void registerModel(URL auditModelUrl)
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
setProperty(PROPERTY_AUDIT_ENABLED, "true");
|
setProperty(AUDIT_PROPERTY_AUDIT_ENABLED, "true");
|
||||||
getState(false).registerModel(auditModelUrl);
|
getState(false).registerModel(auditModelUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +251,7 @@ public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implement
|
|||||||
properties = new HashMap<String, Boolean>(7);
|
properties = new HashMap<String, Boolean>(7);
|
||||||
|
|
||||||
// Default value for global enabled property
|
// Default value for global enabled property
|
||||||
properties.put(PROPERTY_AUDIT_ENABLED, false);
|
properties.put(AUDIT_PROPERTY_AUDIT_ENABLED, false);
|
||||||
|
|
||||||
// Let's search for config files in the appropriate places. The individual applications they contain can still
|
// Let's search for config files in the appropriate places. The individual applications they contain can still
|
||||||
// be enabled/disabled by the bean properties
|
// be enabled/disabled by the bean properties
|
||||||
@@ -364,7 +360,7 @@ public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implement
|
|||||||
auditPathMapper = new PathMapper();
|
auditPathMapper = new PathMapper();
|
||||||
|
|
||||||
// If we are globally disabled, skip processing the models
|
// If we are globally disabled, skip processing the models
|
||||||
Boolean enabled = properties.get(PROPERTY_AUDIT_ENABLED);
|
Boolean enabled = properties.get(AUDIT_PROPERTY_AUDIT_ENABLED);
|
||||||
if (enabled != null && enabled)
|
if (enabled != null && enabled)
|
||||||
{
|
{
|
||||||
final RetryingTransactionCallback<Void> loadModelsCallback = new RetryingTransactionCallback<Void>()
|
final RetryingTransactionCallback<Void> loadModelsCallback = new RetryingTransactionCallback<Void>()
|
||||||
|
@@ -32,6 +32,22 @@ import org.alfresco.service.PublicService;
|
|||||||
@PublicService
|
@PublicService
|
||||||
public interface AuditService
|
public interface AuditService
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return Returns <tt>true</tt> if auditing is globally enabled
|
||||||
|
*
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
boolean isAuditEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable the global auditing state
|
||||||
|
*
|
||||||
|
* @param enable <tt>true</tt> to enable auditing globally or <tt>false</tt> to disable
|
||||||
|
*
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
void setAuditEnabled(boolean enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all registered audit applications
|
* Get all registered audit applications
|
||||||
*
|
*
|
||||||
@@ -41,13 +57,6 @@ public interface AuditService
|
|||||||
*/
|
*/
|
||||||
Set<String> getAuditApplications();
|
Set<String> getAuditApplications();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns <tt>true</tt> if auditing is globally enabled
|
|
||||||
*
|
|
||||||
* @since 3.4
|
|
||||||
*/
|
|
||||||
boolean isAuditEnabled();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param applicationName the name of the application to check
|
* @param applicationName the name of the application to check
|
||||||
* @param path the path to check
|
* @param path the path to check
|
||||||
@@ -83,9 +92,24 @@ public interface AuditService
|
|||||||
* @param applicationName the name of the application for which to remove entries
|
* @param applicationName the name of the application for which to remove entries
|
||||||
*
|
*
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link #clearAudit(String, Long, Long)}
|
||||||
*/
|
*/
|
||||||
void clearAudit(String applicationName);
|
void clearAudit(String applicationName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove audit entries for the given application between the time ranges. If no start
|
||||||
|
* time is given then entries are deleted as far back as they exist. If no end time is
|
||||||
|
* given then entries are deleted up until the current time.
|
||||||
|
*
|
||||||
|
* @param applicationName the name of the application for which to remove entries
|
||||||
|
* @param fromTime the start time of entries to remove (inclusive and optional)
|
||||||
|
* @param toTime the end time of entries to remove (exclusive and optional)
|
||||||
|
*
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
void clearAudit(String applicationName, Long fromTime, Long toTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface that will be used to give query results to the calling code.
|
* The interface that will be used to give query results to the calling code.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user