Class ConfigApiServiceImpl

java.lang.Object
org.lockss.spring.base.BaseSpringApiServiceImpl
org.lockss.laaws.config.impl.ConfigApiServiceImpl
All Implemented Interfaces:
ConfigApiDelegate

@Service public class ConfigApiServiceImpl extends BaseSpringApiServiceImpl implements ConfigApiDelegate
Service for accessing the system configuration.
  • Constructor Details

    • ConfigApiServiceImpl

      public ConfigApiServiceImpl()
  • Method Details

    • getSectionConfig

      public org.springframework.http.ResponseEntity getSectionConfig(String sectionName, String ifMatch, String ifModifiedSince, String ifNoneMatch, String ifUnmodifiedSince)
      Provides the configuration file for a section given the section name.
      Specified by:
      getSectionConfig in interface ConfigApiDelegate
      Parameters:
      sectionName - A String with the section name.
      accept - A String with the value of the "Accept" request header.
      ifMatch - A List with the "If-Match" request header, containing an asterisk or values equivalent to the "If-Unmodified-Since" request header but with a granularity of 1 ms.
      ifModifiedSince - A String with "If-Modified-Since" request header.
      ifNoneMatch - A List with the "If-None-Match" request header, containing an asterisk or values equivalent to the "If-Modified-Since" request header but with a granularity of 1 ms.
      ifUnmodifiedSince - A String with the "If-Unmodified-Since" request header.
      Returns:
      a ResponseEntity<MultiValueMap<String, Object>> with the section configuration file contents.
      See Also:
    • getUrlConfig

      public org.springframework.http.ResponseEntity getUrlConfig(String url, String ifMatch, String ifModifiedSince, String ifNoneMatch, String ifUnmodifiedSince)
      Provides the configuration file for a given URL.
      Specified by:
      getUrlConfig in interface ConfigApiDelegate
      Parameters:
      url - A String with the url.
      accept - A String with the value of the "Accept" request header.
      ifMatch - A List with the "If-Match" request header, containing an asterisk or values equivalent to the "If-Unmodified-Since" request header but with a granularity of 1 ms.
      ifModifiedSince - A String with "If-Modified-Since" request header.
      ifNoneMatch - A List with the "If-None-Match" request header, containing an asterisk or values equivalent to the "If-Modified-Since" request header but with a granularity of 1 ms.
      ifUnmodifiedSince - A String with the "If-Unmodified-Since" request header.
      Returns:
      a ResponseEntity<MultiValueMap<String, Object>> with the section configuration file.
      See Also:
    • getLastUpdateTime

      public org.springframework.http.ResponseEntity<OffsetDateTime> getLastUpdateTime()
      Provides the timestamp of the last time the configuration was updated.
      Specified by:
      getLastUpdateTime in interface ConfigApiDelegate
      Returns:
      a ResponseEntity<Date> with the timestamp.
      See Also:
    • getLoadedUrlList

      public org.springframework.http.ResponseEntity<List<String>> getLoadedUrlList()
      Provides the URLs from which the configuration was loaded.
      Specified by:
      getLoadedUrlList in interface ConfigApiDelegate
      Returns:
      a ResponseEntity<List<String>> with the URLs.
      See Also:
    • putConfig

      public org.springframework.http.ResponseEntity putConfig(String sectionName, org.springframework.web.multipart.MultipartFile configFile, String ifMatch, String ifModifiedSince, String ifNoneMatch, String ifUnmodifiedSince)
      Stores the configuration file for a section given the section name.
      Specified by:
      putConfig in interface ConfigApiDelegate
      Parameters:
      sectionName - A String with the section name.
      configFile - A MultipartFile with the configuration file to be stored.
      ifMatch - A List with the "If-Match" request header, containing an asterisk or values equivalent to the "If-Unmodified-Since" request header but with a granularity of 1 ms.
      ifModifiedSince - A String with "If-Modified-Since" request header.
      ifNoneMatch - A List with the "If-None-Match" request header, containing an asterisk or values equivalent to the "If-Modified-Since" request header but with a granularity of 1 ms.
      ifUnmodifiedSince - A String with the "If-Unmodified-Since" request header.
      Returns:
      a ResponseEntity<Void>.
      See Also:
    • putConfigReload

      public org.springframework.http.ResponseEntity<Void> putConfigReload()
      Requests a reload of the configuration.
      Specified by:
      putConfigReload in interface ConfigApiDelegate
      Returns:
      a ResponseEntity<Void> with the status.
      See Also:
    • getPlatformConfig

      public org.springframework.http.ResponseEntity getPlatformConfig()
      Provides the platform configuration.
      Specified by:
      getPlatformConfig in interface ConfigApiDelegate
      Returns:
      a ResponseEntity<PlatformConfigurationWsResult> with the platform configuration.
      See Also:
    • validateSectionName

      protected String validateSectionName(String sectionName, org.lockss.util.AccessType access) throws MalformedParametersException
      Provides a validated canonical version of the passed section name.
      Parameters:
      sectionName - A String with the section name.
      access - An AccessType indicating whether this is for a reading or writing operation.
      Returns:
      a String with the validated canonical version of the section name.
      Throws:
      MalformedParametersException - if validation fails.
    • setETag

      protected void setETag(org.springframework.http.HttpHeaders hdrs, String etag)
    • setLastModified

      protected void setLastModified(org.springframework.http.HttpHeaders hdrs, String last)
    • getBuildTimestamp

      protected long getBuildTimestamp() throws ParseException
      Provides the build timestamp.
      Returns:
      A long with the build timestamp.
      Throws:
      ParseException - if there are problems parsing the timestamp.