19 package org.sleuthkit.datamodel;
21 import java.sql.ResultSet;
22 import java.sql.SQLException;
23 import java.sql.Statement;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
39 private final long objectId;
40 private final String deviceId;
41 private final String timezone;
42 private volatile Host host;
72 public LocalFilesDataSource(
SleuthkitCase db,
long objId,
long dataSourceObjectId, String deviceId, String name,
TskData.
TSK_FS_NAME_TYPE_ENUM dirType,
TskData.
TSK_FS_META_TYPE_ENUM metaType,
TskData.
TSK_FS_NAME_FLAG_ENUM dirFlag,
short metaFlags, String timezone, String
md5Hash, String
sha256Hash, String
sha1Hash,
TskData.
FileKnown knownState, String
parentPath) {
73 super(db, objId, dataSourceObjectId, null, name,
dirType,
metaType,
dirFlag, metaFlags, md5Hash, sha256Hash, sha1Hash,
knownState, parentPath);
74 this.objectId = objId;
75 this.deviceId = deviceId;
76 this.timezone = timezone;
163 Statement statement = null;
164 ResultSet resultSet = null;
165 long contentSize = 0;
167 connection = sleuthkitCase.getConnection();
170 statement = connection.createStatement();
171 resultSet = connection.executeQuery(statement,
"SELECT SUM (size) FROM tsk_files WHERE tsk_files.data_source_obj_id = " + dataSourceObjId);
172 if (resultSet.next()) {
173 contentSize = resultSet.getLong(
"sum");
175 }
catch (SQLException ex) {
176 throw new TskCoreException(String.format(
"There was a problem while querying the database for size data for object ID %d.", dataSourceObjId), ex);
178 closeResultSet(resultSet);
179 closeStatement(statement);
215 getSleuthkitCase().setAcquisitionToolDetails(
this, name, version, settings);
240 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_settings");
251 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_name");
262 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_version");
298 private static void closeResultSet(ResultSet resultSet) {
299 if (resultSet != null) {
302 }
catch (SQLException ex) {
303 LOGGER.log(Level.SEVERE,
"Error closing ResultSet", ex);
313 private static void closeStatement(Statement statement) {
314 if (statement != null) {
317 }
catch (SQLException ex) {
318 LOGGER.log(Level.SEVERE,
"Error closing Statement", ex);
333 public <T> T accept(ContentVisitor<T> visitor) {
334 return visitor.visit(
this);
347 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
348 return visitor.visit(
this);
378 public LocalFilesDataSource(
SleuthkitCase db,
long objId,
long dataSourceObjectId, String deviceId, String name,
TskData.
TSK_FS_NAME_TYPE_ENUM dirType,
TskData.
TSK_FS_META_TYPE_ENUM metaType,
TskData.
TSK_FS_NAME_FLAG_ENUM dirFlag,
short metaFlags, String timezone, String
md5Hash,
TskData.
FileKnown knownState, String
parentPath) {
379 this(db, objId, dataSourceObjectId, deviceId, name,
dirType,
metaType,
dirFlag,
metaFlags, timezone,
md5Hash, null, null,
knownState,
parentPath);
final TSK_FS_NAME_TYPE_ENUM dirType
Host getHostByDataSource(DataSource dataSource)
VirtualDirectory getRootDirectory()
void setDisplayName(String newName)
String getAcquisitionToolSettings()
TSK_FS_NAME_FLAG_ENUM dirFlag
Set< TSK_FS_META_FLAG_ENUM > metaFlags
TskData.FileKnown knownState
HostManager getHostManager()
SleuthkitCase getSleuthkitCase()
LocalFilesDataSource(SleuthkitCase db, long objId, long dataSourceObjectId, String deviceId, String name, TskData.TSK_FS_NAME_TYPE_ENUM dirType, TskData.TSK_FS_META_TYPE_ENUM metaType, TskData.TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, String timezone, String md5Hash, String sha256Hash, String sha1Hash, TskData.FileKnown knownState, String parentPath)
void setAcquisitionToolDetails(String name, String version, String settings)
void setAcquisitionDetails(String details)
String getAcquisitionToolVersion()
String getAcquisitionDetails()
String getAcquisitionToolName()
final TSK_FS_META_TYPE_ENUM metaType
LocalFilesDataSource(SleuthkitCase db, long objId, long dataSourceObjectId, String deviceId, String name, TskData.TSK_FS_NAME_TYPE_ENUM dirType, TskData.TSK_FS_META_TYPE_ENUM metaType, TskData.TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, String timezone, String md5Hash, TskData.FileKnown knownState, String parentPath)
long getContentSize(SleuthkitCase sleuthkitCase)