Package ai.preferred.venom.fetcher
Class StorageFetcher
- java.lang.Object
-
- ai.preferred.venom.fetcher.StorageFetcher
-
- All Implemented Interfaces:
Fetcher
,AutoCloseable
public final class StorageFetcher extends 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StorageFetcher.Builder
A builder for StorageFetcher class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StorageFetcher.Builder
builder(FileManager<?> fileManager)
Create an instance of builder.void
close()
Future<Response>
fetch(Request request)
Fetch the desired HTTP page given inRequest
.Future<Response>
fetch(Request request, Callback callback)
Fetch the desired HTTP page given inRequest
.void
start()
Fetcher starter.
-
-
-
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.
-
fetch
public Future<Response> fetch(Request request)
Description copied from interface:Fetcher
Fetch the desired HTTP page given inRequest
.
-
fetch
public Future<Response> fetch(Request request, Callback callback)
Description copied from interface:Fetcher
Fetch the desired HTTP page given inRequest
. Executes callback upon completion.
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-