20 package org.sleuthkit.autopsy.datamodel.utils;
23 import java.sql.ResultSet;
24 import java.sql.SQLException;
25 import java.util.HashMap;
41 private static final String
SELECT_DATA_SOURCES_LOGICAL =
"select obj_id, name from tsk_files where obj_id in (SELECT obj_id FROM tsk_objects WHERE obj_id in (select obj_id from data_source_info))";
43 private static final String
SELECT_DATA_SOURCES_IMAGE =
"select obj_id, name from tsk_image_names where obj_id in (SELECT obj_id FROM tsk_objects WHERE obj_id in (select obj_id from data_source_info))";
45 private void loadLogicalSources(SleuthkitCase tskDb, Map<Long, String> dataSouceMap)
throws TskCoreException, SQLException {
48 SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_LOGICAL);
49 ResultSet resultSet = query.getResultSet()) {
50 while (resultSet.next()) {
51 Long objectId = resultSet.getLong(1);
52 String dataSourceName = resultSet.getString(2);
53 dataSouceMap.put(objectId, dataSourceName);
58 private void loadImageSources(SleuthkitCase tskDb, Map<Long, String> dataSourceMap)
throws SQLException, TskCoreException {
61 SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_IMAGE);
62 ResultSet resultSet = query.getResultSet()) {
64 while (resultSet.next()) {
65 Long objectId = resultSet.getLong(1);
66 if (!dataSourceMap.containsKey(objectId)) {
67 String dataSourceName = resultSet.getString(2);
68 File image =
new File(dataSourceName);
69 String dataSourceNameTrimmed = image.getName();
70 dataSourceMap.put(objectId, dataSourceNameTrimmed);
86 Map<Long, String> dataSouceMap =
new HashMap<>();
void loadLogicalSources(SleuthkitCase tskDb, Map< Long, String > dataSouceMap)
static final String SELECT_DATA_SOURCES_IMAGE
void loadImageSources(SleuthkitCase tskDb, Map< Long, String > dataSourceMap)
Map< Long, String > getDataSourceMap()
SleuthkitCase getSleuthkitCase()
static final String SELECT_DATA_SOURCES_LOGICAL
static Case getCurrentCaseThrows()