Class SeverityLevelCounter

  • All Implemented Interfaces:
    AuditListener, java.util.EventListener

    public final class SeverityLevelCounter
    extends java.lang.Object
    implements AuditListener
    An audit listener that counts how many AuditEvents of a given severity have been generated.
    • Constructor Detail

      • SeverityLevelCounter

        public SeverityLevelCounter​(SeverityLevel level)
        Creates a new counter.
        Parameters:
        level - the severity level events need to have, must be non-null.
        Throws:
        java.lang.IllegalArgumentException - when level is null
    • Method Detail

      • addError

        public void addError​(AuditEvent event)
        Description copied from interface: AuditListener
        Notify that an audit error was discovered on a specific file.
        Specified by:
        addError in interface AuditListener
        Parameters:
        event - the event details
      • addException

        public void addException​(AuditEvent event,
                                 java.lang.Throwable throwable)
        Description copied from interface: AuditListener
        Notify that an exception happened while performing audit.
        Specified by:
        addException in interface AuditListener
        Parameters:
        event - the event details
        throwable - details of the exception
      • auditStarted

        public void auditStarted​(AuditEvent event)
        Description copied from interface: AuditListener
        Notify that the audit is about to start.
        Specified by:
        auditStarted in interface AuditListener
        Parameters:
        event - the event details
      • fileStarted

        public void fileStarted​(AuditEvent event)
        Description copied from interface: AuditListener
        Notify that audit is about to start on a specific file.
        Specified by:
        fileStarted in interface AuditListener
        Parameters:
        event - the event details
      • auditFinished

        public void auditFinished​(AuditEvent event)
        Description copied from interface: AuditListener
        Notify that the audit is finished.
        Specified by:
        auditFinished in interface AuditListener
        Parameters:
        event - the event details
      • fileFinished

        public void fileFinished​(AuditEvent event)
        Description copied from interface: AuditListener
        Notify that audit is finished on a specific file.
        Specified by:
        fileFinished in interface AuditListener
        Parameters:
        event - the event details
      • getCount

        public int getCount()
        Returns the number of counted events since audit started.
        Returns:
        the number of counted events since audit started.