Autopsy  3.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-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 
20 package org.sleuthkit.autopsy.casemodule;
21 
22 import javax.swing.JPanel;
23 
24 import org.openide.util.NbBundle;
25 import org.openide.util.lookup.ServiceProvider;
30 
31 
32 @ServiceProvider(service = DataSourceProcessor.class)
33 public class LocalDiskDSProcessor implements DataSourceProcessor {
34 
35  static final Logger logger = Logger.getLogger(ImageDSProcessor.class.getName());
36 
37  // Data source type handled by this processor
38  private static final String dsType = NbBundle.getMessage(LocalDiskDSProcessor.class, "LocalDiskDSProcessor.dsType.text");
39 
40  // The Config UI panel that plugins into the Choose Data Source Wizard
41  private final LocalDiskPanel localDiskPanel;
42 
43  // The Background task that does the actual work of adding the local Disk
44  // Adding a local disk is exactly same as adding an Image.
45  private AddImageTask addDiskTask;
46 
47  // true if cancelled by the caller
48  private boolean cancelled = false;
49 
50  DataSourceProcessorCallback callbackObj = null;
51 
52  // set to TRUE if the image options have been set via API and config Jpanel should be ignored
53  private boolean localDiskOptionsSet = false;
54 
55  // data source options
56  private String localDiskPath;
57  private String timeZone;
58  private boolean noFatOrphans;
59 
60  /*
61  * A no argument constructor is required for the NM lookup() method to create an object
62  */
64 
65  // Create the config panel
66  localDiskPanel = LocalDiskPanel.getDefault();
67 
68  }
69 
70  // this static method is used by the wizard to determine dsp type for 'core' data source processors
71  public static String getType() {
72  return dsType;
73  }
74 
80  @Override
81  public String getDataSourceType() {
82  return dsType;
83  }
84 
90  @Override
91  public JPanel getPanel() {
92 
93  localDiskPanel.select();
94  return localDiskPanel;
95  }
101  @Override
102  public boolean isPanelValid() {
103  return localDiskPanel.validatePanel();
104  }
105 
113  @Override
115 
116  callbackObj = cbObj;
117  cancelled = false;
118 
119  if (!localDiskOptionsSet) {
120  // get the image options from the panel
121  localDiskPath = localDiskPanel.getContentPaths();
122  timeZone = localDiskPanel.getTimeZone();
123  noFatOrphans = localDiskPanel.getNoFatOrphans();
124  }
125 
126  addDiskTask = new AddImageTask(localDiskPath, timeZone, noFatOrphans, progressMonitor, cbObj);
127  new Thread(addDiskTask).start();
128 
129  }
130 
134  @Override
135  public void cancel() {
136 
137  cancelled = true;
138 
139  addDiskTask.cancelTask();
140  }
141 
145  @Override
146  public void reset() {
147 
148  // reset the config panel
149  localDiskPanel.reset();
150 
151  // reset state
152  localDiskOptionsSet = false;
153  localDiskPath = null;
154  timeZone = null;
155  noFatOrphans = false;
156 
157  }
158 
168  public void setDataSourceOptions(String diskPath, String tz, boolean noFat) {
169 
170  this.localDiskPath = diskPath;
171  this.timeZone = tz;
172  this.noFatOrphans = noFat;
173 
174  localDiskOptionsSet = true;
175 
176  }
177 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj)
void setDataSourceOptions(String diskPath, 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.