Merge pull request #496 from raman-bt/develop

Defined IngestModuleException that an ingest module may throw if init() fails.
This commit is contained in:
Richard Cordovano 2014-02-21 13:30:23 -05:00
commit 1ca84d03b1
20 changed files with 35 additions and 23 deletions

View File

@ -89,7 +89,7 @@ import org.sleuthkit.datamodel.TskCoreException;
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
// do nothing
}

View File

@ -72,7 +72,7 @@ import org.sleuthkit.datamodel.TskData;
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
/* For this demo, we are going to make a private attribute to post our
* results to the blackbaord with. There are many standard blackboard artifact
* and attribute types and you should first consider using one of those before

View File

@ -31,6 +31,7 @@ import org.openide.util.Cancellable;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.StopWatch;
import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
import org.sleuthkit.datamodel.Content;
/**
@ -75,13 +76,13 @@ import org.sleuthkit.datamodel.Content;
return module;
}
public void init() {
public void init() throws IngestModuleException{
logger.log(Level.INFO, "Initializing module: " + module.getName());
try {
module.init(init);
inited = true;
} catch (Exception e) {
} catch (IngestModuleException e) {
logger.log(Level.INFO, "Failed initializing module: " + module.getName() + ", will not run.");
//will not run
inited = false;

View File

@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.StopWatch;
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
import org.sleuthkit.autopsy.ingest.IngestScheduler.FileScheduler.FileTask;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
@ -459,7 +460,7 @@ public class IngestManager {
IngestModuleInit moduleInit = new IngestModuleInit();
try {
s.init(moduleInit);
} catch (Exception e) {
} catch (IngestModuleException e) {
logger.log(Level.SEVERE, "File ingest module failed init(): " + s.getName(), e);
allInited = false;
failedModule = s;

View File

@ -23,7 +23,7 @@ package org.sleuthkit.autopsy.ingest;
/**
* Base interface for ingest modules
*/
abstract class IngestModuleAbstract {
public abstract class IngestModuleAbstract {
private String args;
@ -41,6 +41,13 @@ package org.sleuthkit.autopsy.ingest;
*/
AbstractFile
};
public class IngestModuleException extends Exception {
IngestModuleException(String msg) {
super(msg);
}
}
/**
* Invoked every time an ingest session is started by the framework.
@ -55,8 +62,10 @@ package org.sleuthkit.autopsy.ingest;
* NEVER initialize IngestServices handle in the member declaration, because it might result
* in multiple instances of the singleton -- different class loaders are used in different modules.
* @param initContext context used to initialize some modules
*
* @throws IngestModuleException if a critical error occurs in initializing the module.
*/
abstract public void init(IngestModuleInit initContext);
abstract public void init(IngestModuleInit initContext) throws IngestModuleException;
/**
* Invoked when an ingest session completes.

View File

@ -226,7 +226,7 @@ public final class ExifParserFileIngestModule extends IngestModuleAbstractFile {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
logger.log(Level.INFO, "init() " + this.toString());

View File

@ -83,7 +83,7 @@ public class FileExtMismatchIngestModule extends org.sleuthkit.autopsy.ingest.In
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
// Load mapping

View File

@ -76,7 +76,7 @@ import org.sleuthkit.datamodel.TskException;
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
}

View File

@ -45,6 +45,7 @@ import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskException;
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException;
import org.sleuthkit.datamodel.HashInfo;
public class HashDbIngestModule extends IngestModuleAbstractFile {
@ -145,7 +146,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
skCase = Case.getCurrentCase().getSleuthkitCase();

View File

@ -343,7 +343,7 @@ public final class KeywordSearchIngestModule extends IngestModuleAbstractFile {
*
*/
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
logger.log(Level.INFO, "init()");
services = IngestServices.getDefault();
initialized = false;

View File

@ -502,7 +502,7 @@ class Chrome extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
}

View File

@ -480,7 +480,7 @@ class ExtractIE extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
}

View File

@ -540,7 +540,7 @@ class ExtractRegistry extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
}
@Override

View File

@ -479,7 +479,7 @@ class Firefox extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
}

View File

@ -150,7 +150,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
modules = new ArrayList<>();
browserModules = new ArrayList();
logger.log(Level.INFO, "init() {0}", this.toString());
@ -180,7 +180,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
for (Extract module : modules) {
try {
module.init(initContext);
} catch (Exception ex) {
} catch (IngestModuleException ex) {
logger.log(Level.SEVERE, "Exception during init() of " + module.getName(), ex);
}
}

View File

@ -121,7 +121,7 @@ class RecentDocumentsByLnk extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
}

View File

@ -333,7 +333,7 @@ class SearchEngineURLQueryAnalyzer extends Extract {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
try{
services = IngestServices.getDefault();
PlatformUtil.extractResourceToUserConfigDir(SearchEngineURLQueryAnalyzer.class, XMLFILE);

View File

@ -113,7 +113,7 @@ public final class SevenZipIngestModule extends IngestModuleAbstractFile {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
initialized = false;

View File

@ -153,7 +153,7 @@ public class EwfVerifyIngestModule extends IngestModuleDataSource {
}
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
skCase = Case.getCurrentCase().getSleuthkitCase();
running = false;

View File

@ -285,7 +285,7 @@ public class ThunderbirdMboxFileIngestModule extends IngestModuleAbstractFile {
@Override
public void init(IngestModuleInit initContext) {
public void init(IngestModuleInit initContext) throws IngestModuleException {
services = IngestServices.getDefault();
fileManager = Case.getCurrentCase().getServices().getFileManager();
}