Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AnalysisPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.datasourcesummary.ui;
20 
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.function.Function;
24 import org.apache.commons.lang3.tuple.Pair;
25 import org.openide.util.NbBundle.Messages;
34 import org.sleuthkit.datamodel.DataSource;
35 
40 @Messages({
41  "AnalysisPanel_keyColumn_title=Name",
42  "AnalysisPanel_countColumn_title=Count",
43  "AnalysisPanel_keywordSearchModuleName=Keyword Search"
44 })
45 public class AnalysisPanel extends BaseDataSourceSummaryPanel {
46 
47  private static final long serialVersionUID = 1L;
48 
49  private static final String KEYWORD_SEARCH_MODULE_NAME = Bundle.AnalysisPanel_keywordSearchModuleName();
50  private static final String KEYWORD_SEARCH_FACTORY = "org.sleuthkit.autopsy.keywordsearch.KeywordSearchModuleFactory";
51 
52  private static final String INTERESTING_ITEM_MODULE_NAME = new InterestingItemsIngestModuleFactory().getModuleDisplayName();
53  private static final String INTERESTING_ITEM_FACTORY = InterestingItemsIngestModuleFactory.class.getCanonicalName();
54 
55  private static final String HASHSET_MODULE_NAME = HashLookupModuleFactory.getModuleName();
56  private static final String HASHSET_FACTORY = HashLookupModuleFactory.class.getCanonicalName();
57 
61  private static final List<ColumnModel<Pair<String, Long>>> DEFAULT_COLUMNS = Arrays.asList(
62  new ColumnModel<>(
63  Bundle.AnalysisPanel_keyColumn_title(),
64  (pair) -> new DefaultCellModel(pair.getKey()),
65  300
66  ),
67  new ColumnModel<>(
68  Bundle.AnalysisPanel_countColumn_title(),
69  (pair) -> new DefaultCellModel(String.valueOf(pair.getValue())),
70  100
71  )
72  );
73 
74  private static final Function<Pair<String, Long>, String> DEFAULT_KEY_PROVIDER = (pair) -> pair.getKey();
75 
76  private final JTablePanel<Pair<String, Long>> hashsetHitsTable
77  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
78  .setKeyFunction(DEFAULT_KEY_PROVIDER);
79 
80  private final JTablePanel<Pair<String, Long>> keywordHitsTable
81  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
82  .setKeyFunction(DEFAULT_KEY_PROVIDER);
83 
84  private final JTablePanel<Pair<String, Long>> interestingItemsTable
85  = JTablePanel.getJTablePanel(DEFAULT_COLUMNS)
86  .setKeyFunction(DEFAULT_KEY_PROVIDER);
87 
88  private final List<JTablePanel<?>> tables = Arrays.asList(
89  hashsetHitsTable,
90  keywordHitsTable,
91  interestingItemsTable
92  );
93 
94  private final IngestRunningLabel ingestRunningLabel = new IngestRunningLabel();
95 
96 
101  private final List<DataFetchWorker.DataFetchComponents<DataSource, ?>> dataFetchComponents;
102 
106  public AnalysisPanel() {
107  this(new AnalysisSummary());
108  }
109 
110  public AnalysisPanel(AnalysisSummary analysisData) {
111  super(analysisData);
112 
113  // set up data acquisition methods
114  dataFetchComponents = Arrays.asList(
115  // hashset hits loading components
117  (dataSource) -> analysisData.getHashsetCounts(dataSource),
118  (result) -> showResultWithModuleCheck(hashsetHitsTable, result, HASHSET_FACTORY, HASHSET_MODULE_NAME)),
119  // keyword hits loading components
121  (dataSource) -> analysisData.getKeywordCounts(dataSource),
122  (result) -> showResultWithModuleCheck(keywordHitsTable, result, KEYWORD_SEARCH_FACTORY, KEYWORD_SEARCH_MODULE_NAME)),
123  // interesting item hits loading components
125  (dataSource) -> analysisData.getInterestingItemCounts(dataSource),
126  (result) -> showResultWithModuleCheck(interestingItemsTable, result, INTERESTING_ITEM_FACTORY, INTERESTING_ITEM_MODULE_NAME))
127  );
128 
129  initComponents();
130  }
131 
132 
133  @Override
134  public void close() {
135  ingestRunningLabel.unregister();
136  super.close();
137  }
138 
139 
140  @Override
141  protected void fetchInformation(DataSource dataSource) {
142  fetchInformation(dataFetchComponents, dataSource);
143  }
144 
145  @Override
146  protected void onNewDataSource(DataSource dataSource) {
147  onNewDataSource(dataFetchComponents, tables, dataSource);
148  }
149 
155  @SuppressWarnings("unchecked")
156  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
157  private void initComponents() {
158 
159  javax.swing.JScrollPane mainScrollPane = new javax.swing.JScrollPane();
160  javax.swing.JPanel mainContentPanel = new javax.swing.JPanel();
161  javax.swing.JPanel ingestRunningPanel = ingestRunningLabel;
162  javax.swing.JLabel hashsetHitsLabel = new javax.swing.JLabel();
163  javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
164  javax.swing.JPanel hashSetHitsPanel = hashsetHitsTable;
165  javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20), new java.awt.Dimension(32767, 20));
166  javax.swing.JLabel keywordHitsLabel = new javax.swing.JLabel();
167  javax.swing.Box.Filler filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
168  javax.swing.JPanel keywordHitsPanel = keywordHitsTable;
169  javax.swing.Box.Filler filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 20), new java.awt.Dimension(0, 20), new java.awt.Dimension(32767, 20));
170  javax.swing.JLabel interestingItemLabel = new javax.swing.JLabel();
171  javax.swing.Box.Filler filler6 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 2), new java.awt.Dimension(0, 2), new java.awt.Dimension(32767, 2));
172  javax.swing.JPanel interestingItemPanel = interestingItemsTable;
173  javax.swing.Box.Filler filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
174 
175  mainContentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
176  mainContentPanel.setMaximumSize(new java.awt.Dimension(32767, 452));
177  mainContentPanel.setMinimumSize(new java.awt.Dimension(200, 452));
178  mainContentPanel.setLayout(new javax.swing.BoxLayout(mainContentPanel, javax.swing.BoxLayout.PAGE_AXIS));
179 
180  ingestRunningPanel.setAlignmentX(0.0F);
181  ingestRunningPanel.setMaximumSize(new java.awt.Dimension(32767, 25));
182  ingestRunningPanel.setMinimumSize(new java.awt.Dimension(10, 25));
183  ingestRunningPanel.setPreferredSize(new java.awt.Dimension(10, 25));
184  mainContentPanel.add(ingestRunningPanel);
185 
186  org.openide.awt.Mnemonics.setLocalizedText(hashsetHitsLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.hashsetHitsLabel.text")); // NOI18N
187  mainContentPanel.add(hashsetHitsLabel);
188  mainContentPanel.add(filler1);
189 
190  hashSetHitsPanel.setAlignmentX(0.0F);
191  hashSetHitsPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
192  hashSetHitsPanel.setMinimumSize(new java.awt.Dimension(10, 106));
193  hashSetHitsPanel.setPreferredSize(new java.awt.Dimension(10, 106));
194  mainContentPanel.add(hashSetHitsPanel);
195  mainContentPanel.add(filler2);
196 
197  org.openide.awt.Mnemonics.setLocalizedText(keywordHitsLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.keywordHitsLabel.text")); // NOI18N
198  mainContentPanel.add(keywordHitsLabel);
199  mainContentPanel.add(filler4);
200 
201  keywordHitsPanel.setAlignmentX(0.0F);
202  keywordHitsPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
203  keywordHitsPanel.setMinimumSize(new java.awt.Dimension(10, 106));
204  keywordHitsPanel.setPreferredSize(new java.awt.Dimension(10, 106));
205  mainContentPanel.add(keywordHitsPanel);
206  mainContentPanel.add(filler5);
207 
208  org.openide.awt.Mnemonics.setLocalizedText(interestingItemLabel, org.openide.util.NbBundle.getMessage(AnalysisPanel.class, "AnalysisPanel.interestingItemLabel.text")); // NOI18N
209  mainContentPanel.add(interestingItemLabel);
210  mainContentPanel.add(filler6);
211 
212  interestingItemPanel.setAlignmentX(0.0F);
213  interestingItemPanel.setMaximumSize(new java.awt.Dimension(32767, 106));
214  interestingItemPanel.setMinimumSize(new java.awt.Dimension(10, 106));
215  interestingItemPanel.setPreferredSize(new java.awt.Dimension(10, 106));
216  mainContentPanel.add(interestingItemPanel);
217  mainContentPanel.add(filler3);
218 
219  mainScrollPane.setViewportView(mainContentPanel);
220 
221  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
222  this.setLayout(layout);
223  layout.setHorizontalGroup(
224  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
225  .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 756, Short.MAX_VALUE)
226  );
227  layout.setVerticalGroup(
228  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
229  .addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
230  );
231  }// </editor-fold>//GEN-END:initComponents
232 
233 
234  // Variables declaration - do not modify//GEN-BEGIN:variables
235  // End of variables declaration//GEN-END:variables
236 }
List< Pair< String, Long > > getInterestingItemCounts(DataSource dataSource)
List< Pair< String, Long > > getHashsetCounts(DataSource dataSource)
static< T > JTablePanel< T > getJTablePanel(List< ColumnModel< T >> columns)
List< Pair< String, Long > > getKeywordCounts(DataSource dataSource)
final List< DataFetchWorker.DataFetchComponents< DataSource,?> > dataFetchComponents

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.