NIHVIVO-2979 Committing functionality to the trunk.
This commit is contained in:
parent
1006b4316e
commit
adba60a9de
3 changed files with 20 additions and 3 deletions
|
@ -29,6 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.LoginEvent;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.LogoutEvent;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
|
||||
|
||||
/**
|
||||
* The "standard" implementation of Authenticator.
|
||||
|
@ -136,8 +137,7 @@ public class BasicAuthenticator extends Authenticator {
|
|||
|
||||
if (IsRootUser.isRootUser(RequestIdentifiers
|
||||
.getIdBundleForRequest(request))) {
|
||||
// Insert method call here.
|
||||
}
|
||||
IndexBuilder.checkIndexOnRootLogin(request); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,4 +56,6 @@ public interface IndexerIface {
|
|||
* This may be called instead of endIndexing()
|
||||
*/
|
||||
public void abortIndexingAndCleanUp();
|
||||
|
||||
public boolean isIndexEmpty();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -195,7 +197,20 @@ public class IndexBuilder extends Thread {
|
|||
}
|
||||
|
||||
|
||||
/* ******************** non-public methods ************************* */
|
||||
public static void checkIndexOnRootLogin(HttpServletRequest req){
|
||||
HttpSession session = req.getSession();
|
||||
ServletContext context = session.getServletContext();
|
||||
IndexBuilder indexBuilder = (IndexBuilder)context.getAttribute(IndexBuilder.class.getName());
|
||||
|
||||
log.debug("Checking if the index is empty");
|
||||
if(indexBuilder.indexer.isIndexEmpty()){
|
||||
log.info("Index is empty. Running a full index rebuild!");
|
||||
indexBuilder.doIndexRebuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ******************** non-public methods ************************* */
|
||||
|
||||
private List<Statement> getAndEmptyChangedStatements(){
|
||||
List<Statement> localChangedStmt = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue