19 package org.sleuthkit.autopsy.ingest;
21 import java.text.SimpleDateFormat;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.Date;
25 import java.util.List;
27 import javax.swing.JDialog;
28 import javax.swing.table.AbstractTableModel;
29 import javax.swing.table.TableColumn;
30 import org.apache.commons.lang3.time.DurationFormatUtils;
31 import org.openide.util.NbBundle;
62 column.setPreferredWidth(((
int) (width * 0.02)));
65 column.setPreferredWidth(((
int) (width * 0.20)));
68 column.setPreferredWidth(((
int) (width * 0.15)));
71 column.setPreferredWidth(((
int) (width * 0.35)));
74 column.setPreferredWidth(((
int) (width * 0.18)));
77 column.setPreferredWidth(((
int) (width * 0.10)));
87 private final String[]
columnNames = {NbBundle.getMessage(this.getClass(),
88 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.threadID"),
89 NbBundle.getMessage(this.getClass(),
90 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.activity"),
91 NbBundle.getMessage(this.getClass(),
92 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.dataSource"),
93 NbBundle.getMessage(this.getClass(),
94 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.file"),
95 NbBundle.getMessage(this.getClass(),
96 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.startTime"),
97 NbBundle.getMessage(this.getClass(),
98 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.elapsedTime"),
99 NbBundle.getMessage(this.getClass(),
100 "IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.jobID")};
109 fireTableDataChanged();
119 return columnNames.length;
124 return columnNames[col];
131 switch (columnIndex) {
133 cellValue = snapshot.getThreadId();
136 cellValue = snapshot.getActivity();
139 cellValue = snapshot.getDataSourceName();
142 cellValue = snapshot.getFileName();
145 cellValue = snapshot.getStartTime();
148 Date now =
new Date();
149 long elapsedTime = now.getTime() - snapshot.getStartTime().getTime();
150 cellValue = DurationFormatUtils.formatDurationHMS(elapsedTime);
153 cellValue = snapshot.getJobId();
165 private final String[]
columnNames = {NbBundle.getMessage(this.getClass(),
"IngestJobTableModel.colName.jobID"),
166 NbBundle.getMessage(this.getClass(),
167 "IngestJobTableModel.colName.dataSource"),
168 NbBundle.getMessage(this.getClass(),
"IngestJobTableModel.colName.start"),
169 NbBundle.getMessage(this.getClass(),
170 "IngestJobTableModel.colName.numProcessed"),
171 NbBundle.getMessage(this.getClass(),
172 "IngestJobTableModel.colName.filesPerSec"),
173 NbBundle.getMessage(this.getClass(),
174 "IngestJobTableModel.colName.inProgress"),
175 NbBundle.getMessage(this.getClass(),
176 "IngestJobTableModel.colName.filesQueued"),
177 NbBundle.getMessage(this.getClass(),
178 "IngestJobTableModel.colName.dirQueued"),
179 NbBundle.getMessage(this.getClass(),
180 "IngestJobTableModel.colName.rootQueued"),
181 NbBundle.getMessage(this.getClass(),
182 "IngestJobTableModel.colName.dsQueued")};
191 fireTableDataChanged();
201 return columnNames.length;
206 return columnNames[col];
211 DataSourceIngestJob.Snapshot snapShot =
jobSnapshots.get(rowIndex);
213 switch (columnIndex) {
215 cellValue = snapShot.getJobId();
218 cellValue = snapShot.getDataSource();
221 SimpleDateFormat dateFormat =
new SimpleDateFormat(
"HH:mm:ss");
222 cellValue = dateFormat.format(
new Date(snapShot.getJobStartTime()));
225 cellValue = snapShot.getFilesProcessed();
228 cellValue = snapShot.getSpeed();
231 cellValue = snapShot.getRunningListSize();
234 cellValue = snapShot.getFileQueueSize();
237 cellValue = snapShot.getDirQueueSize();
240 cellValue = snapShot.getRootQueueSize();
243 cellValue = snapShot.getDsQueueSize();
291 private final String[]
columnNames = {NbBundle.getMessage(this.getClass(),
"ModuleTableModel.colName.module"),
292 NbBundle.getMessage(this.getClass(),
293 "ModuleTableModel.colName.duration")};
305 for (String k : moduleStatMap.keySet()) {
306 moduleStats.add(
new ModuleStats(k, moduleStatMap.get(k)));
307 totalTime += moduleStatMap.get(k);
309 Collections.sort(moduleStats);
310 fireTableDataChanged();
315 return moduleStats.size();
320 return columnNames.length;
325 return columnNames[col];
330 ModuleStats moduleStat = moduleStats.get(rowIndex);
332 switch (columnIndex) {
334 cellValue = moduleStat.
getName();
337 cellValue = DurationFormatUtils.formatDurationHMS(moduleStat.
getDuration()) +
" (" + (moduleStat.
getDuration() * 100) / totalTime +
"%)";
353 @SuppressWarnings(
"unchecked")
360 jobTable =
new javax.swing.JTable();
376 jobTable.setModel(
new javax.swing.table.DefaultTableModel(
387 refreshButton.addActionListener(
new java.awt.event.ActionListener() {
388 public void actionPerformed(java.awt.event.ActionEvent evt) {
394 closeButton.addActionListener(
new java.awt.event.ActionListener() {
395 public void actionPerformed(java.awt.event.ActionEvent evt) {
400 moduleTable.setModel(
new javax.swing.table.DefaultTableModel(
410 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
411 this.setLayout(layout);
412 layout.setHorizontalGroup(
413 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
414 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
416 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
417 .addComponent(
snapshotsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE)
418 .addGroup(layout.createSequentialGroup()
419 .addGap(0, 0, Short.MAX_VALUE)
421 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
423 .addComponent(
jobScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE)
424 .addComponent(
moduleScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE))
428 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {closeButton, refreshButton});
430 layout.setVerticalGroup(
431 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
432 .addGroup(layout.createSequentialGroup()
434 .addComponent(
snapshotsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
435 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
436 .addComponent(
jobScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
437 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
438 .addComponent(
moduleScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
439 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
440 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
446 layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {closeButton, refreshButton});
455 threadActivityTableModel.
refresh();
final ModuleTableModel moduleTableModel
final IngestJobTableModel jobTableModel
final String[] columnNames
javax.swing.JScrollPane snapshotsScrollPane
static synchronized IngestManager getInstance()
javax.swing.JTable moduleTable
void customizeComponents()
Object getValueAt(int rowIndex, int columnIndex)
Object getValueAt(int rowIndex, int columnIndex)
String getColumnName(int col)
final String[] columnNames
String getColumnName(int col)
IngestThreadActivitySnapshotsTableModel()
javax.swing.JScrollPane jobScrollPane
javax.swing.JButton refreshButton
javax.swing.JTable jobTable
int compareTo(ModuleStats o)
final List< ModuleStats > moduleStats
String getColumnName(int col)
final IngestThreadActivitySnapshotsTableModel threadActivityTableModel
final String[] columnNames
List< DataSourceIngestJob.Snapshot > jobSnapshots
void refreshButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JScrollPane moduleScrollPane
void closeButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JTable threadActivitySnapshotsTable
javax.swing.JButton closeButton
List< IngestManager.IngestThreadActivitySnapshot > snapshots
Object getValueAt(int rowIndex, int columnIndex)