Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
LocalDiskDSProcessor.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-2018 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 java.util.Calendar;
22 import java.util.UUID;
23 import javax.swing.JPanel;
24 import org.openide.util.NbBundle;
25 import org.openide.util.lookup.ServiceProvider;
30 
37 @ServiceProvider(service = DataSourceProcessor.class)
38 public class LocalDiskDSProcessor implements DataSourceProcessor {
39 
40  private static final String DATA_SOURCE_TYPE = NbBundle.getMessage(LocalDiskDSProcessor.class, "LocalDiskDSProcessor.dsType.text");
41  private final LocalDiskPanel configPanel;
42  private AddImageTask addDiskTask;
43  /*
44  * TODO: Remove the setDataSourceOptionsCalled flag and the settings fields
45  * when the deprecated method setDataSourceOptions is removed.
46  */
47  private String deviceId;
48  private String drivePath;
49  private int sectorSize;
50  private String timeZone;
52  private boolean ignoreFatOrphanFiles;
53  private boolean setDataSourceOptionsCalled;
54 
62  configPanel = LocalDiskPanel.getDefault();
63  }
64 
72  public static String getType() {
73  return DATA_SOURCE_TYPE;
74  }
75 
83  @Override
84  public String getDataSourceType() {
85  return DATA_SOURCE_TYPE;
86  }
87 
96  @Override
97  public JPanel getPanel() {
98  configPanel.resetLocalDiskSelection();
99  return configPanel;
100  }
101 
109  @Override
110  public boolean isPanelValid() {
111  return configPanel.validatePanel();
112  }
113 
128  @Override
129  public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
130  if (!setDataSourceOptionsCalled) {
131  deviceId = UUID.randomUUID().toString();
132  drivePath = configPanel.getContentPath();
133  sectorSize = configPanel.getSectorSize();
134  timeZone = configPanel.getTimeZone();
135  ignoreFatOrphanFiles = configPanel.getNoFatOrphans();
136  if (configPanel.getImageWriterEnabled()) {
137  imageWriterSettings = configPanel.getImageWriterSettings();
138  } else {
139  imageWriterSettings = null;
140  }
141  }
142  addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, null, null, null, imageWriterSettings, progressMonitor, callback);
143  new Thread(addDiskTask).start();
144  }
145 
167  public void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
168  run(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, progressMonitor, callback);
169  }
170 
193  private void run(String deviceId, String drivePath, int sectorSize, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
194  addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, null, null, null, imageWriterSettings, progressMonitor, callback);
195  new Thread(addDiskTask).start();
196  }
197 
205  @Override
206  public void cancel() {
207  if (null != addDiskTask) {
208  addDiskTask.cancelTask();
209  }
210  }
211 
216  @Override
217  public void reset() {
218  deviceId = null;
219  drivePath = null;
220  timeZone = null;
221  ignoreFatOrphanFiles = false;
222  setDataSourceOptionsCalled = false;
223  }
224 
238  @Deprecated
239  public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) {
240  this.deviceId = UUID.randomUUID().toString();
241  this.drivePath = drivePath;
242  this.sectorSize = 0;
243  this.timeZone = Calendar.getInstance().getTimeZone().getID();
244  this.ignoreFatOrphanFiles = ignoreFatOrphanFiles;
245  setDataSourceOptionsCalled = true;
246  }
247 
248 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void run(String deviceId, String drivePath, int sectorSize, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles)

Copyright © 2012-2018 Basis Technology. Generated on: Wed Sep 18 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.