Class BaseResourceDownloader

    • Field Detail

      • LOG

        private static final Logger LOG
      • resource

        protected final Resource resource
      • downloadUrls

        private final java.util.List<java.net.URL> downloadUrls
      • downLoadExceptions

        private final java.util.List<java.lang.Exception> downLoadExceptions
    • Constructor Detail

      • BaseResourceDownloader

        BaseResourceDownloader​(Resource resource,
                               java.util.List<java.net.URL> downloadUrls)
    • Method Detail

      • exceptionMessage

        private java.lang.String exceptionMessage()
      • exceptionMessage

        private java.lang.String exceptionMessage​(java.lang.Exception e)
      • checkForProxyError

        private void checkForProxyError()
      • downloadFrom

        private java.util.concurrent.CompletableFuture<Resource> downloadFrom​(java.net.URL url)
      • tryDownloading

        private Resource tryDownloading​(java.net.URL downloadFrom)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • ensureRequestInterval

        private void ensureRequestInterval()
      • getDownloadConnection

        private CloseableConnection getDownloadConnection​(java.net.URL location)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getTimeValue

        private int getTimeValue​(java.lang.String key)
      • tryDownloading

        private long tryDownloading​(DownloadDetails downloadDetails)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getVersion

        protected abstract VersionId getVersion​(java.net.URL downloadFrom,
                                                java.lang.String versionHeaderValue)
      • isUpToDate

        protected abstract boolean isUpToDate​(java.net.URL resourceHref,
                                              VersionId version,
                                              long lastModified)
      • getInputStreamFromDirectSocket

        private DownloadDetails getInputStreamFromDirectSocket​(java.net.URL url)
                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • loadUrlWithInvalidHeaderBytes

        private java.lang.Object[] loadUrlWithInvalidHeaderBytes​(java.net.URL url)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • endsWithBlankLine

        private static boolean endsWithBlankLine​(java.lang.String head)
      • parseLong

        private long parseLong​(java.lang.String s,
                               long defaultValue)
      • futureToOptional

        private <R> java.util.Optional<R> futureToOptional​(java.util.concurrent.Future<R> future)
      • invalidateExistingEntryInCache

        void invalidateExistingEntryInCache​(VersionId version)