Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
RunIngestModulesAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 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.ingest.runIngestModuleWizard;
20 
21 import java.awt.Cursor;
22 import java.awt.event.ActionEvent;
23 import java.text.MessageFormat;
24 import java.util.ArrayList;
25 import java.util.List;
26 import javax.swing.AbstractAction;
27 import javax.swing.Action;
28 import javax.swing.JOptionPane;
29 import javax.swing.RootPaneContainer;
30 import org.openide.DialogDisplayer;
31 import org.openide.WizardDescriptor;
32 import org.openide.util.NbBundle.Messages;
33 import org.openide.windows.WindowManager;
36 import org.sleuthkit.datamodel.Content;
37 import org.sleuthkit.datamodel.Directory;
38 
44 public final class RunIngestModulesAction extends AbstractAction {
45 
46  @Messages("RunIngestModulesAction.name=Run Ingest Modules")
47  private static final long serialVersionUID = 1L;
48 
49  /*
50  * Note that the execution context is the name of the dialog that used to be
51  * used instead of this wizard and is retained for backwards compatibility.
52  */
53  private static final String EXECUTION_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog";
54 
60  private static void showWarnings(IngestJobSettings ingestJobSettings) {
61  List<String> warnings = ingestJobSettings.getWarnings();
62  if (warnings.isEmpty() == false) {
63  StringBuilder warningMessage = new StringBuilder(1024);
64  for (String warning : warnings) {
65  warningMessage.append(warning).append("\n");
66  }
67  JOptionPane.showMessageDialog(null, warningMessage.toString());
68  }
69  }
70  private final List<Content> dataSources = new ArrayList<>();
72 
79  public RunIngestModulesAction(List<Content> dataSources) {
80  this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name());
81  this.dataSources.addAll(dataSources);
83  }
84 
91  public RunIngestModulesAction(Directory dir) {
92  this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name());
93  this.dataSources.add(dir);
95  }
96 
102  @Override
103  public void actionPerformed(ActionEvent e) {
109  RootPaneContainer root = (RootPaneContainer) WindowManager.getDefault().getMainWindow();
110  root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
111  root.getGlassPane().setVisible(true);
112  RunIngestModulesWizardIterator wizard = new RunIngestModulesWizardIterator(EXECUTION_CONTEXT, this.ingestType, this.dataSources);
113  WizardDescriptor wiz = new WizardDescriptor(wizard);
114  wiz.setTitleFormat(new MessageFormat("{0}"));
115  wiz.setTitle(Bundle.RunIngestModulesAction_name());
116  root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
117  root.getGlassPane().setVisible(false);
118  if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
119  IngestJobSettings ingestJobSettings = wizard.getIngestJobSettings();
120  showWarnings(ingestJobSettings);
121  IngestManager.getInstance().queueIngestJob(this.dataSources, ingestJobSettings);
122  }
123  }
124 
125  @Override
126  public Object clone() throws CloneNotSupportedException {
127  throw new CloneNotSupportedException("Clone is not supported for the RunIngestModulesAction");
128  }
129 }
static synchronized IngestManager getInstance()
void queueIngestJob(Collection< Content > dataSources, IngestJobSettings settings)

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.