Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
LocalFilesDSProcessor.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 @ServiceProvider(service = DataSourceProcessor.class)
32 public class LocalFilesDSProcessor implements DataSourceProcessor {
33 
34  static final Logger logger = Logger.getLogger(LocalFilesDSProcessor.class.getName());
35 
36  // Data source type handled by this processor
37  private static final String dsType = NbBundle.getMessage(LocalFilesDSProcessor.class, "LocalFilesDSProcessor.dsType");
38 
39  // The Config UI panel that plugins into the Choose Data Source Wizard
40  private final LocalFilesPanel localFilesPanel;
41 
42  // The Background task that does the actual work of adding the files
43  private AddLocalFilesTask addFilesTask;
44 
45  // true if cancelled by the caller
46  private boolean cancelled = false;
47 
48  DataSourceProcessorCallback callbackObj = null;
49 
50  // set to TRUE if the image options have been set via API and config Jpanel should be ignored
51  private boolean localFilesOptionsSet = false;
52 
53  // data source options
54  private String localFilesPath;
55 
56  /*
57  * A no argument constructor is required for the NM lookup() method to create an object
58  */
60 
61  // Create the config panel
62  localFilesPanel = LocalFilesPanel.getDefault();
63  }
64 
65  // this static method is used by the wizard to determine dsp type for 'core' data source processors
66  public static String getType() {
67  return dsType;
68  }
69 
75  @Override
76  public String getDataSourceType() {
77  return dsType;
78  }
79 
85  @Override
86  public JPanel getPanel() {
87  localFilesPanel.select();
88  return localFilesPanel;
89  }
90 
96  @Override
97  public boolean isPanelValid() {
98  return localFilesPanel.validatePanel();
99  }
100 
108  @Override
110 
111  callbackObj = cbObj;
112  cancelled = false;
113 
114  if (!localFilesOptionsSet) {
115  // get the selected file paths from the panel
116  localFilesPath = localFilesPanel.getContentPaths();
117  }
118 
119  addFilesTask = new AddLocalFilesTask(localFilesPath, progressMonitor, cbObj);
120  new Thread(addFilesTask).start();
121 
122  }
123 
127  @Override
128  public void cancel() {
129 
130  cancelled = true;
131  addFilesTask.cancelTask();
132 
133  }
134 
138  @Override
139  public void reset() {
140 
141  // reset the config panel
142  localFilesPanel.reset();
143 
144  // reset state
145  localFilesOptionsSet = false;
146  localFilesPath = null;
147 
148  }
149 
158  public void setDataSourceOptions(String filesPath) {
159 
160  localFilesPath = filesPath;
161 
162  localFilesOptionsSet = true;
163 
164  }
165 
166 
167 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback cbObj)
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.