michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.sync.net; michael@0: michael@0: import org.mozilla.gecko.sync.crypto.KeyBundle; michael@0: import org.mozilla.gecko.sync.CryptoRecord; michael@0: import org.mozilla.gecko.sync.KeyBundleProvider; michael@0: michael@0: /** michael@0: * Subclass this to handle collection fetches. michael@0: * @author rnewman michael@0: * michael@0: */ michael@0: public abstract class WBOCollectionRequestDelegate michael@0: extends SyncStorageCollectionRequestDelegate michael@0: implements KeyBundleProvider { michael@0: michael@0: @Override michael@0: public abstract KeyBundle keyBundle(); michael@0: public abstract void handleWBO(CryptoRecord record); michael@0: michael@0: @Override michael@0: public void handleRequestProgress(String progress) { michael@0: try { michael@0: CryptoRecord record = CryptoRecord.fromJSONRecord(progress); michael@0: record.keyBundle = this.keyBundle(); michael@0: this.handleWBO(record); michael@0: } catch (Exception e) { michael@0: this.handleRequestError(e); michael@0: // TODO: abort?! Allow exception to propagate to fail? michael@0: } michael@0: } michael@0: }