Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
adapt
ace
Commits
4ce1b94c
Commit
4ce1b94c
authored
Apr 06, 2017
by
Michael Ritter
Browse files
Rename auto.audit.disable to auto.audit.enable
parent
be92cc92
Changes
5
Hide whitespace changes
Inline
Side-by-side
ace-am/src/main/java/edu/umiacs/ace/monitor/audit/AuditConfigurationContext.java
View file @
4ce1b94c
...
...
@@ -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
();
...
...
ace-am/src/main/java/edu/umiacs/ace/monitor/settings/SettingsConstants.java
View file @
4ce1b94c
...
...
@@ -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.
dis
able"
;
public
static
final
String
PARAM_AUTO_AUDIT
_ENABLE
=
"auto.audit.
en
able"
;
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"
;
...
...
ace-am/src/main/java/edu/umiacs/ace/monitor/settings/SettingsMigrationContextListener.java
View file @
4ce1b94c
...
...
@@ -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
...
...
ace-am/src/main/java/edu/umiacs/ace/monitor/settings/SettingsUtil.java
View file @
4ce1b94c
...
...
@@ -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
();
...
...
@@ -60,7 +77,7 @@ public class SettingsUtil {
for
(
SettingsParameter
setting
:
settings
)
{
// Skip any empty settings
if
(
setting
.
getName
().
trim
().
isEmpty
()
||
setting
.
getValue
().
trim
().
isEmpty
()
)
{
setting
.
getValue
().
trim
().
isEmpty
()
)
{
continue
;
}
...
...
@@ -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,7 +136,12 @@ public class SettingsUtil {
}
public
static
List
<
SettingsParameter
>
getDefaultSettings
()
{
/**
* Get the default values for all settings
*
* @return the default settings
*/
public
static
List
<
SettingsParameter
>
getDefaultSettings
()
{
List
<
SettingsParameter
>
defaults
=
new
ArrayList
<>();
defaults
.
add
(
new
SettingsParameter
(
SettingsConstants
.
PARAM_IMS
,
...
...
@@ -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
));
...
...
@@ -173,11 +200,11 @@ public class SettingsUtil {
}
/**
*
* @param c The collection to query
* @param attr The attribute to query for
* @return true if collection, settings are not null and parameter is "true"
*/
*
* @param c The collection to query
* @param attr The attribute to query for
* @return true if collection, settings are not null and parameter is "true"
*/
public
static
boolean
getBoolean
(
Collection
c
,
String
attr
)
{
if
(!
containsKey
(
c
,
attr
))
{
return
false
;
...
...
ace-am/src/main/webapp/settings.jsp
View file @
4ce1b94c
...
...
@@ -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"
>
Dis
able Auto Audit:
</div>
<div
class=
"settingsVal"
><input
type=
text
name=
"auto.audit.
dis
able"
value=
"${currSettings['auto.audit.
dis
able']}"
/></div>
<div
class=
"settingsHelp"
><img
src=
"images/help.png"
title=
"
Dis
able automated auditing"
></div>
<div
class=
"settingsName"
>
En
able Auto Audit:
</div>
<div
class=
"settingsVal"
><input
type=
text
name=
"auto.audit.
en
able"
value=
"${currSettings['auto.audit.
en
able']}"
/></div>
<div
class=
"settingsHelp"
><img
src=
"images/help.png"
title=
"
En
able automated auditing"
></div>
</div>
<div
class=
"settingsRow"
>
<div
class=
"settingsName"
>
Audit Only Mode:
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment