mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-05 16:56:16 +00:00
Merge pull request #7524 from kellykelly3/7533-sco-thread-lock
7533 Moved the node threadpool to the DataResultPanel
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package org.sleuthkit.autopsy.corecomponents;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import java.awt.Cursor;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@@ -32,6 +33,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.Level;
|
||||
import java.util.prefs.PreferenceChangeEvent;
|
||||
import java.util.prefs.PreferenceChangeListener;
|
||||
@@ -75,7 +78,6 @@ import org.sleuthkit.autopsy.mainui.datamodel.CreditCardBinSearchParams;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.CreditCardDAO.CreditCardByBinFetcher;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.CreditCardDAO.CreditCardByFileFetcher;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.CreditCardFileSearchParams;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.CreditCardSearchParams;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.events.DAOAggregateEvent;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactDAO.DataArtifactFetcher;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.DataArtifactSearchParam;
|
||||
@@ -194,6 +196,9 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
|
||||
};
|
||||
|
||||
private final PropertyChangeListener weakDAOListener = WeakListeners.propertyChange(DAOListener, mainDAO);
|
||||
|
||||
private ExecutorService nodeBackgroundTasksPool;
|
||||
private static final Integer MAX_POOL_SIZE = 10;
|
||||
|
||||
/**
|
||||
* Creates and opens a Swing JPanel with a JTabbedPane child component that
|
||||
@@ -1551,11 +1556,19 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C
|
||||
SwingUtilities.invokeLater(() -> displaySearchResults(searchResults, resetPaging, childSelectionInfo));
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop any running background threads.
|
||||
if(nodeBackgroundTasksPool != null) {
|
||||
nodeBackgroundTasksPool.shutdown();
|
||||
}
|
||||
|
||||
nodeBackgroundTasksPool = Executors.newFixedThreadPool(MAX_POOL_SIZE,
|
||||
new ThreadFactoryBuilder().setNameFormat("DataResultPanel-background-task-%d").build());
|
||||
|
||||
if (searchResults == null) {
|
||||
setNode(null, resetPaging);
|
||||
} else {
|
||||
SearchResultRootNode node = new SearchResultRootNode(searchResults);
|
||||
SearchResultRootNode node = new SearchResultRootNode(searchResults, nodeBackgroundTasksPool);
|
||||
node.setNodeSelectionInfo(childSelectionInfo);
|
||||
setNode(node, resetPaging);
|
||||
setNumberOfChildNodes(
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
@@ -55,8 +56,8 @@ public class AnalysisResultNode extends ArtifactNode<AnalysisResult, AnalysisRes
|
||||
* @param tableData The table search result DTO.
|
||||
* @param resultRow The row DTO.
|
||||
*/
|
||||
AnalysisResultNode(AnalysisResultTableSearchResultsDTO tableData, AnalysisResultRowDTO resultRow) {
|
||||
this(tableData, resultRow, IconsUtil.getIconFilePath(tableData.getArtifactType().getTypeID()));
|
||||
AnalysisResultNode(AnalysisResultTableSearchResultsDTO tableData, AnalysisResultRowDTO resultRow, ExecutorService backgroundTasksPool) {
|
||||
this(tableData, resultRow, IconsUtil.getIconFilePath(tableData.getArtifactType().getTypeID()), backgroundTasksPool);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,8 +67,8 @@ public class AnalysisResultNode extends ArtifactNode<AnalysisResult, AnalysisRes
|
||||
* @param resultRow The row DTO.
|
||||
* @param iconPath The path for the node icon.
|
||||
*/
|
||||
AnalysisResultNode(AnalysisResultTableSearchResultsDTO tableData, AnalysisResultRowDTO resultRow, String iconPath) {
|
||||
super(tableData, resultRow, tableData.getColumns(), createLookup(resultRow), iconPath);
|
||||
AnalysisResultNode(AnalysisResultTableSearchResultsDTO tableData, AnalysisResultRowDTO resultRow, String iconPath, ExecutorService backgroundTasksPool) {
|
||||
super(tableData, resultRow, tableData.getColumns(), createLookup(resultRow), iconPath, backgroundTasksPool);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import javax.swing.Action;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.openide.nodes.Children;
|
||||
@@ -63,8 +64,8 @@ public abstract class ArtifactNode<T extends BlackboardArtifact, R extends Artif
|
||||
private final List<ColumnKey> columns;
|
||||
private Node parentFileNode;
|
||||
|
||||
ArtifactNode(SearchResultsDTO searchResults, R rowData, List<ColumnKey> columns, Lookup lookup, String iconPath) {
|
||||
super(Children.LEAF, lookup, searchResults, rowData);
|
||||
ArtifactNode(SearchResultsDTO searchResults, R rowData, List<ColumnKey> columns, Lookup lookup, String iconPath, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, lookup, searchResults, rowData, backgroundTasksPool);
|
||||
this.rowData = rowData;
|
||||
this.columns = columns;
|
||||
setupNodeDisplay(iconPath);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@@ -28,7 +27,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.Action;
|
||||
@@ -36,7 +34,6 @@ import javax.swing.SwingUtilities;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.WeakListeners;
|
||||
@@ -60,9 +57,6 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
|
||||
import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
|
||||
import org.sleuthkit.datamodel.AnalysisResult;
|
||||
import org.sleuthkit.datamodel.DataArtifact;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* A a simple starting point for nodes.
|
||||
@@ -144,22 +138,15 @@ abstract class BaseNode<S extends SearchResultsDTO, R extends BaseRowDTO> extend
|
||||
* A pool of background tasks to run any long computation needed to populate
|
||||
* this node.
|
||||
*/
|
||||
static final ExecutorService backgroundTasksPool;
|
||||
private static final Integer MAX_POOL_SIZE = 10;
|
||||
private final ExecutorService backgroundTasksPool;
|
||||
|
||||
private FutureTask<String> scoFutureTask;
|
||||
|
||||
static {
|
||||
//Initialize this pool only once! This will be used by every instance BaseNode
|
||||
//to do their heavy duty SCO column and translation updates.
|
||||
backgroundTasksPool = Executors.newFixedThreadPool(MAX_POOL_SIZE,
|
||||
new ThreadFactoryBuilder().setNameFormat("BaseNode-background-task-%d").build());
|
||||
}
|
||||
|
||||
BaseNode(Children children, Lookup lookup, S results, R rowData) {
|
||||
BaseNode(Children children, Lookup lookup, S results, R rowData, ExecutorService backgroundTasksPool) {
|
||||
super(children, lookup);
|
||||
this.results = results;
|
||||
this.rowData = rowData;
|
||||
this.backgroundTasksPool = backgroundTasksPool;
|
||||
|
||||
// If the S column is there register the listeners.
|
||||
if (results.getColumns().stream().map(p -> p.getDisplayName()).collect(Collectors.toList()).contains(SCOUtils.SCORE_COLUMN_NAME)) {
|
||||
@@ -218,7 +205,7 @@ abstract class BaseNode<S extends SearchResultsDTO, R extends BaseRowDTO> extend
|
||||
scoFutureTask = null;
|
||||
}
|
||||
|
||||
if ((scoFutureTask == null || scoFutureTask.isDone()) && this instanceof SCOSupporter) {
|
||||
if ((backgroundTasksPool != null && !backgroundTasksPool.isShutdown() && !backgroundTasksPool.isTerminated()) && (scoFutureTask == null || scoFutureTask.isDone()) && this instanceof SCOSupporter) {
|
||||
scoFutureTask = new FutureTask<>(new SCOFetcher<>(new WeakReference<>((SCOSupporter) this)), "");
|
||||
backgroundTasksPool.submit(scoFutureTask);
|
||||
}
|
||||
@@ -318,4 +305,8 @@ abstract class BaseNode<S extends SearchResultsDTO, R extends BaseRowDTO> extend
|
||||
public Action getPreferredAction() {
|
||||
return DirectoryTreeTopComponent.getOpenChildAction(getName());
|
||||
}
|
||||
|
||||
protected ExecutorService getTaskPool() {
|
||||
return backgroundTasksPool;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.openide.nodes.Children;
|
||||
@@ -54,8 +55,8 @@ public final class BlackboardArtifactTagNode extends BaseNode<SearchResultsDTO,
|
||||
|
||||
private static final Logger logger = Logger.getLogger(BlackboardArtifactTagNode.class.getName());
|
||||
|
||||
public BlackboardArtifactTagNode(SearchResultsDTO results, BlackboardArtifactTagsRowDTO rowData) {
|
||||
super(Children.LEAF, createLookup(rowData.getTag()), results, rowData);
|
||||
public BlackboardArtifactTagNode(SearchResultsDTO results, BlackboardArtifactTagsRowDTO rowData, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, createLookup(rowData.getTag()), results, rowData, backgroundTasksPool);
|
||||
this.rowData = rowData;
|
||||
this.columns = results.getColumns();
|
||||
setDisplayName(rowData.getDisplayName());
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Sheet;
|
||||
@@ -48,8 +49,8 @@ public final class ContentTagNode extends BaseNode<SearchResultsDTO, ContentTags
|
||||
* @param results Search results.
|
||||
* @param rowData Row data.
|
||||
*/
|
||||
public ContentTagNode(SearchResultsDTO results, ContentTagsRowDTO rowData) {
|
||||
super(Children.LEAF, createLookup(rowData.getTag()), results, rowData);
|
||||
public ContentTagNode(SearchResultsDTO results, ContentTagsRowDTO rowData, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, createLookup(rowData.getTag()), results, rowData, backgroundTasksPool);
|
||||
this.rowData = rowData;
|
||||
this.columns = results.getColumns();
|
||||
setDisplayName(rowData.getDisplayName());
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Stream;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
@@ -37,11 +38,12 @@ public class CreditCardByFileNode extends BaseNode<SearchResultsDTO, CreditCardB
|
||||
.toArray();
|
||||
}
|
||||
|
||||
public CreditCardByFileNode(SearchResultsDTO results, CreditCardByFileRowDTO rowData) {
|
||||
public CreditCardByFileNode(SearchResultsDTO results, CreditCardByFileRowDTO rowData, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF,
|
||||
Lookups.fixed(getLookupItems(rowData)),
|
||||
results,
|
||||
rowData);
|
||||
rowData,
|
||||
backgroundTasksPool);
|
||||
|
||||
setName(rowData.getFileName() + rowData.getId());
|
||||
setDisplayName(rowData.getFileName());
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
@@ -52,12 +53,12 @@ public class DataArtifactNode extends ArtifactNode<DataArtifact, DataArtifactRow
|
||||
}
|
||||
}
|
||||
|
||||
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow) {
|
||||
this(tableData, artifactRow, getIconFilePath(tableData));
|
||||
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow, ExecutorService backgroundTasksPool) {
|
||||
this(tableData, artifactRow, getIconFilePath(tableData), backgroundTasksPool);
|
||||
}
|
||||
|
||||
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow, String iconPath) {
|
||||
super(tableData, artifactRow, tableData.getColumns(), createLookup(artifactRow), iconPath);
|
||||
public DataArtifactNode(DataArtifactTableSearchResultsDTO tableData, DataArtifactRowDTO artifactRow, String iconPath, ExecutorService backgroundTasksPool) {
|
||||
super(tableData, artifactRow, tableData.getColumns(), createLookup(artifactRow), iconPath, backgroundTasksPool);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||
@@ -47,8 +48,8 @@ public class DirectoryNode extends BaseNode<SearchResultsDTO, DirectoryRowDTO> i
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public DirectoryNode(SearchResultsDTO results, DirectoryRowDTO row) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row);
|
||||
public DirectoryNode(SearchResultsDTO results, DirectoryRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row, backgroundTasksPool);
|
||||
setName(ContentNodeUtil.getContentName(row.getContent().getId()));
|
||||
setDisplayName(ContentNodeUtil.getContentDisplayName(row.getContent().getName()));
|
||||
setShortDescription(ContentNodeUtil.getContentDisplayName(row.getContent().getName()));
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.Action;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -69,13 +70,13 @@ public class FileNode extends BaseNode<SearchResultsDTO, FileRowDTO> implements
|
||||
private final FileRowDTO fileData;
|
||||
private final List<ColumnKey> columns;
|
||||
|
||||
public FileNode(SearchResultsDTO results, FileRowDTO file) {
|
||||
this(results, file, true);
|
||||
public FileNode(SearchResultsDTO results, FileRowDTO file, ExecutorService backgroundTasksPool) {
|
||||
this(results, file, true, backgroundTasksPool);
|
||||
}
|
||||
|
||||
public FileNode(SearchResultsDTO results, FileRowDTO file, boolean directoryBrowseMode) {
|
||||
public FileNode(SearchResultsDTO results, FileRowDTO file, boolean directoryBrowseMode, ExecutorService backgroundTasksPool) {
|
||||
// GVDTODO: at some point, this leaf will need to allow for children
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(file.getAbstractFile()), results, file);
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(file.getAbstractFile()), results, file, backgroundTasksPool);
|
||||
setIcon(file);
|
||||
setName(ContentNodeUtil.getContentName(file.getId()));
|
||||
setDisplayName(ContentNodeUtil.getContentDisplayName(file.getFileName()));
|
||||
@@ -266,8 +267,8 @@ public class FileNode extends BaseNode<SearchResultsDTO, FileRowDTO> implements
|
||||
|
||||
private final LayoutFileRowDTO layoutFileRow;
|
||||
|
||||
public LayoutFileNode(SearchResultsDTO results, LayoutFileRowDTO file) {
|
||||
super(results, file, true);
|
||||
public LayoutFileNode(SearchResultsDTO results, LayoutFileRowDTO file, ExecutorService backgroundTasksPool) {
|
||||
super(results, file, true, backgroundTasksPool);
|
||||
layoutFileRow = file;
|
||||
}
|
||||
|
||||
@@ -296,8 +297,8 @@ public class FileNode extends BaseNode<SearchResultsDTO, FileRowDTO> implements
|
||||
*/
|
||||
public static class SlackFileNode extends FileNode {
|
||||
|
||||
public SlackFileNode(SearchResultsDTO results, SlackFileRowDTO file) {
|
||||
super(results, file);
|
||||
public SlackFileNode(SearchResultsDTO results, SlackFileRowDTO file, ExecutorService backgroundTasksPool) {
|
||||
super(results, file, backgroundTasksPool);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.NbBundle;
|
||||
@@ -42,8 +43,8 @@ public class ImageNode extends BaseNode<SearchResultsDTO, ImageRowDTO> implement
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public ImageNode(SearchResultsDTO results, ImageRowDTO row) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row);
|
||||
public ImageNode(SearchResultsDTO results, ImageRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row, backgroundTasksPool);
|
||||
setName(ContentNodeUtil.getContentName(row.getContent().getId()));
|
||||
setDisplayName(row.getContent().getName());
|
||||
setShortDescription(row.getContent().getName());
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.logging.Level;
|
||||
@@ -43,7 +44,6 @@ import org.sleuthkit.autopsy.datamodel.TskContentItem;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.ContentRowDTO.OsAccountRowDTO;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.OsAccountsDAO;
|
||||
import org.sleuthkit.autopsy.mainui.datamodel.SearchResultsDTO;
|
||||
import static org.sleuthkit.autopsy.mainui.nodes.BaseNode.backgroundTasksPool;
|
||||
import org.sleuthkit.autopsy.mainui.sco.SCOSupporter;
|
||||
import org.sleuthkit.autopsy.mainui.sco.SCOUtils;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
@@ -64,11 +64,12 @@ public class OsAccountNode extends BaseNode<SearchResultsDTO, OsAccountRowDTO> i
|
||||
|
||||
private FutureTask<String> realmFutureTask = null;
|
||||
|
||||
public OsAccountNode(SearchResultsDTO results, OsAccountRowDTO rowData) {
|
||||
public OsAccountNode(SearchResultsDTO results, OsAccountRowDTO rowData, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF,
|
||||
Lookups.fixed(rowData.getContent(), new TskContentItem<>(rowData.getContent())),
|
||||
results,
|
||||
rowData);
|
||||
rowData,
|
||||
backgroundTasksPool);
|
||||
String name = rowData.getContent().getName();
|
||||
setName(ContentNodeUtil.getContentName(rowData.getContent().getId()));
|
||||
setDisplayName(name);
|
||||
@@ -112,9 +113,10 @@ public class OsAccountNode extends BaseNode<SearchResultsDTO, OsAccountRowDTO> i
|
||||
realmFutureTask = null;
|
||||
}
|
||||
|
||||
if ((realmFutureTask == null || realmFutureTask.isDone())) {
|
||||
ExecutorService threadPool = getTaskPool();
|
||||
if ((threadPool != null && !threadPool.isShutdown() && !threadPool.isTerminated()) && (realmFutureTask == null || realmFutureTask.isDone())) {
|
||||
realmFutureTask = new FutureTask<>(new RealmFetcher<>(new WeakReference<>(this)), "");
|
||||
backgroundTasksPool.submit(realmFutureTask);
|
||||
threadPool.submit(realmFutureTask);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||
@@ -40,10 +41,10 @@ public class PoolNode extends BaseNode<SearchResultsDTO, PoolRowDTO> implements
|
||||
* @param results Search Result DTO.
|
||||
* @param row Pool table row DTO.
|
||||
*/
|
||||
public PoolNode(SearchResultsDTO results, PoolRowDTO row) {
|
||||
public PoolNode(SearchResultsDTO results, PoolRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF,
|
||||
Lookups.fixed(row.getContent(), new TskContentItem<>(row.getContent())),
|
||||
results, row);
|
||||
results, row, backgroundTasksPool);
|
||||
|
||||
String name = row.getContent().getType().getName();
|
||||
setName(ContentNodeUtil.getContentName(row.getContent().getId()));
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
@@ -60,9 +61,12 @@ public class SearchResultChildFactory extends ChildFactory<ChildKey> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SearchResultChildFactory.class.getName());
|
||||
private SearchResultsDTO results;
|
||||
|
||||
private final ExecutorService nodeThreadPool;
|
||||
|
||||
public SearchResultChildFactory(SearchResultsDTO initialResults) {
|
||||
public SearchResultChildFactory(SearchResultsDTO initialResults, ExecutorService nodeThreadPool) {
|
||||
this.results = initialResults;
|
||||
this.nodeThreadPool = nodeThreadPool;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,37 +89,37 @@ public class SearchResultChildFactory extends ChildFactory<ChildKey> {
|
||||
String typeId = key.getRow().getTypeId();
|
||||
try {
|
||||
if (DataArtifactRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new DataArtifactNode((DataArtifactTableSearchResultsDTO) key.getSearchResults(), (DataArtifactRowDTO) key.getRow());
|
||||
return new DataArtifactNode((DataArtifactTableSearchResultsDTO) key.getSearchResults(), (DataArtifactRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (FileRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new FileNode(key.getSearchResults(), (FileRowDTO) key.getRow(), true);
|
||||
return new FileNode(key.getSearchResults(), (FileRowDTO) key.getRow(), true, nodeThreadPool);
|
||||
} else if (AnalysisResultRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new AnalysisResultNode((AnalysisResultTableSearchResultsDTO) key.getSearchResults(), (AnalysisResultRowDTO) key.getRow());
|
||||
return new AnalysisResultNode((AnalysisResultTableSearchResultsDTO) key.getSearchResults(), (AnalysisResultRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (ContentTagsRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new ContentTagNode(key.getSearchResults(), (ContentTagsRowDTO) key.getRow());
|
||||
return new ContentTagNode(key.getSearchResults(), (ContentTagsRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (BlackboardArtifactTagsRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new BlackboardArtifactTagNode(key.getSearchResults(), (BlackboardArtifactTagsRowDTO) key.getRow());
|
||||
return new BlackboardArtifactTagNode(key.getSearchResults(), (BlackboardArtifactTagsRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (ImageRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new ImageNode(key.getSearchResults(), (ImageRowDTO) key.getRow());
|
||||
return new ImageNode(key.getSearchResults(), (ImageRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (LocalFileDataSourceRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new LocalFileDataSourceNode(key.getSearchResults(), (LocalFileDataSourceRowDTO) key.getRow());
|
||||
return new LocalFileDataSourceNode(key.getSearchResults(), (LocalFileDataSourceRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (DirectoryRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new DirectoryNode(key.getSearchResults(), (DirectoryRowDTO) key.getRow());
|
||||
return new DirectoryNode(key.getSearchResults(), (DirectoryRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (VolumeRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new VolumeNode(key.getSearchResults(), (VolumeRowDTO) key.getRow());
|
||||
return new VolumeNode(key.getSearchResults(), (VolumeRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (LocalDirectoryRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new LocalDirectoryNode(key.getSearchResults(), (LocalDirectoryRowDTO) key.getRow());
|
||||
return new LocalDirectoryNode(key.getSearchResults(), (LocalDirectoryRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (VirtualDirectoryRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new VirtualDirectoryNode(key.getSearchResults(), (VirtualDirectoryRowDTO) key.getRow());
|
||||
return new VirtualDirectoryNode(key.getSearchResults(), (VirtualDirectoryRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (LayoutFileRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new LayoutFileNode(key.getSearchResults(), (LayoutFileRowDTO) key.getRow());
|
||||
return new LayoutFileNode(key.getSearchResults(), (LayoutFileRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (PoolRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new PoolNode(key.getSearchResults(), (PoolRowDTO) key.getRow());
|
||||
return new PoolNode(key.getSearchResults(), (PoolRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (SlackFileRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new SlackFileNode(key.getSearchResults(), (SlackFileRowDTO) key.getRow());
|
||||
return new SlackFileNode(key.getSearchResults(), (SlackFileRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (OsAccountRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new OsAccountNode(key.getSearchResults(), (OsAccountRowDTO) key.getRow());
|
||||
return new OsAccountNode(key.getSearchResults(), (OsAccountRowDTO) key.getRow(), nodeThreadPool);
|
||||
} else if (CreditCardByFileRowDTO.getTypeIdForClass().equals(typeId)) {
|
||||
return new CreditCardByFileNode(key.getSearchResults(), (CreditCardByFileRowDTO) key.getRow());
|
||||
return new CreditCardByFileNode(key.getSearchResults(), (CreditCardByFileRowDTO) key.getRow(), nodeThreadPool);
|
||||
}else {
|
||||
logger.log(Level.WARNING, MessageFormat.format("No known node for type id: {0} provided by row result: {1}", typeId, key.getRow()));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Sheet;
|
||||
@@ -38,8 +39,8 @@ public class SearchResultRootNode extends AbstractNode {
|
||||
// therefore is not included in the equals and hashcode methods.
|
||||
private ChildNodeSelectionInfo childNodeSelectionInfo;
|
||||
|
||||
public SearchResultRootNode(SearchResultsDTO initialResults) {
|
||||
this(initialResults, new SearchResultChildFactory(initialResults));
|
||||
public SearchResultRootNode(SearchResultsDTO initialResults, ExecutorService nodeThreadPool) {
|
||||
this(initialResults, new SearchResultChildFactory(initialResults, nodeThreadPool));
|
||||
}
|
||||
|
||||
private SearchResultRootNode(SearchResultsDTO initialResults, SearchResultChildFactory factory) {
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||
@@ -45,8 +45,8 @@ abstract class SpecialDirectoryNode extends BaseNode<SearchResultsDTO, ContentRo
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
private SpecialDirectoryNode(SearchResultsDTO results, ContentRowDTO<? extends SpecialDirectory> row) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row);
|
||||
private SpecialDirectoryNode(SearchResultsDTO results, ContentRowDTO<? extends SpecialDirectory> row, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row, backgroundTasksPool);
|
||||
setName(ContentNodeUtil.getContentName(row.getContent().getId()));
|
||||
setDisplayName(row.getContent().getName());
|
||||
setShortDescription(row.getContent().getName());
|
||||
@@ -105,8 +105,8 @@ abstract class SpecialDirectoryNode extends BaseNode<SearchResultsDTO, ContentRo
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public LocalDirectoryNode(SearchResultsDTO results, LocalDirectoryRowDTO row) {
|
||||
super(results, row);
|
||||
public LocalDirectoryNode(SearchResultsDTO results, LocalDirectoryRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(results, row, backgroundTasksPool);
|
||||
setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png");
|
||||
}
|
||||
}
|
||||
@@ -122,8 +122,8 @@ abstract class SpecialDirectoryNode extends BaseNode<SearchResultsDTO, ContentRo
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public VirtualDirectoryNode(SearchResultsDTO results, VirtualDirectoryRowDTO row) {
|
||||
super(results, row);
|
||||
public VirtualDirectoryNode(SearchResultsDTO results, VirtualDirectoryRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(results, row, backgroundTasksPool);
|
||||
setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-virtual.png");
|
||||
}
|
||||
}
|
||||
@@ -141,8 +141,8 @@ abstract class SpecialDirectoryNode extends BaseNode<SearchResultsDTO, ContentRo
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public LocalFileDataSourceNode(SearchResultsDTO results, LocalFileDataSourceRowDTO row) {
|
||||
super(results, row);
|
||||
public LocalFileDataSourceNode(SearchResultsDTO results, LocalFileDataSourceRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(results, row, backgroundTasksPool);
|
||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/fileset-icon-16.png"); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.mainui.nodes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
@@ -44,8 +45,8 @@ public class VolumeNode extends BaseNode<SearchResultsDTO, VolumeRowDTO> impleme
|
||||
* @param results The search result DTO.
|
||||
* @param row The table row DTO.
|
||||
*/
|
||||
public VolumeNode(SearchResultsDTO results, VolumeRowDTO row) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row);
|
||||
public VolumeNode(SearchResultsDTO results, VolumeRowDTO row, ExecutorService backgroundTasksPool) {
|
||||
super(Children.LEAF, ContentNodeUtil.getLookup(row.getContent()), results, row, backgroundTasksPool);
|
||||
setIconBaseWithExtension(NodeIconUtil.VOLUME.getPath()); //NON-NLS
|
||||
|
||||
// use first cell value for display name
|
||||
|
||||
Reference in New Issue
Block a user