Class AuditManagerImpl
- java.lang.Object
-
- org.jivesoftware.openfire.container.BasicModule
-
- org.jivesoftware.openfire.audit.spi.AuditManagerImpl
-
- All Implemented Interfaces:
AuditManager
,Module
,PropertyEventListener
public class AuditManagerImpl extends BasicModule implements AuditManager, PropertyEventListener
Implementation of the AuditManager interface.
-
-
Field Summary
-
Fields inherited from interface org.jivesoftware.openfire.audit.AuditManager
PRESENCE_AVAILABLE_AVAILABLE, PRESENCE_AVAILABLE_UNAVAILABLE, PRESENCE_UNAVAILABLE_AVAILABLE, PRESENCE_UNAVAILABLE_UNAVAILABLE
-
-
Constructor Summary
Constructors Constructor Description AuditManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addXPath(String xpathExpression)
Adds an XPath expression to be used for filtering packets to be audited.Auditor
getAuditor()
Factory method for creating auditors that are configured by this audit manager.Collection<String>
getIgnoreList()
Returns the list of usernames that won't be audited.String
getLogDir()
Returns the absolute path to the directory where the audit log files will be saved.Duration
getLogTimeout()
Returns the time between successive executions of the task that will save the queued audited packets to a permanent store.int
getMaxFileSize()
Obtain the maximum size of audit log files in megabytes.int
getMaxTotalSize()
Returns the maximum size in megabytes that all audit log files may have.Duration
getRetention()
Returns the maximum duration to keep audit information.Iterator<String>
getXPathFilters()
Obtain an iterator over the XPath expressions (Strings) currently registered with the audit manager.void
initialize(XMPPServer server)
Initializes the basic module.boolean
isAuditIQ()
Determines if the server will audit all iq packets.boolean
isAuditMessage()
Determines if the server will audit all message packets.boolean
isAuditPresence()
Determines if the server will audit all presence packets.boolean
isAuditXPath()
Determines if the server will audit packets using XPath expressions.boolean
isEnabled()
Determines if auditing is enabled at all.void
propertyDeleted(String property, Map<String,Object> params)
A property was deleted.void
propertySet(String property, Map<String,Object> params)
A property was set.void
removeXPath(String xpathExpression)
Removes the XPath expression from the set being used for filtering packets to be audited.void
setAuditIQ(boolean auditIQ)
Enables or disables the server auditing of all iq packets.void
setAuditMessage(boolean auditMessage)
Enables or disables the server auditing of all message packets.void
setAuditPresence(boolean auditPresence)
Enables or disables the server auditing of all presence packets.void
setAuditXPath(boolean auditXPath)
Enables/disables server auditing of packets using XPath expressions.void
setEnabled(boolean enabled)
Turns auditing off or on for the manager as a whole.void
setIgnoreList(Collection<String> usernames)
Sets the list of usernames that won't be audited.void
setLogDir(String logDir)
Sets the absolute path to the directory where the audit log files will be saved.void
setLogTimeout(Duration logTimeout)
Sets the time between successive executions of the task that will save the queued audited packets to a permanent store.void
setMaxFileSize(int size)
Set the maximum size of audit log files in megabytes.void
setMaxTotalSize(int size)
Sets the maximum size in megabytes that all audit log files may have.void
setRetention(Duration duration)
Set the duration to keep audit information.void
stop()
Stops the basic module.void
xmlPropertyDeleted(String property, Map<String,Object> params)
An XML property was deleted.void
xmlPropertySet(String property, Map<String,Object> params)
An XML property was set.-
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName, start
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Description copied from interface:AuditManager
Determines if auditing is enabled at all.- Specified by:
isEnabled
in interfaceAuditManager
- Returns:
- true if auditing is enabled, false indicates no auditing will occur
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:AuditManager
Turns auditing off or on for the manager as a whole.- Specified by:
setEnabled
in interfaceAuditManager
- Parameters:
enabled
- true if auditing is enabled, false indicates no auditing will occur.
-
getAuditor
public Auditor getAuditor()
Description copied from interface:AuditManager
Factory method for creating auditors that are configured by this audit manager.- Specified by:
getAuditor
in interfaceAuditManager
- Returns:
- a new auditor that will obey the configuration of the audit manager.
-
getMaxTotalSize
public int getMaxTotalSize()
Description copied from interface:AuditManager
Returns the maximum size in megabytes that all audit log files may have. When the limit is reached oldest audit log files will be removed until total size is under the limit.- Specified by:
getMaxTotalSize
in interfaceAuditManager
- Returns:
- the maximum size of all audit logs in megabytes.
-
setMaxTotalSize
public void setMaxTotalSize(int size)
Description copied from interface:AuditManager
Sets the maximum size in megabytes that all audit log files may have. When the limit is reached oldest audit log files will be removed until total size is under the limit.- Specified by:
setMaxTotalSize
in interfaceAuditManager
- Parameters:
size
- the maximum size of all audit logs in megabytes.
-
getMaxFileSize
public int getMaxFileSize()
Description copied from interface:AuditManager
Obtain the maximum size of audit log files in megabytes. Logs that exceed the max size will be rolled over to another file.- Specified by:
getMaxFileSize
in interfaceAuditManager
- Returns:
- the maximum size of an audit log in megabytes.
-
setMaxFileSize
public void setMaxFileSize(int size)
Description copied from interface:AuditManager
Set the maximum size of audit log files in megabytes.- Specified by:
setMaxFileSize
in interfaceAuditManager
- Parameters:
size
- the maximum audit log file size in megabytes.
-
getRetention
public Duration getRetention()
Description copied from interface:AuditManager
Returns the maximum duration to keep audit information. Once the limit has been reached audit files that contain information that exceed the limit will be deleted.- Specified by:
getRetention
in interfaceAuditManager
- Returns:
- the maximum duration to keep audit information, negative value for unlimited.
-
setRetention
public void setRetention(Duration duration)
Description copied from interface:AuditManager
Set the duration to keep audit information. Once the limit has been reached audit files that contain information that exceed the limit will be deleted.- Specified by:
setRetention
in interfaceAuditManager
- Parameters:
duration
- the maximum duration to keep audit information or a negative value for unlimited
-
getLogTimeout
public Duration getLogTimeout()
Description copied from interface:AuditManager
Returns the time between successive executions of the task that will save the queued audited packets to a permanent store.- Specified by:
getLogTimeout
in interfaceAuditManager
- Returns:
- the time between successive executions of the task that will save the queued audited packets to a permanent store.
-
setLogTimeout
public void setLogTimeout(Duration logTimeout)
Description copied from interface:AuditManager
Sets the time between successive executions of the task that will save the queued audited packets to a permanent store.- Specified by:
setLogTimeout
in interfaceAuditManager
- Parameters:
logTimeout
- the time between successive executions of the task that will save the queued audited packets to a permanent store.
-
getLogDir
public String getLogDir()
Description copied from interface:AuditManager
Returns the absolute path to the directory where the audit log files will be saved.- Specified by:
getLogDir
in interfaceAuditManager
- Returns:
- the absolute path to the directory where the audit log files will be saved.
-
setLogDir
public void setLogDir(String logDir)
Description copied from interface:AuditManager
Sets the absolute path to the directory where the audit log files will be saved.- Specified by:
setLogDir
in interfaceAuditManager
- Parameters:
logDir
- the absolute path to the directory where the audit log files will be saved.
-
isAuditMessage
public boolean isAuditMessage()
Description copied from interface:AuditManager
Determines if the server will audit all message packets.
This is a speed optimization and convenience for logging all message packets rather than using an XPath expression.
- Specified by:
isAuditMessage
in interfaceAuditManager
- Returns:
- true if all messages are to be audited
-
setAuditMessage
public void setAuditMessage(boolean auditMessage)
Description copied from interface:AuditManager
Enables or disables the server auditing of all message packets.
This is a speed optimization and convenience for logging all message packets rather than using an XPath expression.
- Specified by:
setAuditMessage
in interfaceAuditManager
- Parameters:
auditMessage
- True if all messages are to be audited
-
isAuditPresence
public boolean isAuditPresence()
Description copied from interface:AuditManager
Determines if the server will audit all presence packets.
This is a speed optimization and convenience for logging all presence packets rather than using an XPath expression.
- Specified by:
isAuditPresence
in interfaceAuditManager
- Returns:
- True if all presence are to be audited
-
setAuditPresence
public void setAuditPresence(boolean auditPresence)
Description copied from interface:AuditManager
Enables or disables the server auditing of all presence packets.
This is a speed optimization and convenience for logging all presence packets rather than using an XPath expression.
- Specified by:
setAuditPresence
in interfaceAuditManager
- Parameters:
auditPresence
- True if all presence are to be audited
-
isAuditIQ
public boolean isAuditIQ()
Description copied from interface:AuditManager
Determines if the server will audit all iq packets.
This is a speed optimization and convenience for logging all iq packets rather than using an XPath expression.
- Specified by:
isAuditIQ
in interfaceAuditManager
- Returns:
- True if all iq are to be audited
-
setAuditIQ
public void setAuditIQ(boolean auditIQ)
Description copied from interface:AuditManager
Enables or disables the server auditing of all iq packets. This is a speed optimization and convenience for logging all iq packets rather than using an XPath expression.- Specified by:
setAuditIQ
in interfaceAuditManager
- Parameters:
auditIQ
- true if all iq are to be audited.
-
isAuditXPath
public boolean isAuditXPath()
Description copied from interface:AuditManager
Determines if the server will audit packets using XPath expressions. XPath expressions provide a lot of power in specifying what is logged. However, it is much more compute intensive than other techniques and requires all packets be transformed into DOM objects (which can be computationally expensive).- Specified by:
isAuditXPath
in interfaceAuditManager
- Returns:
- true if XPath expressions should be audited.
-
setAuditXPath
public void setAuditXPath(boolean auditXPath)
Description copied from interface:AuditManager
Enables/disables server auditing of packets using XPath expressions.
XPath expressions provide a lot of power in specifying what is logged. However, it is much more compute intensive than other techniques and requires all packets be transformed into DOM objects (which can be computationally expensive).
- Specified by:
setAuditXPath
in interfaceAuditManager
- Parameters:
auditXPath
- true if XPath expressions should be audited
-
addXPath
public void addXPath(String xpathExpression)
Description copied from interface:AuditManager
Adds an XPath expression to be used for filtering packets to be audited. XPath expressions aren't evaluated or used for filtering unless isAuditXPath() returns true.- Specified by:
addXPath
in interfaceAuditManager
- Parameters:
xpathExpression
- the xpath expression to add to the list of auditing filters.
-
removeXPath
public void removeXPath(String xpathExpression)
Description copied from interface:AuditManager
Removes the XPath expression from the set being used for filtering packets to be audited.
XPath expressions aren't evaluated or used for filtering unless isAuditXPath() returns true.
- Specified by:
removeXPath
in interfaceAuditManager
- Parameters:
xpathExpression
- The xpath expression to remove from the list of auditing filters
-
getXPathFilters
public Iterator<String> getXPathFilters()
Description copied from interface:AuditManager
Obtain an iterator over the XPath expressions (Strings) currently registered with the audit manager.
XPath expressions aren't evaluated or used for filtering unless isAuditXPath() returns true.
- Specified by:
getXPathFilters
in interfaceAuditManager
- Returns:
- An iterator of all XPath expressions the audit manager is using
-
setIgnoreList
public void setIgnoreList(Collection<String> usernames)
Description copied from interface:AuditManager
Sets the list of usernames that won't be audited. Packets sent or received by any of these users will be ignored by the auditor.- Specified by:
setIgnoreList
in interfaceAuditManager
- Parameters:
usernames
- the list of usernames that won't be audited.
-
getIgnoreList
public Collection<String> getIgnoreList()
Description copied from interface:AuditManager
Returns the list of usernames that won't be audited. Packets sent or received by any of these users will be ignored by the auditor.- Specified by:
getIgnoreList
in interfaceAuditManager
- Returns:
- the list of usernames that won't be audited.
-
initialize
public void initialize(XMPPServer server)
Description copied from class:BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initialize
in interfaceModule
- Overrides:
initialize
in classBasicModule
- Parameters:
server
- the server hosting this module.
-
stop
public void stop()
Description copied from class:BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
- Specified by:
stop
in interfaceModule
- Overrides:
stop
in classBasicModule
-
propertySet
public void propertySet(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListener
A property was set. The parameter mapparams
will contain the the value of the property under the keyvalue
.- Specified by:
propertySet
in interfacePropertyEventListener
- Parameters:
property
- the name of the property.params
- event parameters.
-
propertyDeleted
public void propertyDeleted(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListener
A property was deleted.- Specified by:
propertyDeleted
in interfacePropertyEventListener
- Parameters:
property
- the name of the property deleted.params
- event parameters.
-
xmlPropertySet
public void xmlPropertySet(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListener
An XML property was set. The parameter mapparams
will contain the the value of the property under the keyvalue
.- Specified by:
xmlPropertySet
in interfacePropertyEventListener
- Parameters:
property
- the name of the property.params
- event parameters.
-
xmlPropertyDeleted
public void xmlPropertyDeleted(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListener
An XML property was deleted.- Specified by:
xmlPropertyDeleted
in interfacePropertyEventListener
- Parameters:
property
- the name of the property.params
- event parameters.
-
-