Autopsy  4.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-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.Arrays;
22 import java.util.List;
23 import java.util.UUID;
24 import javax.swing.JPanel;
25 import org.openide.util.NbBundle;
26 import org.openide.util.lookup.ServiceProvider;
30 
37 @ServiceProvider(service = DataSourceProcessor.class)
38 public class LocalFilesDSProcessor implements DataSourceProcessor {
39 
40  private static final String DATA_SOURCE_TYPE = NbBundle.getMessage(LocalFilesDSProcessor.class, "LocalFilesDSProcessor.dsType");
41  private final LocalFilesPanel configPanel;
42  /*
43  * TODO: Remove the setDataSourceOptionsCalled flag and the settings fields
44  * when the deprecated method setDataSourceOptions is removed.
45  */
46  private List<String> localFilePaths;
47  private boolean setDataSourceOptionsCalled;
48 
56  configPanel = LocalFilesPanel.getDefault();
57  }
58 
66  public static String getType() {
67  return DATA_SOURCE_TYPE;
68  }
69 
77  @Override
78  public String getDataSourceType() {
79  return DATA_SOURCE_TYPE;
80  }
81 
90  @Override
91  public JPanel getPanel() {
92  configPanel.select();
93  return configPanel;
94  }
95 
103  @Override
104  public boolean isPanelValid() {
105  return configPanel.validatePanel();
106  }
107 
122  @Override
123  public void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
124  if (!setDataSourceOptionsCalled) {
125  localFilePaths = Arrays.asList(configPanel.getContentPaths().split(LocalFilesPanel.FILES_SEP));
126  }
127  run(UUID.randomUUID().toString(), configPanel.getFileSetName(), localFilePaths, progressMonitor, callback);
128  }
129 
153  public void run(String deviceId, String rootVirtualDirectoryName, List<String> localFilePaths, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
154  new Thread(new AddLocalFilesTask(deviceId, rootVirtualDirectoryName, localFilePaths, progressMonitor, callback)).start();
155  }
156 
167  @Override
168  public void cancel() {
169  }
170 
175  @Override
176  public void reset() {
177  configPanel.reset();
178  localFilePaths = null;
179  setDataSourceOptionsCalled = false;
180  }
181 
193  @Deprecated
194  public void setDataSourceOptions(String paths) {
195  //LocalFilesPanel.FILES_SEP is currently ","
196  this.localFilePaths = Arrays.asList(paths.split(LocalFilesPanel.FILES_SEP));
197  setDataSourceOptionsCalled = true;
198  }
199 
200 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void run(String deviceId, String rootVirtualDirectoryName, List< String > localFilePaths, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)

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.