keyword search ingest: more granular cancellation

This commit is contained in:
adam-m 2012-02-24 19:12:35 -05:00
parent 7a581bf487
commit 3cc94caeca

View File

@ -70,7 +70,6 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
private volatile int messageID = 0; private volatile int messageID = 0;
private volatile boolean finalRun = false; private volatile boolean finalRun = false;
private SleuthkitCase caseHandle = null; private SleuthkitCase caseHandle = null;
// TODO: use a more robust method than checking file extension to determine // TODO: use a more robust method than checking file extension to determine
// whether to try a file // whether to try a file
// supported extensions list from http://www.lucidimagination.com/devzone/technical-articles/content-extraction-tika // supported extensions list from http://www.lucidimagination.com/devzone/technical-articles/content-extraction-tika
@ -81,8 +80,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
public enum IngestStatus { public enum IngestStatus {
INGESTED, EXTRACTED_INGESTED, SKIPPED, INGESTED, EXTRACTED_INGESTED, SKIPPED,};
};
private Map<Long, IngestStatus> ingestStatus; private Map<Long, IngestStatus> ingestStatus;
private Map<String, List<FsContent>> reportedHits; //already reported hits private Map<String, List<FsContent>> reportedHits; //already reported hits
@ -229,8 +227,9 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
public boolean hasBackgroundJobsRunning() { public boolean hasBackgroundJobsRunning() {
if (searcher != null && searcherDone == false) { if (searcher != null && searcherDone == false) {
return true; return true;
} else {
return false;
} }
else return false;
//no need to check timer thread //no need to check timer thread
@ -294,9 +293,10 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
keywords.clear(); keywords.clear();
keywordLists.clear(); keywordLists.clear();
for(KeywordSearchList list : loader.getListsL()){ for (KeywordSearchList list : loader.getListsL()) {
if(list.getUseForIngest()) if (list.getUseForIngest()) {
keywordLists.add(list.getName()); keywordLists.add(list.getName());
}
keywords.addAll(list.getKeywords()); keywords.addAll(list.getKeywords());
} }
} }
@ -309,7 +309,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
keywords.clear(); keywords.clear();
for(String name : keywordLists) { for (String name : keywordLists) {
keywords.addAll(loader.getList(name).getKeywords()); keywords.addAll(loader.getList(name).getKeywords());
} }
} }
@ -319,9 +319,10 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
} }
void addToKeywordLists(String name) { void addToKeywordLists(String name) {
if(!keywordLists.contains(name)) if (!keywordLists.contains(name)) {
keywordLists.add(name); keywordLists.add(name);
} }
}
//CommitTimer wakes up every interval ms //CommitTimer wakes up every interval ms
//and sets a flag for indexer to commit after indexing next file //and sets a flag for indexer to commit after indexing next file
@ -510,6 +511,9 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
//write results to BB //write results to BB
Collection<BlackboardArtifact> newArtifacts = new ArrayList<BlackboardArtifact>(); //new artifacts to report Collection<BlackboardArtifact> newArtifacts = new ArrayList<BlackboardArtifact>(); //new artifacts to report
for (FsContent hitFile : newResults) { for (FsContent hitFile : newResults) {
if (this.isCancelled()) {
return null;
}
Collection<KeywordWriteResult> written = del.writeToBlackBoard(hitFile); Collection<KeywordWriteResult> written = del.writeToBlackBoard(hitFile);
for (KeywordWriteResult res : written) { for (KeywordWriteResult res : written) {
newArtifacts.add(res.getArtifact()); newArtifacts.add(res.getArtifact());