From babdf9d3460d1a2a896119249a04971de9432a87 Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Fri, 9 Mar 2018 10:42:34 -0700 Subject: [PATCH 01/10] stubbing out new feature --- .../commonfilesearch/Bundle.properties | 1 + .../commonfilesearch/CommonFilesChildren.java | 49 +++++++++++++++++++ .../commonfilesearch/CommonFilesNode.java | 45 +++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties new file mode 100644 index 0000000000..9b1c99c32b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties @@ -0,0 +1 @@ +CommonFilesNode.getName.text=Common Files \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java new file mode 100644 index 0000000000..11cfd5c967 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java @@ -0,0 +1,49 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.commonfilesearch; + +import java.util.List; +import org.sleuthkit.datamodel.AbstractFile; +import org.openide.nodes.Children; +import org.openide.nodes.Node; + +/** + * + * @author bsweeney + */ +class CommonFilesChildren extends Children.Keys{ + + CommonFilesChildren(boolean lazy, List fileList){ + super(lazy); + this.setKeys(fileList); + } + + @Override + protected Node[] createNodes(AbstractFile t) { + + if(t.isDir()){ + //TODO log an error ??? + + } else { + + } + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java new file mode 100644 index 0000000000..ff52d8e19e --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java @@ -0,0 +1,45 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.commonfilesearch; + +import java.util.List; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.util.NbBundle; +import org.sleuthkit.datamodel.AbstractFile; + +/** + * + * @author bsweeney + */ +class CommonFilesNode extends AbstractNode { + + private CommonFilesChildren children; + + public CommonFilesNode(List keys) { + super(new CommonFilesChildren(true, keys)); + this.children = (CommonFilesChildren) this.getChildren(); + } + + @Override + public String getName(){ + return NbBundle.getMessage(this.getClass(), "CommonFilesNode.getName.text"); + } + +} From d7c610d96af3b82c8f534f132d2e10da4fd78f7c Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Fri, 9 Mar 2018 10:49:04 -0700 Subject: [PATCH 02/10] private member made final --- .../org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java index ff52d8e19e..e6d8c26995 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java @@ -30,7 +30,7 @@ import org.sleuthkit.datamodel.AbstractFile; */ class CommonFilesNode extends AbstractNode { - private CommonFilesChildren children; + private final CommonFilesChildren children; public CommonFilesNode(List keys) { super(new CommonFilesChildren(true, keys)); From 043334b82e65f8d25cf3351ceac3b248d045437a Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Fri, 9 Mar 2018 10:42:34 -0700 Subject: [PATCH 03/10] stubbing out new feature --- .../commonfilesearch/Bundle.properties | 1 + .../commonfilesearch/CommonFilesChildren.java | 49 +++++++++++++++++++ .../commonfilesearch/CommonFilesNode.java | 45 +++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java create mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties new file mode 100644 index 0000000000..9b1c99c32b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/Bundle.properties @@ -0,0 +1 @@ +CommonFilesNode.getName.text=Common Files \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java new file mode 100644 index 0000000000..11cfd5c967 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java @@ -0,0 +1,49 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.commonfilesearch; + +import java.util.List; +import org.sleuthkit.datamodel.AbstractFile; +import org.openide.nodes.Children; +import org.openide.nodes.Node; + +/** + * + * @author bsweeney + */ +class CommonFilesChildren extends Children.Keys{ + + CommonFilesChildren(boolean lazy, List fileList){ + super(lazy); + this.setKeys(fileList); + } + + @Override + protected Node[] createNodes(AbstractFile t) { + + if(t.isDir()){ + //TODO log an error ??? + + } else { + + } + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java new file mode 100644 index 0000000000..ff52d8e19e --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java @@ -0,0 +1,45 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.commonfilesearch; + +import java.util.List; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.util.NbBundle; +import org.sleuthkit.datamodel.AbstractFile; + +/** + * + * @author bsweeney + */ +class CommonFilesNode extends AbstractNode { + + private CommonFilesChildren children; + + public CommonFilesNode(List keys) { + super(new CommonFilesChildren(true, keys)); + this.children = (CommonFilesChildren) this.getChildren(); + } + + @Override + public String getName(){ + return NbBundle.getMessage(this.getClass(), "CommonFilesNode.getName.text"); + } + +} From aba1c7bd4ce2292fb8f7a8ff4f45f8d9d9cb857a Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Fri, 9 Mar 2018 10:49:04 -0700 Subject: [PATCH 04/10] private member made final --- .../org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java index ff52d8e19e..e6d8c26995 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesNode.java @@ -30,7 +30,7 @@ import org.sleuthkit.datamodel.AbstractFile; */ class CommonFilesNode extends AbstractNode { - private CommonFilesChildren children; + private final CommonFilesChildren children; public CommonFilesNode(List keys) { super(new CommonFilesChildren(true, keys)); From b488dee2cdceb96a6030ccb3161b724a61f55acb Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Wed, 30 May 2018 12:26:12 -0700 Subject: [PATCH 05/10] Add progress handler to search to inform user Autopsy is busy, with 3 stages. # Conflicts: # Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java --- .../commonfilesearch/CommonFilesPanel.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 3ce2c34e26..5fe62496a2 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -22,12 +22,11 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.Map; -import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.logging.Level; -import javax.swing.ComboBoxModel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; +import org.netbeans.api.progress.ProgressHandle; import org.openide.explorer.ExplorerManager; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; @@ -164,6 +163,9 @@ public final class CommonFilesPanel extends javax.swing.JPanel { "CommonFilesPanel.search.results.titleAll=Common Files (All Data Sources)", "CommonFilesPanel.search.results.titleSingle=Common Files (Match Within Data Source: %s)", "CommonFilesPanel.search.results.pathText=Common Files Search Results", + "CommonFilesPanel.search.done.searchProgress1=Gathering Common Files Search Results.", + "CommonFilesPanel.search.done.searchProgress2=Generating Common Files Search Results.", + "CommonFilesPanel.search.done.searchProgress3=Displaying Common Files Search Results.", "CommonFilesPanel.search.done.tskCoreException=Unable to run query against DB.", "CommonFilesPanel.search.done.noCurrentCaseException=Unable to open case file.", "CommonFilesPanel.search.done.exception=Unexpected exception running Common Files Search.", @@ -175,7 +177,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel { new SwingWorker() { private String tabTitle; - + private ProgressHandle progress; + private void setTitleForAllDataSources() { this.tabTitle = Bundle.CommonFilesPanel_search_results_titleAll(); } @@ -202,7 +205,11 @@ public final class CommonFilesPanel extends javax.swing.JPanel { @Override @SuppressWarnings({"BoxedValueEquality", "NumberEquality"}) - protected CommonFilesMetadata doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException { + protected CommonFilesMetadata doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException, Exception { + progress = ProgressHandle.createHandle(Bundle.CommonFilesPanel_search_done_searchProgress1()); + progress.start(); + progress.switchToIndeterminate(); + Long dataSourceId = determineDataSourceId(); CommonFilesMetadataBuilder builder; @@ -237,8 +244,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel { protected void done() { try { super.done(); - - CommonFilesMetadata metadata = get(); + progress.setDisplayName(Bundle.CommonFilesPanel_search_done_searchProgress2()); + CommonFilesMetadata metadata = get(); CommonFilesNode commonFilesNode = new CommonFilesNode(metadata); @@ -250,9 +257,9 @@ public final class CommonFilesPanel extends javax.swing.JPanel { Collection viewers = new ArrayList<>(1); viewers.add(table); - + progress.setDisplayName(Bundle.CommonFilesPanel_search_done_searchProgress3()); DataResultTopComponent.createInstance(tabTitle, pathText, tableFilterWithDescendantsNode, metadata.size(), viewers); - + progress.finish(); } catch (InterruptedException ex) { LOGGER.log(Level.SEVERE, "Interrupted while loading Common Files", ex); MessageNotifyUtil.Message.error(Bundle.CommonFilesPanel_search_done_interupted()); From b6d8bf7a1d68e5d170800041e63cd485c2bde831 Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Thu, 7 Jun 2018 08:56:33 -0700 Subject: [PATCH 06/10] Wrapper Child factory in callable to further delay execution. Still doesn't make Search lazy since DataResultFilterNode will gather all children and do lookups which triggers the children queries. --- .../sleuthkit/autopsy/datamodel/Md5Node.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java index 96de7eba36..38a3f78b64 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java @@ -22,6 +22,7 @@ package org.sleuthkit.autopsy.datamodel; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; import java.util.logging.Level; import org.openide.nodes.ChildFactory; import org.openide.nodes.Children; @@ -53,16 +54,33 @@ public class Md5Node extends DisplayableItemNode { private final String dataSources; public Md5Node(Md5Metadata data) { - super(Children.create( - new FileInstanceNodeFactory(data), true), - Lookups.singleton(data.getMd5())); - + super(Children.createLazy(new Md5ChildCallable(data)), Lookups.singleton(data.getMd5())); this.commonFileCount = data.size(); this.dataSources = String.join(", ", data.getDataSources()); this.md5Hash = data.getMd5(); this.setDisplayName(this.md5Hash); } + + private static class Md5ChildCallable implements Callable { + private final Md5Metadata key; + private Md5ChildCallable(Md5Metadata key) { + this.key = key; + } + @Override + public Children call() throws Exception { + //Check, somehow, that your key has children, + //e.g., create "hasChildren" on the object + //to look in the database to see whether + //the object has children; + //if it doesn't have children, return a leaf: + if (key.getMetadata().isEmpty()) { + return Children.LEAF; + } else { + return Children.create(new FileInstanceNodeFactory(key), true); + } + } + } int getCommonFileCount() { return this.commonFileCount; From d376fbaeb051345846bbdd5ea074e59a0d17057a Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Thu, 14 Jun 2018 12:35:01 -0700 Subject: [PATCH 07/10] Cleanup. --- .../sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java | 3 +++ Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 5fe62496a2..23c0f60afc 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -22,14 +22,17 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.logging.Level; +import javax.swing.ComboBoxModel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import org.netbeans.api.progress.ProgressHandle; import org.openide.explorer.ExplorerManager; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java index 38a3f78b64..d32c77ca13 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java @@ -69,10 +69,7 @@ public class Md5Node extends DisplayableItemNode { } @Override public Children call() throws Exception { - //Check, somehow, that your key has children, - //e.g., create "hasChildren" on the object - //to look in the database to see whether - //the object has children; + //Check that the key has children, //if it doesn't have children, return a leaf: if (key.getMetadata().isEmpty()) { return Children.LEAF; From a51a2da70af156cda2187ba075256b262e3e5ce1 Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Thu, 14 Jun 2018 20:49:30 -0700 Subject: [PATCH 08/10] Codeacy fixes. --- .../sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java | 2 +- Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 23c0f60afc..12324b6b90 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -208,7 +208,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel { @Override @SuppressWarnings({"BoxedValueEquality", "NumberEquality"}) - protected CommonFilesMetadata doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException, Exception { + protected CommonFilesMetadata doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { progress = ProgressHandle.createHandle(Bundle.CommonFilesPanel_search_done_searchProgress1()); progress.start(); progress.switchToIndeterminate(); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java index d32c77ca13..3960c27eee 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java @@ -62,6 +62,10 @@ public class Md5Node extends DisplayableItemNode { this.setDisplayName(this.md5Hash); } + /** + * Callable wrapper to further delay lazy ChildFactory creation + * and createNodes() call once lazy loading is functional. + */ private static class Md5ChildCallable implements Callable { private final Md5Metadata key; private Md5ChildCallable(Md5Metadata key) { From 124b0cc602cb5389300d11294b8e3ab53f096060 Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Tue, 19 Jun 2018 09:59:44 -0700 Subject: [PATCH 09/10] Revert "Wrapper Child factory in callable to further delay execution. Still doesn't make Search lazy since DataResultFilterNode will gather all children and do lookups which triggers the children queries." This reverts commit b6d8bf7a1d68e5d170800041e63cd485c2bde831. # Conflicts: # Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java --- .../commonfilesearch/CommonFilesChildren.java | 49 ------------------- .../sleuthkit/autopsy/datamodel/Md5Node.java | 27 ++-------- 2 files changed, 4 insertions(+), 72 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java deleted file mode 100644 index 11cfd5c967..0000000000 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesChildren.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.commonfilesearch; - -import java.util.List; -import org.sleuthkit.datamodel.AbstractFile; -import org.openide.nodes.Children; -import org.openide.nodes.Node; - -/** - * - * @author bsweeney - */ -class CommonFilesChildren extends Children.Keys{ - - CommonFilesChildren(boolean lazy, List fileList){ - super(lazy); - this.setKeys(fileList); - } - - @Override - protected Node[] createNodes(AbstractFile t) { - - if(t.isDir()){ - //TODO log an error ??? - - } else { - - } - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - -} diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java index 3960c27eee..96de7eba36 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Md5Node.java @@ -22,7 +22,6 @@ package org.sleuthkit.autopsy.datamodel; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; import java.util.logging.Level; import org.openide.nodes.ChildFactory; import org.openide.nodes.Children; @@ -54,34 +53,16 @@ public class Md5Node extends DisplayableItemNode { private final String dataSources; public Md5Node(Md5Metadata data) { - super(Children.createLazy(new Md5ChildCallable(data)), Lookups.singleton(data.getMd5())); + super(Children.create( + new FileInstanceNodeFactory(data), true), + Lookups.singleton(data.getMd5())); + this.commonFileCount = data.size(); this.dataSources = String.join(", ", data.getDataSources()); this.md5Hash = data.getMd5(); this.setDisplayName(this.md5Hash); } - - /** - * Callable wrapper to further delay lazy ChildFactory creation - * and createNodes() call once lazy loading is functional. - */ - private static class Md5ChildCallable implements Callable { - private final Md5Metadata key; - private Md5ChildCallable(Md5Metadata key) { - this.key = key; - } - @Override - public Children call() throws Exception { - //Check that the key has children, - //if it doesn't have children, return a leaf: - if (key.getMetadata().isEmpty()) { - return Children.LEAF; - } else { - return Children.create(new FileInstanceNodeFactory(key), true); - } - } - } int getCommonFileCount() { return this.commonFileCount; From 0bfd64f156fad4e19115c5e67af58240c54b10ac Mon Sep 17 00:00:00 2001 From: Andrew Ziehl Date: Tue, 19 Jun 2018 10:24:15 -0700 Subject: [PATCH 10/10] Update progress handler text variable names, remove second text update. --- .../autopsy/commonfilesearch/CommonFilesPanel.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java index 12324b6b90..556b25fa52 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesPanel.java @@ -166,9 +166,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel { "CommonFilesPanel.search.results.titleAll=Common Files (All Data Sources)", "CommonFilesPanel.search.results.titleSingle=Common Files (Match Within Data Source: %s)", "CommonFilesPanel.search.results.pathText=Common Files Search Results", - "CommonFilesPanel.search.done.searchProgress1=Gathering Common Files Search Results.", - "CommonFilesPanel.search.done.searchProgress2=Generating Common Files Search Results.", - "CommonFilesPanel.search.done.searchProgress3=Displaying Common Files Search Results.", + "CommonFilesPanel.search.done.searchProgressGathering=Gathering Common Files Search Results.", + "CommonFilesPanel.search.done.searchProgressDisplay=Displaying Common Files Search Results.", "CommonFilesPanel.search.done.tskCoreException=Unable to run query against DB.", "CommonFilesPanel.search.done.noCurrentCaseException=Unable to open case file.", "CommonFilesPanel.search.done.exception=Unexpected exception running Common Files Search.", @@ -209,7 +208,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel { @Override @SuppressWarnings({"BoxedValueEquality", "NumberEquality"}) protected CommonFilesMetadata doInBackground() throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException { - progress = ProgressHandle.createHandle(Bundle.CommonFilesPanel_search_done_searchProgress1()); + progress = ProgressHandle.createHandle(Bundle.CommonFilesPanel_search_done_searchProgressGathering()); progress.start(); progress.switchToIndeterminate(); @@ -247,8 +246,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel { protected void done() { try { super.done(); - progress.setDisplayName(Bundle.CommonFilesPanel_search_done_searchProgress2()); - CommonFilesMetadata metadata = get(); + CommonFilesMetadata metadata = get(); CommonFilesNode commonFilesNode = new CommonFilesNode(metadata); @@ -260,7 +258,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel { Collection viewers = new ArrayList<>(1); viewers.add(table); - progress.setDisplayName(Bundle.CommonFilesPanel_search_done_searchProgress3()); + progress.setDisplayName(Bundle.CommonFilesPanel_search_done_searchProgressDisplay()); DataResultTopComponent.createInstance(tabTitle, pathText, tableFilterWithDescendantsNode, metadata.size(), viewers); progress.finish(); } catch (InterruptedException ex) {