Class LoginTracker

  • All Implemented Interfaces:
    Tracker

    public class LoginTracker
    extends AbstractTracker
    Class for tracking when the users log into their accounts.
    Author:
    dbutano
    • Constructor Detail

      • LoginTracker

        protected LoginTracker​(java.sql.Connection conn,
                               java.util.Queue<Track> trackQueue)
        Build a login tracker
        Parameters:
        conn - connection to the database
        trackQueue - the queue where the tracks are temporary stored
    • Method Detail

      • getInstance

        public static LoginTracker getInstance​(java.sql.Connection con,
                                               java.util.Queue<Track> trackQueue)
        Return an instance of the LoginTracker
        Parameters:
        con - connection to the database
        trackQueue - the queue where the tracks are temporary stored
        Returns:
        LoginTracker the login tracker
      • getName

        public java.lang.String getName()
        Return the tracker's name
        Specified by:
        getName in interface Tracker
        Specified by:
        getName in class AbstractTracker
        Returns:
        String tracker's name
      • getStatementCreatingTable

        public java.lang.String getStatementCreatingTable()
        Generate the sql statement to create the table used by the tracker
        Specified by:
        getStatementCreatingTable in class AbstractTracker
        Returns:
        String sql statement
      • trackLogin

        protected void trackLogin​(java.lang.String username)
        Track when the user logs in his account
        Parameters:
        username - the user name
      • getUserLogin

        protected java.util.Map<java.lang.String,​java.lang.Integer> getUserLogin​(java.sql.Connection con)
        Return the number of access for each user
        Parameters:
        con - the connection
        Returns:
        map with key the user name and access number