}
queryString.append("&").append(MessageFormat.format(
FLICKR_PAGE_PARAM, pageIndex));
Fetcher operation = new Fetcher(pipeline);
// OK to pass null strings to operations attribute setters
// Operation process can validate the attributes whenever
// it performs its operation
operation.setHref(FLICKR_REST_API_URL + queryString.toString());
operation.setParse(PARSE_ATTRIBUTE_VALUE);
operation.setEncoding(ENCODING_ATTRIBUTE_VALUE);
// Handle the timeout setting. Firstly, we need to see if there is a
// timeout attribute. We default to -1 to indicate no timeout
String timeoutAttr = TIMEOUT_ATTRIBUTE_VALUE;
Period timeout = null;
if (timeoutAttr != null) {
// The attribute should contain an integer number of seconds
int timeoutInSecs;
try {
timeoutInSecs = Integer.parseInt(timeoutAttr);
} catch (NumberFormatException e) {
LOGGER.warn("invalid-timeout", timeoutAttr);
throw e;
}
timeout = Period.treatNonPositiveAsIndefinitely(
timeoutInSecs * 1000);
}
operation.setTimeout(timeout);
operation.doInclude();
return null;
}