Class StorageFetcher

  • All Implemented Interfaces:
    Fetcher, java.lang.AutoCloseable

    public final class StorageFetcher
    extends java.lang.Object
    implements Fetcher
    This class holds the implementation to provide how items are fetched from a database, to validate the item and to store it if specified.
    Author:
    Ween Jiann Lee
    • Method Detail

      • builder

        public static StorageFetcher.Builder builder​(FileManager fileManager)
        Create an instance of builder.
        Parameters:
        fileManager - the file manager to use.
        Returns:
        A new instance of builder
      • start

        public void start()
        Description copied from interface: Fetcher
        Fetcher starter.
        Specified by:
        start in interface Fetcher
      • fetch

        public java.util.concurrent.Future<Response> fetch​(Request request)
        Description copied from interface: Fetcher
        Fetch the desired HTTP page given in Request.
        Specified by:
        fetch in interface Fetcher
        Parameters:
        request - information for the page to fetch.
        Returns:
        Response future
      • fetch

        public java.util.concurrent.Future<Response> fetch​(Request request,
                                                           Callback callback)
        Description copied from interface: Fetcher
        Fetch the desired HTTP page given in Request. Executes callback upon completion.
        Specified by:
        fetch in interface Fetcher
        Parameters:
        request - information for the page to fetch.
        callback - callback
        Returns:
        Response future
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception