Class LocalDataSource

java.lang.Object
org.owasp.dependencycheck.data.update.LocalDataSource
All Implemented Interfaces:
CachedWebDataSource
Direct Known Subclasses:
HostedSuppressionsDataSource, RetireJSDataSource

public abstract class LocalDataSource extends Object implements CachedWebDataSource
Author:
Jeremy Long
  • Constructor Details

    • LocalDataSource

      public LocalDataSource()
  • Method Details

    • saveLastUpdated

      protected void saveLastUpdated(@NonNull File repo)
      Saves the timestamp in a properties file adjacent to the provided repo file
      Parameters:
      repo - the local file data source
    • getLastUpdated

      protected Instant getLastUpdated(@NonNull File repo)
      Retrieves the last updated date from the local file system (in a file next to the repo file).
      Parameters:
      repo - the local file data source
      Returns:
      the instant of the last updated date/time
    • isStale

      protected boolean isStale(@NonNull File repo, @NonNull Duration validFor)
      Determines if we should update the local data source.
      Parameters:
      repo - the local file data source
      validFor - the duration for which the local data source should be considered valid
      Returns:
      true if an update to the data source should be performed; otherwise false. If the repo does not exist, or is an empty file, it is considered stale.