Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ImageDSProcessor.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-2014 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.casemodule;
20 
21 import javax.swing.JPanel;
22 import java.util.ArrayList;
23 import java.util.List;
24 import javax.swing.filechooser.FileFilter;
25 
26 import org.openide.util.NbBundle;
27 import org.openide.util.lookup.ServiceProvider;
32 
40 @ServiceProvider(service = DataSourceProcessor.class)
41 public class ImageDSProcessor implements DataSourceProcessor {
42 
43  static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName());
44 
45  // Data source type handled by this processor
46  private final static String dsType = NbBundle.getMessage(ImageDSProcessor.class, "ImageDSProcessor.dsType.text");
47 
48  // The Config UI panel that plugins into the Choose Data Source Wizard
50 
51  // The Background task that does the actual work of adding the image
52  private AddImageTask addImageTask;
53 
54  // true of cancelled by the caller
55  private boolean cancelled = false;
56 
57  DataSourceProcessorCallback callbackObj = null;
58 
59  // set to TRUE if the image options have been set via API and config Jpanel should be ignored
60  private boolean imageOptionsSet = false;
61 
62  // image options
63  private String imagePath;
64  private String timeZone;
65  private boolean noFatOrphans;
66 
69 
70  static final List<String> allExt = new ArrayList<>();
71  static {
72  allExt.addAll(GeneralFilter.RAW_IMAGE_EXTS);
73  allExt.addAll(GeneralFilter.ENCASE_IMAGE_EXTS);
74  }
75  static final String allDesc = NbBundle.getMessage(ImageDSProcessor.class, "ImageDSProcessor.allDesc.text");
76  static final GeneralFilter allFilter = new GeneralFilter(allExt, allDesc);
77 
78  static final List<FileFilter> filtersList = new ArrayList<>();
79 
80  static {
81  filtersList.add(allFilter);
82  filtersList.add(rawFilter);
83  filtersList.add(encaseFilter);
84  }
85 
86  /*
87  * A no argument constructor is required for the NM lookup() method to create an object
88  */
89  public ImageDSProcessor() {
90 
91  // Create the config panel
92  imageFilePanel = ImageFilePanel.createInstance(ImageDSProcessor.class.getName(), filtersList);
93 
94  }
95 
96  // this static method is used by the wizard to determine dsp type for 'core' data source processors
97  public static String getType() {
98  return dsType;
99  }
100 
106  @Override
107  public String getDataSourceType() {
108  return dsType;
109  }
110 
116  @Override
117  public JPanel getPanel() {
118 
119  imageFilePanel.readSettings();
120  imageFilePanel.select();
121 
122  return imageFilePanel;
123  }
124 
130  @Override
131  public boolean isPanelValid() {
132 
133  return imageFilePanel.validatePanel();
134  }
135 
143  @Override
145 
146  callbackObj = cbObj;
147  cancelled = false;
148 
149  if (!imageOptionsSet)
150  {
151  //tell the panel to save the current settings
152  imageFilePanel.storeSettings();
153 
154  // get the image options from the panel
155  imagePath = imageFilePanel.getContentPaths();
156  timeZone = imageFilePanel.getTimeZone();
157  noFatOrphans = imageFilePanel.getNoFatOrphans();
158  }
159 
160  addImageTask = new AddImageTask(imagePath, timeZone, noFatOrphans, progressMonitor, cbObj);
161  new Thread(addImageTask).start();
162 
163  }
164 
168  @Override
169  public void cancel() {
170 
171  cancelled = true;
172  addImageTask.cancelTask();
173  }
174 
178  @Override
179  public void reset() {
180 
181  // reset the config panel
182  imageFilePanel.reset();
183 
184  // reset state
185  imageOptionsSet = false;
186  imagePath = null;
187  timeZone = null;
188  noFatOrphans = false;
189  }
190 
200  public void setDataSourceOptions(String imgPath, String tz, boolean noFat) {
201 
202  this.imagePath = imgPath;
203  this.timeZone = tz;
204  this.noFatOrphans = noFat;
205 
206  imageOptionsSet = true;
207 
208  }
209 
210 
211 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj)
static synchronized ImageFilePanel createInstance(String context, List< FileFilter > fileChooserFilters)
void setDataSourceOptions(String imgPath, String tz, boolean noFat)
static Logger getLogger(String name)
Definition: Logger.java:131

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.