Autopsy  4.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 2011-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.nio.file.Path;
22 import java.util.Arrays;
23 import java.util.List;
24 import java.util.UUID;
25 import javax.swing.JPanel;
26 import org.openide.util.NbBundle;
27 import org.openide.util.lookup.ServiceProvider;
28 import org.openide.util.lookup.ServiceProviders;
33 
40 @ServiceProviders(value={
41  @ServiceProvider(service=DataSourceProcessor.class),
42  @ServiceProvider(service=AutoIngestDataSourceProcessor.class)}
43 )
45 
46  private static final String DATA_SOURCE_TYPE = NbBundle.getMessage(LocalFilesDSProcessor.class, "LocalFilesDSProcessor.dsType");
47  private final LocalFilesPanel configPanel;
48  /*
49  * TODO: Remove the setDataSourceOptionsCalled flag and the settings fields
50  * when the deprecated method setDataSourceOptions is removed.
51  */
52  private List<String> localFilePaths;
53  private boolean setDataSourceOptionsCalled;
54 
62  configPanel = LocalFilesPanel.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.select();
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  localFilePaths = configPanel.getContentPaths();
132  }
133  run(UUID.randomUUID().toString(), configPanel.getFileSetName(), localFilePaths, progressMonitor, callback);
134  }
135 
159  public void run(String deviceId, String rootVirtualDirectoryName, List<String> localFilePaths, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
160  new Thread(new AddLocalFilesTask(deviceId, rootVirtualDirectoryName, localFilePaths, progressMonitor, callback)).start();
161  }
162 
173  @Override
174  public void cancel() {
175  }
176 
181  @Override
182  public void reset() {
183  configPanel.reset();
184  localFilePaths = null;
185  setDataSourceOptionsCalled = false;
186  }
187 
188  @Override
189  public int canProcess(Path dataSourcePath) throws AutoIngestDataSourceProcessorException {
190  // Local files DSP can process any file by simply adding it as a logical file.
191  // It should return lowest possible non-zero confidence level and be treated
192  // as the "option of last resort" for auto ingest purposes
193  return 1;
194  }
195 
196  @Override
197  public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutoIngestDataSourceProcessorException {
198  this.localFilePaths = Arrays.asList(new String[]{dataSourcePath.toString()});
199  run(deviceId, deviceId, this.localFilePaths, progressMonitor, callBack);
200  }
201 
213  @Deprecated
214  public void setDataSourceOptions(String paths) {
215  // The LocalFilesPanel used to separate file paths with a comma and pass
216  // them as a string, but because file names are allowed to contain
217  // commas, this approach was buggy and replaced. We now pass a list of
218  // String paths.
219  this.localFilePaths = Arrays.asList(paths.split(","));
220  setDataSourceOptionsCalled = true;
221  }
222 
223 }
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
void run(String deviceId, String rootVirtualDirectoryName, List< String > localFilePaths, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)

Copyright © 2012-2016 Basis Technology. Generated on: Fri Sep 29 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.