final boolean hasStartIndex = URLResourceWithParams.containsAttributePlaceholder(
feedUrlTemplate, START_INDEX_VARIABLE_NAME);
if (!(hasStartPage ^ hasStartIndex))
{
throw new ProcessingException(
"The feedUrlTemplate must contain either "
+ URLResourceWithParams
.formatAttributePlaceholder(START_INDEX_VARIABLE_NAME)
+ " or "
+ URLResourceWithParams
.formatAttributePlaceholder(START_PAGE_VARIABLE_NAME)
+ " variable");
}
if (!URLResourceWithParams.containsAttributePlaceholder(feedUrlTemplate,
SEARCH_TERMS_VARIABLE_NAME))
{
throw new ProcessingException(
"The feedUrlTemplate must contain "
+ URLResourceWithParams
.formatAttributePlaceholder(SEARCH_TERMS_VARIABLE_NAME)
+ " variable");
}
if (resultsPerPage == 0)
{
throw new ProcessingException("resultsPerPage must be set");
}
this.metadata = new MultipageSearchEngineMetadata(resultsPerPage, maximumResults,
hasStartPage);
this.feedFetcher = new HttpURLFeedFetcher();