AtomClientConfigService

public interface AtomClientConfigService

Service interface used to read settings from the atom-client.default.properties and atom-client-feeds.json files

Methods

getFeedConfigs

FeedConfigs getFeedConfigs()

Returns the set of atom feeds to fetch from

Returns:a FeedConfigs POJO with a getFeeds method that returns a Set of FeedConfig objects

getFetchCron

String getFetchCron()

Returns the current fetch job cron expression

Returns:a string containing the cron expression

getRegexForFeedUrl

String getRegexForFeedUrl(String url)

Returns the content extraction regex for the given feed URL, if any, or returns an empty string.

Parameters:
  • url – the feed URL
Returns:

a regex or an empty string

loadDefaultProperties

void loadDefaultProperties()

Load the module’s default properties (just the fetch job cron for now) from the atom-client-defaults.properties file (or DB, depending on how MOTECH is setup)

loadFeedConfigs

void loadFeedConfigs()

Load the atom feed configurations from the atom-client-feeds.json settings file (or DB, depending on how MOTECH is setup)

readNewFeeds

void readNewFeeds(int currentPage, int recentPage, String feedUrl)

Sets the module’s feed configurations, based on pages that should be consumed.

Parameters:
  • currentPage – last page that is already loaded to module
  • recentPage – recent available page that can be consumed
  • feedUrl – the feed URL

setFeedConfigs

void setFeedConfigs(FeedConfigs feedConfigs)

Sets the module’s feed configurations, this sets the in-memory feeds, and is not persisted

Parameters:
  • feedConfigs – a FeedConfigs object describing the atom feeds to fetch

setFetchCron

void setFetchCron(String fetchCron)

Sets the module fetch job cron, ie: when the atom feeds will be fetched, but does not persist the setting

Parameters:
  • fetchCron – a cron expression that describes how often to fetch, or an empty string which disables automatic fetching