Commit 4ce1b94c authored by Michael Ritter's avatar Michael Ritter
Browse files

Rename auto.audit.disable to auto.audit.enable

parent be92cc92
......@@ -190,10 +190,11 @@ public final class AuditConfigurationContext implements ServletContextListener {
PauseBean pb = new PauseBean();
ctx.setAttribute(ATTRIBUTE_PAUSE, pb);
q.setParameter("attr", SettingsConstants.PARAM_DISABLE_AUTO_AUDIT);
q.setParameter("attr", SettingsConstants.PARAM_AUTO_AUDIT_ENABLE);
s = (SettingsParameter) q.getSingleResult();
String startPaused = s.getValue();
pb.setPaused(Boolean.valueOf(startPaused));
// Invert the boolean because the PB checks if we're paused, not enabled
String enableAudits = s.getValue();
pb.setPaused(!Boolean.valueOf(enableAudits));
q.setParameter("attr", SettingsConstants.PARAM_THROTTLE_MAXAUDIT);
s = (SettingsParameter) q.getSingleResult();
......
......@@ -14,7 +14,7 @@ public class SettingsConstants {
public static final String PARAM_IMS_PORT = "ims.port";
public static final String PARAM_IMS_TOKEN_CLASS = "ims.tokenclass";
public static final String PARAM_IMS_SSL = "ims.ssl";
public static final String PARAM_DISABLE_AUTO_AUDIT = "auto.audit.disable";
public static final String PARAM_AUTO_AUDIT_ENABLE = "auto.audit.enable";
public static final String PARAM_THROTTLE_MAXAUDIT = "throttle.maxaudit";
public static final String PARAM_TIME = "throttle.wait";
public static final String PARAM_BPS = "throttle.bps";
......
......@@ -65,8 +65,7 @@ public class SettingsMigrationContextListener implements ServletContextListener{
}
if (!newTable) {
//LOG.info("SQL patch to 1.7+ has not been installed, table 'settings' does no exist, shutting down!");
throw new IllegalStateException("SQL patch to 1.7+ has not been installed, table 'settings' does no exist");
throw new IllegalStateException("SQL patch to 1.7+ has not been installed, table 'settings' does not exist");
}
// Find out if there are any elements in the table
......
......@@ -20,7 +20,12 @@ import java.util.Set;
*/
public class SettingsUtil {
// Get an item by its attribute name
/**
* Retrieve a Setting based off it's attribute name
*
* @param attr the attribute to query on
* @return the Setting associated with the attribute
*/
public static SettingsParameter getItemByAttr( String attr ) {
EntityManager em = PersistUtil.getEntityManager();
Query q = em.createNamedQuery("SettingsParameter.getAttr");
......@@ -35,7 +40,11 @@ public class SettingsUtil {
return null;
}
// Return a list of all custom settings
/**
* Get a list of all custom settings
*
* @return custom settings
*/
public static List<SettingsParameter> getCustomSettings() {
EntityManager em = PersistUtil.getEntityManager();
Query q = em.createNamedQuery("SettingsParameter.getCustomSettings");
......@@ -43,7 +52,11 @@ public class SettingsUtil {
return q.getResultList();
}
// Return a list of all settings
/**
* Get a list of all settings
*
* @return all settings
*/
public static List<SettingsParameter> getCurrentSettings() {
EntityManager em = PersistUtil.getEntityManager();
Query q = em.createNamedQuery("SettingsParameter.getCurrentSettings");
......@@ -51,7 +64,11 @@ public class SettingsUtil {
return q.getResultList();
}
// Update settings based on their name and value, and add new settings
/**
* Update a given List of settings
*
* @param settings the settings to update
*/
public static void updateSettings(List<SettingsParameter> settings) {
EntityManager em = PersistUtil.getEntityManager();
EntityTransaction trans = em.getTransaction();
......@@ -82,6 +99,11 @@ public class SettingsUtil {
reloadSettings();
}
/**
* Delete a given List of settings
*
* @param settings the settings to delete
*/
public static void deleteSettings(List<String> settings) {
EntityManager em = PersistUtil.getEntityManager();
EntityTransaction trans = em.getTransaction();
......@@ -114,6 +136,11 @@ public class SettingsUtil {
}
/**
* Get the default values for all settings
*
* @return the default settings
*/
public static List<SettingsParameter> getDefaultSettings() {
List<SettingsParameter> defaults = new ArrayList<>();
......@@ -125,7 +152,7 @@ public class SettingsUtil {
SettingsConstants.imsSSL,false));
defaults.add(new SettingsParameter(SettingsConstants.PARAM_IMS_TOKEN_CLASS,
SettingsConstants.imsTokenClass,false));
defaults.add(new SettingsParameter(SettingsConstants.PARAM_DISABLE_AUTO_AUDIT,
defaults.add(new SettingsParameter(SettingsConstants.PARAM_AUTO_AUDIT_ENABLE,
SettingsConstants.autoAudit,false));
defaults.add(new SettingsParameter(SettingsConstants.PARAM_THROTTLE_MAXAUDIT,
SettingsConstants.maxAudit,false));
......
......@@ -2,6 +2,8 @@
Document : settings
Created on : Jul 30, 2012, 4:07:16 PM
Author : shake
TODO: Enable sampling when we have it properly implemented
TODO: The Settings should come from a bean or smth so we can loop similar to the custom settings
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
......@@ -37,13 +39,6 @@
<div class="settingsVal"><input type=text name="throttle.maxaudit" value="${currSettings['throttle.maxaudit']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Max number of running audits"></div>
</div>
<!-- TODO: Get proper sampling in the future
<div class="settingsRow">
<div class="settingsName">Audit Sampling:</div>
<div class="settingsVal"><input type=text name="audit.sample" value="${currSettings['audit.sample']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Enable or disable statistical sampling while auditing (samples sqrt n files)"></div>
</div>
-->
<div class="settingsRow">
<div class="settingsName">Audit IMS Blocking:</div>
<div class="settingsVal"><input type=text name="audit.blocking" value="${currSettings['audit.blocking']}"/></div>
......@@ -65,9 +60,9 @@
<div class="settingsHelp"><img src="images/help.png" title="Maximum bytes per second per running audit, default = 0 = unlimited"></div>
</div>
<div class="settingsRow">
<div class="settingsName">Disable Auto Audit:</div>
<div class="settingsVal"><input type=text name="auto.audit.disable" value="${currSettings['auto.audit.disable']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Disable automated auditing"></div>
<div class="settingsName">Enable Auto Audit:</div>
<div class="settingsVal"><input type=text name="auto.audit.enable" value="${currSettings['auto.audit.enable']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Enable automated auditing"></div>
</div>
<div class="settingsRow">
<div class="settingsName">Audit Only Mode:</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment