Class FitnessDataSource

java.lang.Object
java.lang.Thread
yearreview.app.data.sources.DataSource
yearreview.app.data.sources.fitness.FitnessDataSource
All Implemented Interfaces:
Runnable

public class FitnessDataSource extends DataSource
A DataSource that loads the Fitness Data exported from services like Strava using adapters.
Author:
ColdStone37
  • Field Details

    • adapters

      private List<FitnessAdapter> adapters
      List of adapters to use for loading data.
    • database

      private FitnessDatabase database
      Database to store the activities in.
    • logger

      private static final Logger logger
  • Constructor Details

    • FitnessDataSource

      public FitnessDataSource(XmlNode c)
      Constructs a FitnessDataSource using a configuration.
      Parameters:
      c - configuration of the DataSource
  • Method Details

    • parseConfig

      public void parseConfig(XmlNode config)
      Parses the configuration and initializes the adapters.
      Specified by:
      parseConfig in class DataSource
      Parameters:
      config - configuration to parse
    • loadData

      public void loadData(Instant start, Instant end) throws IOException
      Loads the data from the adapters.
      Specified by:
      loadData in class DataSource
      Parameters:
      start - start time for Activities to consider
      end - end time for Activities to consider
      Throws:
      IOException - if some files cannot be loaded
    • getTopListAdapter

      public TopListAdapter getTopListAdapter()
      Gets a TopListAdapter for the Database that allows for creation of TopLists using the TopListGenerator.
      Returns:
      Adapter to create TopLists from the Database