* @throws IOException
* @throws InterruptedException
*/
private void doIndexFile(String filename, Long forumKey, SearchResourceContext leafResourceContext, OlatFullIndexer indexWriter) throws IOException,InterruptedException {
OlatRootFolderImpl forumContainer = DialogElementsController.getForumContainer(forumKey);
VFSLeaf leaf = (VFSLeaf) forumContainer.getItems(new VFSLeafFilter()).get(0);
if (log.isDebug()) log.debug("Analyse VFSLeaf=" + leaf.getName());
try {
if (FileDocumentFactory.getInstance().isFileSupported(leaf)) {
leafResourceContext.setFilePath(filename);
leafResourceContext.setDocumentType(TYPE_FILE);
Document document = FileDocumentFactory.createDocument(leafResourceContext, leaf);
indexWriter.addDocument(document);
} else {
if (log.isDebug()) log.debug("Documenttype not supported. file=" + leaf.getName());
}
} catch (DocumentAccessException e) {
if (log.isDebug()) log.debug("Can not access document." + e.getMessage());
} catch (DocumentNotImplementedException e) {
if (log.isDebug()) log.debug("Documenttype not implemented.");
} catch (DocumentException dex) {
if (log.isDebug()) log.debug("DocumentException: Can not index leaf=" + leaf.getName());
} catch (IOException ioEx) {
log.warn("IOException: Can not index leaf=" + leaf.getName(), ioEx);
} catch (InterruptedException iex) {
throw new InterruptedException(iex.getMessage());
} catch (Exception ex) {
log.warn("Exception: Can not index leaf=" + leaf.getName(), ex);
}
}