diff options
author | Ascrod <32915892+Ascrod@users.noreply.github.com> | 2019-04-18 20:35:10 -0400 |
---|---|---|
committer | Ascrod <32915892+Ascrod@users.noreply.github.com> | 2019-04-18 20:35:10 -0400 |
commit | af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec (patch) | |
tree | 4aac6c4383fb9e279fccb13c65a4e44595fd4cf6 /mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java | |
parent | 40fc72376411587e7bf9985fb9545eca1c9aaa8e (diff) | |
parent | 51722cd4fecb5c8c79a302f2771cad71535df5ea (diff) | |
download | UXP-af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec.tar UXP-af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec.tar.gz UXP-af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec.tar.lz UXP-af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec.tar.xz UXP-af7e140d4ed8f5bc9a69da2f0338ad3cb1319dec.zip |
Merge branch 'master' into default-pref
Diffstat (limited to 'mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java')
-rw-r--r-- | mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java deleted file mode 100644 index 7f53c2739..000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoConfigurationStage.java +++ /dev/null @@ -1,59 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.sync.stage; - -import org.mozilla.gecko.sync.ExtendedJSONObject; -import org.mozilla.gecko.sync.InfoConfiguration; -import org.mozilla.gecko.sync.JSONRecordFetcher; -import org.mozilla.gecko.sync.delegates.JSONRecordFetchDelegate; -import org.mozilla.gecko.sync.net.AuthHeaderProvider; -import org.mozilla.gecko.sync.net.SyncStorageResponse; - -/** - * Fetches configuration data from info/configurations endpoint. - */ -public class FetchInfoConfigurationStage extends AbstractNonRepositorySyncStage { - private final String configurationURL; - private final AuthHeaderProvider authHeaderProvider; - - public FetchInfoConfigurationStage(final String configurationURL, final AuthHeaderProvider authHeaderProvider) { - super(); - this.configurationURL = configurationURL; - this.authHeaderProvider = authHeaderProvider; - } - - public class StageInfoConfigurationDelegate implements JSONRecordFetchDelegate { - @Override - public void handleSuccess(final ExtendedJSONObject result) { - session.config.infoConfiguration = new InfoConfiguration(result); - session.advance(); - } - - @Override - public void handleFailure(final SyncStorageResponse response) { - // Handle all non-404 failures upstream. - if (response.getStatusCode() != 404) { - session.handleHTTPError(response, "Failure fetching info/configuration"); - return; - } - - // End-point might not be available (404) if server is running an older version. - // We will use default config values in this case. - session.config.infoConfiguration = new InfoConfiguration(); - session.advance(); - } - - @Override - public void handleError(final Exception e) { - session.abort(e, "Failure fetching info/configuration"); - } - } - @Override - public void execute() { - final StageInfoConfigurationDelegate delegate = new StageInfoConfigurationDelegate(); - final JSONRecordFetcher fetcher = new JSONRecordFetcher(configurationURL, authHeaderProvider); - fetcher.fetch(delegate); - } -} |