Class CheckResourceLoader


  • public class CheckResourceLoader
    extends java.lang.Object
    Loads Checks found on the classpath. Checks are discovered by scanning a list of configurable classpath URLs for implementations of a specific type, which also configurable. Enabled checks found are instantiated and added to the Set of returned checks. Configuration:
     {
       "CheckResourceLoader": {
         "scanUrls": [
             "org.openstreetmap.atlas.checks"
         ],
         "type": "org.openstreetmap.atlas.checks.base.Check",
         "enabled": {
             "key.template": "%s.enabled",
             "value.default": false
         }
       }
     }
     
    • Constructor Summary

      Constructors 
      Constructor Description
      CheckResourceLoader​(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.openstreetmap.atlas.utilities.configuration.Configuration getConfiguration()  
      org.openstreetmap.atlas.utilities.configuration.Configuration getConfigurationForCountry​(java.lang.String country)
      Get configuration for a specific country, overriding for country specific overrides and group specific overrides
      <T extends Check>
      java.util.Set<T>
      loadChecks()
      Loads checks that are enabled by configuration
      <T extends Check>
      java.util.Set<T>
      loadChecks​(java.util.function.Predicate<java.lang.Class> isEnabled)  
      <T extends Check>
      java.util.Set<T>
      loadChecks​(java.util.function.Predicate<java.lang.Class> isEnabled, org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
      Loads checks that are enabled by some other means, defined by isEnabled
      <T extends Check>
      java.util.Set<T>
      loadChecks​(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)  
      <T extends Check>
      java.util.Set<T>
      loadChecksForCountry​(java.lang.String country)  
      • Methods inherited from class java.lang.Object

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

      • CheckResourceLoader

        public CheckResourceLoader​(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
        Default constructor
        Parameters:
        configuration - the Configuration for loaded checks
    • Method Detail

      • getConfiguration

        public org.openstreetmap.atlas.utilities.configuration.Configuration getConfiguration()
      • getConfigurationForCountry

        public org.openstreetmap.atlas.utilities.configuration.Configuration getConfigurationForCountry​(java.lang.String country)
        Get configuration for a specific country, overriding for country specific overrides and group specific overrides
        Parameters:
        country - country string
        Returns:
        Configuration
      • loadChecks

        public <T extends Check> java.util.Set<T> loadChecks​(java.util.function.Predicate<java.lang.Class> isEnabled)
      • loadChecks

        public <T extends Check> java.util.Set<T> loadChecks​(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
      • loadChecks

        public <T extends Check> java.util.Set<T> loadChecks​(java.util.function.Predicate<java.lang.Class> isEnabled,
                                                             org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
        Loads checks that are enabled by some other means, defined by isEnabled
        Type Parameters:
        T - check type
        Parameters:
        isEnabled - Predicate used to determine if a check is enabled
        configuration - Configuration used to loadChecks CheckResourceLoader
        Returns:
        a Set of checks
      • loadChecks

        public <T extends Check> java.util.Set<T> loadChecks()
        Loads checks that are enabled by configuration
        Type Parameters:
        T - check type
        Returns:
        a Set of checks
      • loadChecksForCountry

        public <T extends Check> java.util.Set<T> loadChecksForCountry​(java.lang.String country)