public void printEndTag(PageRequest request, PageResponse response)
throws RegainException
{
Localizer localizer = mMultiLocalizer.getLocalizer(request.getLocale());
Crawler crawler = IndexUpdateManager.getInstance().getCurrentCrawler();
if (crawler == null) {
response.print(localizer.msg("noIndexUpdate", "Currently is no index update running."));
} else {
// Get the IndexConfig
IndexConfig[] configArr = SearchToolkit.getIndexConfigArr(request);
if (configArr.length > 1) {
throw new RegainException("The indexupdate tag can only be used for one index!");
}
IndexConfig config = configArr[0];
// Get the index size
File indexUpdateDir = new File(config.getDirectory(), "temp");
long size = RegainToolkit.getDirectorySize(indexUpdateDir);
String sizeAsString = RegainToolkit.bytesToString(size, request.getLocale());
String currentJobUrl = crawler.getCurrentJobUrl();
Object[] args = new Object[] {
new Integer(crawler.getFinishedJobCount()),
sizeAsString,
new Integer(crawler.getInitialDocCount()),
new Integer(crawler.getAddedDocCount()),
new Integer(crawler.getRemovedDocCount()),
(currentJobUrl == null) ? "?" : currentJobUrl,
RegainToolkit.toTimeString(crawler.getCurrentJobTime())
};
response.print(localizer.msg("indexInfo", "Processed documents: {0}<br/>" +
"Size: {1}<br/>Initial document count: {2}<br/>" +
"Added document count: {3}<br/>Removed document count: {4}<br/>" +
"Current job: {5} (since {6})", args));