private OAICompiledRequest(OAIRequest request, ResumptionTokenFormat resumptionTokenFormat) throws IllegalVerbException, BadArgumentException, UnknownParameterException, DuplicateDefinitionException, InvalidResumptionTokenException { Collection<String> parameterNames = request.getParameterNames(); if (isTrueThat(parameterNames, not(hasItem(equalTo("verb"))))) throw new IllegalVerbException("No verb provided"); for (String parameterName : parameterNames) if (isTrueThat(parameterName, not(in("verb", "from", "until", "metadataPrefix", "identifier", "set", "resumptionToken")))) throw new UnknownParameterException("Unknown parameter '" + parameterName + "'"); String until = request.getString(Until); String from = request.getString(From); if (isTrueThat(until, is(not(nullValue()))) && isTrueThat(from, is(not(nullValue()))) && from.length() != until.length()) throw new BadArgumentException("Distinct granularities provided for until and from parameters"); this.verbType = request.getVerb(); this.from = request.getDate(From); this.until = request.getDate(Until); this.metadataPrefix = request.getString(MetadataPrefix); this.set = request.getString(Set); this.identifier = request.getString(Identifier); if (request.has(ResumptionToken)) this.resumptionToken = resumptionTokenFormat.parse(request.getString(ResumptionToken)); else this.resumptionToken = new ResumptionToken.Value(); this.validate(); this.loadResumptionToken(this.resumptionToken); }