diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java index 370e978804..640f4f8825 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java @@ -415,6 +415,7 @@ public class Case { eventPublisher.publish(new TimelineEventAddedEvent(event)); } + @SuppressWarnings("deprecation") @Subscribe public void rebroadcastArtifactsPosted(Blackboard.ArtifactsPostedEvent event) { for (BlackboardArtifact.Type artifactType : event.getArtifactTypes()) { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java index 52e35041e6..b845b97036 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java @@ -19,31 +19,24 @@ package org.sleuthkit.autopsy.casemodule.services; import java.io.Closeable; +import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.SleuthkitCase; /** * A representation of the blackboard, a place where artifacts and their * attributes are posted. * - * NOTE: This API of this class is under development. - * * @deprecated Use org.sleuthkit.datamodel.Blackboard instead. */ @Deprecated public final class Blackboard implements Closeable { - - private org.sleuthkit.datamodel.Blackboard delegate; - + /** * Constructs a representation of the blackboard, a place where artifacts * and their attributes are posted. - * - * @param casedb The case database. */ - Blackboard(SleuthkitCase casedb) { - this.delegate = casedb.getBlackboard(); + Blackboard() { } /** @@ -54,14 +47,10 @@ public final class Blackboard implements Closeable { * @throws BlackboardException If there is a problem indexing the artifact. */ public synchronized void indexArtifact(BlackboardArtifact artifact) throws BlackboardException { - if (null == delegate) { - throw new BlackboardException("Blackboard has been closed"); - } - - try { - delegate.postArtifact(artifact, ""); - } catch (org.sleuthkit.datamodel.Blackboard.BlackboardException ex) { - throw new BlackboardException("Error indexing artifact", ex); + try{ + Case.getCurrentCase().getSleuthkitCase().getBlackboard().postArtifact(artifact, ""); + } catch(org.sleuthkit.datamodel.Blackboard.BlackboardException ex) { + throw new BlackboardException(ex.getMessage(), ex); } } @@ -78,14 +67,10 @@ public final class Blackboard implements Closeable { * artifact type. */ public synchronized BlackboardArtifact.Type getOrAddArtifactType(String typeName, String displayName) throws BlackboardException { - if (null == delegate) { - throw new BlackboardException("Blackboard has been closed"); - } - try { - return delegate.getOrAddArtifactType(typeName, displayName); + return Case.getCurrentCase().getSleuthkitCase().getBlackboard().getOrAddArtifactType(typeName, displayName); } catch (org.sleuthkit.datamodel.Blackboard.BlackboardException ex) { - throw new BlackboardException("Delegate org.sleuthkit.datamodel.Blackboard threw exception.", ex); + throw new BlackboardException(ex.getMessage(), ex); } } @@ -103,13 +88,10 @@ public final class Blackboard implements Closeable { * attribute type. */ public synchronized BlackboardAttribute.Type getOrAddAttributeType(String typeName, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, String displayName) throws BlackboardException { - if (null == delegate) { - throw new BlackboardException("Blackboard has been closed"); - } try { - return delegate.getOrAddAttributeType(typeName, valueType, displayName); + return Case.getCurrentCase().getSleuthkitCase().getBlackboard().getOrAddAttributeType(typeName, valueType, displayName); } catch (org.sleuthkit.datamodel.Blackboard.BlackboardException ex) { - throw new BlackboardException("Delegate org.sleuthkit.datamodel.Blackboard threw exception.", ex); + throw new BlackboardException(ex.getMessage(), ex); } } @@ -119,7 +101,7 @@ public final class Blackboard implements Closeable { */ @Override public synchronized void close() { - delegate = null; + } /** diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java index 1e8d8fcb2e..ff3b32a495 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.openide.util.Lookup; +import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService; import org.sleuthkit.datamodel.SleuthkitCase; @@ -39,7 +40,6 @@ public class Services implements Closeable { private final FileManager fileManager; private final TagsManager tagsManager; private final KeywordSearchService keywordSearchService; - private final Blackboard blackboard; /** * Constructs a collection of case-level services (e.g., file manager, tags @@ -59,9 +59,6 @@ public class Services implements Closeable { //null safe so that the functional tests run with no issues. keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class); services.add(keywordSearchService); - - blackboard = new Blackboard(caseDb); - services.add(blackboard); } /** @@ -95,9 +92,21 @@ public class Services implements Closeable { * Gets the blackboard service for the current case. * * @return The blackboard service for the current case. + * + * @deprecated Use org.sleuthkit.autopsy.casemodule.getCaseBlackboard instead */ + @Deprecated public Blackboard getBlackboard() { - return blackboard; + return new Blackboard(); + } + + /** + * Gets the TSK Blackboard for the current case. + * + * @return @org.sleuthkit.datamodel.Blackboard Blackboard for the current case. + */ + public org.sleuthkit.datamodel.Blackboard getCaseBlackboard() { + return Case.getCurrentCase().getSleuthkitCase().getBlackboard(); } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java index 34a7ec2702..250aab712d 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.logging.Level; import javax.xml.bind.DatatypeConverter; import java.util.Arrays; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.DataSourceIngestModule; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; @@ -38,6 +39,7 @@ import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.TskCoreException; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskDataException; @@ -297,11 +299,12 @@ public class DataSourceIntegrityIngestModule implements DataSourceIngestModule { BlackboardArtifact verificationFailedArtifact = Case.getCurrentCase().getSleuthkitCase().newBlackboardArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED, img.getId()); verificationFailedArtifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT, DataSourceIntegrityModuleFactory.getModuleName(), artifactComment)); - IngestServices.getInstance().fireModuleDataEvent(new ModuleDataEvent(DataSourceIntegrityModuleFactory.getModuleName(), - BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED)); + Case.getCurrentCase().getServices().getCaseBlackboard().postArtifact(verificationFailedArtifact, DataSourceIntegrityModuleFactory.getModuleName()); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error creating verification failed artifact", ex); - } + } catch (Blackboard.BlackboardException ex) { + Exceptions.printStackTrace(ex); + } } services.postMessage(IngestMessage.createMessage(messageType, DataSourceIntegrityModuleFactory.getModuleName(), diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index 032f7da506..35dc103e5c 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -23,7 +23,7 @@ import java.util.List; import javax.xml.bind.DatatypeConverter; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.Content; @@ -65,7 +65,7 @@ final class CustomArtifactType { * @throws BlackboardException If there is an error adding any of the types. */ static void addToCaseDatabase() throws Blackboard.BlackboardException, NoCurrentCaseException { - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); artifactType = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAME, ARTIFACT_DISPLAY_NAME); intAttrType = blackboard.getOrAddAttributeType(INT_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER, INT_ATTR_DISPLAY_NAME); doubleAttrType = blackboard.getOrAddAttributeType(DOUBLE_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE, DOUBLE_ATTR_DISPLAY_NAME); diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java index 8293ba934e..d9a321e216 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java @@ -21,11 +21,11 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; import org.sleuthkit.autopsy.ingest.IngestJobContext; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java index abd6f0d00d..1e263dc50a 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java @@ -21,10 +21,10 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.IngestJobContext; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskCoreException; diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index f3232ceb86..7df13edfad 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -26,17 +26,17 @@ import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * A file ingest module that creates some interestng artifacts + * A file ingest module that creates some interesting artifacts * with attributes based on files for test purposes. */ @NbBundle.Messages({ @@ -55,7 +55,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt @Override public void startUp(IngestJobContext context) throws IngestModuleException { try { - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); artifactType = blackboard.getOrAddArtifactType(INT_ARTIFACT_TYPE_NAME, INT_ARTIFACT_DISPLAY_NAME); } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { throw new IngestModuleException(Bundle.InterestingArtifactCreatorIngestModule_exceptionMessage_errorCreatingCustomType(), ex); @@ -77,7 +77,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt * type. */ int randomArtIndex = (int) (Math.random() * 3); - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); BlackboardArtifact.Type artifactTypeBase = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAMES[randomArtIndex], ARTIFACT_DISPLAY_NAMES[randomArtIndex]); BlackboardArtifact artifactBase = file.newArtifact(artifactTypeBase.getTypeID()); Collection baseAttributes = new ArrayList<>(); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java index 3c70654f12..4103e736fe 100755 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java @@ -83,7 +83,7 @@ public class ListViewModel { List events = eventManager.getEvents(timeRange, filterState.getActiveFilter()); if (events == null || events.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } ArrayList combinedEvents = new ArrayList<>();