Autopsy  4.4.1
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 org.openide.DialogDisplayer;
30 import org.openide.WizardDescriptor;
31 import org.openide.util.NbBundle.Messages;
32 import org.openide.windows.WindowManager;
35 import org.sleuthkit.datamodel.Content;
36 import org.sleuthkit.datamodel.Directory;
37 
43 public final class RunIngestModulesAction extends AbstractAction {
44 
45  @Messages("RunIngestModulesAction.name=Run Ingest Modules")
46  private static final long serialVersionUID = 1L;
47 
48  /*
49  * Note that the execution context is the name of the dialog that used to be
50  * used instead of this wizard and is retained for backwards compatibility.
51  */
52  private static final String EXECUTION_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog";
58  private static void showWarnings(IngestJobSettings ingestJobSettings) {
59  List<String> warnings = ingestJobSettings.getWarnings();
60  if (warnings.isEmpty() == false) {
61  StringBuilder warningMessage = new StringBuilder(1024);
62  for (String warning : warnings) {
63  warningMessage.append(warning).append("\n");
64  }
65  JOptionPane.showMessageDialog(null, warningMessage.toString());
66  }
67  }
68  private final List<Content> dataSources = new ArrayList<>();
70 
77  public RunIngestModulesAction(List<Content> dataSources) {
78  this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name());
79  this.dataSources.addAll(dataSources);
81  }
82 
89  public RunIngestModulesAction(Directory dir) {
90  this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name());
91  this.dataSources.add(dir);
93  }
94 
100  @Override
101  public void actionPerformed(ActionEvent e) {
107  WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
108  RunIngestModulesWizardIterator wizard = new RunIngestModulesWizardIterator(EXECUTION_CONTEXT, this.ingestType, this.dataSources);
109  WizardDescriptor wiz = new WizardDescriptor(wizard);
110  wiz.setTitleFormat(new MessageFormat("{0}"));
111  wiz.setTitle(Bundle.RunIngestModulesAction_name());
112  WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
113  if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
114  IngestJobSettings ingestJobSettings = wizard.getIngestJobSettings();
115  showWarnings(ingestJobSettings);
116  IngestManager.getInstance().queueIngestJob(this.dataSources, ingestJobSettings);
117  }
118  }
119 
120 
121  @Override
122  public Object clone() throws CloneNotSupportedException {
123  throw new CloneNotSupportedException("Clone is not supported for the RunIngestModulesAction");
124  }
125 }
static synchronized IngestManager getInstance()
void queueIngestJob(Collection< Content > dataSources, IngestJobSettings settings)

Copyright © 2012-2016 Basis Technology. Generated on: Fri Sep 29 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.