mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
Merge pull request #5072 from kellykelly3/1296-cleanup-warnings
1296 cleanup warnings
This commit is contained in:
commit
196825caad
@ -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()) {
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,10 +299,11 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<BlackboardAttribute> baseAttributes = new ArrayList<>();
|
||||
|
@ -83,7 +83,7 @@ public class ListViewModel {
|
||||
List<TimelineEvent> events = eventManager.getEvents(timeRange, filterState.getActiveFilter());
|
||||
|
||||
if (events == null || events.isEmpty()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
ArrayList<CombinedEvent> combinedEvents = new ArrayList<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user