Class AbstractTracker

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractTracker​(java.util.Queue<Track> trackQueue, java.lang.String trackTableName)
      Construct a Tracker setting the tracks queue and the table name
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void createTrackerTable​(java.sql.Connection connection)
      Create the table where the tracker saves data
      abstract java.lang.String getName()
      Return the tracker's name
      abstract java.lang.String getStatementCreatingTable()
      Generate the sql statement to create the table used by the tracker
      java.lang.String getTrackTableName()
      Return the table's name associated to the tracker
      protected void releaseResources​(java.sql.ResultSet rs, java.sql.Statement stm)
      Close the result set and statement objects specified in input
      void setTrackQueue​(java.util.Queue<Track> trackQueue)
      Set the queue of tracks
      void storeTrack​(Track track)
      Save into the table the track object representing the user activity
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • trackQueue

        protected java.util.Queue<Track> trackQueue
      • trackTableName

        protected java.lang.String trackTableName
    • Constructor Detail

      • AbstractTracker

        protected AbstractTracker​(java.util.Queue<Track> trackQueue,
                                  java.lang.String trackTableName)
        Construct a Tracker setting the tracks queue and the table name
        Parameters:
        trackQueue - the queue where the tracks are temporary stored
        trackTableName - the table where store the tracks
    • Method Detail

      • getTrackTableName

        public java.lang.String getTrackTableName()
        Return the table's name associated to the tracker
        Returns:
        String table's name
      • createTrackerTable

        public void createTrackerTable​(java.sql.Connection connection)
                                throws java.lang.Exception
        Create the table where the tracker saves data
        Specified by:
        createTrackerTable in interface Tracker
        Parameters:
        connection - the userprofile connection
        Throws:
        java.lang.Exception - when a database error access is verified
      • storeTrack

        public void storeTrack​(Track track)
        Save into the table the track object representing the user activity
        Specified by:
        storeTrack in interface Tracker
        Parameters:
        track - the object saved into the database
      • getName

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

        public void setTrackQueue​(java.util.Queue<Track> trackQueue)
        Set the queue of tracks
        Parameters:
        trackQueue - the queue to set
      • getStatementCreatingTable

        public abstract java.lang.String getStatementCreatingTable()
        Generate the sql statement to create the table used by the tracker
        Returns:
        String sql statement
      • releaseResources

        protected void releaseResources​(java.sql.ResultSet rs,
                                        java.sql.Statement stm)
        Close the result set and statement objects specified in input
        Parameters:
        rs - the ResultSet object to close
        stm - the STatement object to close