DatabaseUtil dbUtil = DatabaseUtil.getSingleton();
try {
DatabaseUtil.getSingleton().beginTransaction(SystemPrincipal.getCredentials());
LiusConfig lc = LiusConfigBuilder.getSingletonInstance().getLiusConfig(IndexerServlet.getIndexConfigFilePath());
JCRIndexer indexer = new JCRIndexer();
indexer.setUp(lc);
List folders = FolderDao.createInstance().list();
for (Iterator it = folders.iterator(); it.hasNext(); ) {
Folder folder = (Folder) it.next();
Session jcrSession = (Session) DatabaseUtil.getSingleton().getDaoSession();
indexer.setJcrNode(jcrSession.getNodeByUUID(folder.getId()));
try {
indexer.index(IndexerServlet.getIndexDir());
} catch (Exception e) {
e.printStackTrace();
}
//IndexEventListener.getInstance()
}
indexer.closeIndex();
dbUtil.commitTransaction();
} catch (Exception e) {
e.printStackTrace();
dbUtil.rollbackTransaction();