private void initializeAdminStats() throws IOException {
Map<RequestInfo.InfoName, String> props =
new HashMap<RequestInfo.InfoName, String>();
props.put(RequestInfo.InfoName.RemoteAddr, getRandomIp());
RequestInfo info = new RequestInfo(props);
ShortUrl shortUrl = rm.getUrlManager().shorten(
new URL("http://hbasebook.com"), "admin", info);
Calendar startDate = Calendar.getInstance();
startDate.set(2011, 1, 1);
Calendar endDate = Calendar.getInstance();
endDate.setTime(new Date());
while (startDate.before(endDate)) {
props.put(RequestInfo.InfoName.RemoteAddr, getRandomIp());
int count = RANDOM.nextInt(200);
rm.getCounters().incrementUsage(shortUrl.getId(), info,
count, startDate.getTime());
if (shortUrl.getRefShortId() != null) {
rm.getCounters().incrementUsage(shortUrl.getRefShortId(), info,
count, startDate.getTime());
}
startDate.add(Calendar.DATE, 1);
}
LOG.info("Admin statistics initialized.");