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.repositories; michael@0: michael@0: import java.net.URISyntaxException; michael@0: michael@0: import org.mozilla.gecko.sync.InfoCollections; michael@0: import org.mozilla.gecko.sync.net.AuthHeaderProvider; michael@0: michael@0: /** michael@0: * A kind of Server11Repository that supports explicit setting of limit and sort on operations. michael@0: * michael@0: * @author rnewman michael@0: * michael@0: */ michael@0: public class ConstrainedServer11Repository extends Server11Repository { michael@0: michael@0: private String sort = null; michael@0: private long limit = -1; michael@0: michael@0: public ConstrainedServer11Repository(String collection, String storageURL, AuthHeaderProvider authHeaderProvider, InfoCollections infoCollections, long limit, String sort) throws URISyntaxException { michael@0: super(collection, storageURL, authHeaderProvider, infoCollections); michael@0: this.limit = limit; michael@0: this.sort = sort; michael@0: } michael@0: michael@0: @Override michael@0: protected String getDefaultSort() { michael@0: return sort; michael@0: } michael@0: michael@0: @Override michael@0: protected long getDefaultFetchLimit() { michael@0: return limit; michael@0: } michael@0: }