Autopsy  4.1
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-2016 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;
29 
36 @ServiceProvider(service = DataSourceProcessor.class)
37 public class LocalDiskDSProcessor implements DataSourceProcessor {
38 
39  private static final String DATA_SOURCE_TYPE = NbBundle.getMessage(LocalDiskDSProcessor.class, "LocalDiskDSProcessor.dsType.text");
40  private final LocalDiskPanel configPanel;
41  private AddImageTask addDiskTask;
42  /*
43  * TODO: Remove the setDataSourceOptionsCalled flag and the settings fields
44  * when the deprecated method setDataSourceOptions is removed.
45  */
46  private String deviceId;
47  private String drivePath;
48  private String timeZone;
49  private boolean ignoreFatOrphanFiles;
50  private boolean setDataSourceOptionsCalled;
51 
59  configPanel = LocalDiskPanel.getDefault();
60  }
61 
69  public static String getType() {
70  return DATA_SOURCE_TYPE;
71  }
72 
80  @Override
81  public String getDataSourceType() {
82  return DATA_SOURCE_TYPE;
83  }
84 
93  @Override
94  public JPanel getPanel() {
95  configPanel.select();
96  return configPanel;
97  }
98 
106  @Override
107  public boolean isPanelValid() {
108  return configPanel.validatePanel();
109  }
110 
125  @Override
126  public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
127  if (!setDataSourceOptionsCalled) {
128  deviceId = UUID.randomUUID().toString();
129  drivePath = configPanel.getContentPaths();
130  timeZone = configPanel.getTimeZone();
131  ignoreFatOrphanFiles = configPanel.getNoFatOrphans();
132  }
133  addDiskTask = new AddImageTask(deviceId, drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, callback);
134  new Thread(addDiskTask).start();
135  }
136 
158  public void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
159  addDiskTask = new AddImageTask(deviceId, drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, callback);
160  new Thread(addDiskTask).start();
161  }
162 
170  @Override
171  public void cancel() {
172  if (null != addDiskTask) {
173  addDiskTask.cancelTask();
174  }
175  }
176 
181  @Override
182  public void reset() {
183  configPanel.reset();
184  deviceId = null;
185  drivePath = null;
186  timeZone = null;
187  ignoreFatOrphanFiles = false;
188  setDataSourceOptionsCalled = false;
189  }
190 
204  @Deprecated
205  public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) {
206  this.deviceId = UUID.randomUUID().toString();
207  this.drivePath = drivePath;
208  this.timeZone = Calendar.getInstance().getTimeZone().getID();
209  this.ignoreFatOrphanFiles = ignoreFatOrphanFiles;
210  setDataSourceOptionsCalled = true;
211  }
212 
213 }
void run(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-2016 Basis Technology. Generated on: Tue Oct 25 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.