Class DatasetDownloadService
java.lang.Object
gaiasky.gui.datasets.DatasetDownloadService
Headless dataset download service. Contains the full download-install
pipeline (disk space check, download with progress, checksum verification,
extraction), decoupled from any UI. It publishes the
Event#DATASET_DOWNLOAD_* events, consumed by the dataset manager
window, and additionally Event.UPDATE_LOAD_PROGRESS events, consumed
by the load progress interface, so that downloads started outside the
dataset manager window (e.g. through a gaiasky:// URL) still show
progress feedback.
UI-specific reactions (status updates in the dataset table, etc.) are
delegated to a DatasetDownloadService.DownloadCallback provided by the caller.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback for UI-specific reactions to the download lifecycle. -
Constructor Summary
ConstructorsConstructorDescriptionDatasetDownloadService(Map<String, Pair<Dataset, com.badlogic.gdx.Net.HttpRequest>> currentDownloads) Creates a new dataset download service. -
Method Summary
Modifier and TypeMethodDescriptionvoiddownloadDataset(Dataset dataset, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable successRunnable, DatasetDownloadService.DownloadCallback callback) Downloads and installs the given dataset.
-
Constructor Details
-
DatasetDownloadService
public DatasetDownloadService(Map<String, Pair<Dataset, com.badlogic.gdx.Net.HttpRequest>> currentDownloads) Creates a new dataset download service.- Parameters:
currentDownloads- Map of downloads in progress, keyed by dataset key. Owned by the caller (typically the dataset manager window), and updated by this service.
-
-
Method Details
-
downloadDataset
public void downloadDataset(Dataset dataset, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable successRunnable, DatasetDownloadService.DownloadCallback callback) Downloads and installs the given dataset. This is the full pipeline: disk space check, download with progress reporting, checksum verification and extraction. Progress is published through theEvent.DATASET_DOWNLOAD_PROGRESS_INFOandEvent.UPDATE_LOAD_PROGRESSevents. UI-specific reactions are delegated to the given callback.- Parameters:
dataset- The dataset to download and install.skin- The UI skin, for error dialogs. May be null.stage- The UI stage, for error dialogs. May be null.successRunnable- Runnable to run after a successful install, before the callback. May be null.callback- The callback for UI-specific reactions. May be null.
-