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;
71 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,
TskData.
FileKnown knownState, String
parentPath) {
72 super(db, objId, dataSourceObjectId, name,
dirType,
metaType,
dirFlag, metaFlags, md5Hash, sha256Hash,
knownState, parentPath);
73 this.objectId = objId;
74 this.deviceId = deviceId;
75 this.timezone = timezone;
162 Statement statement = null;
163 ResultSet resultSet = null;
164 long contentSize = 0;
166 connection = sleuthkitCase.getConnection();
169 statement = connection.createStatement();
170 resultSet = connection.executeQuery(statement,
"SELECT SUM (size) FROM tsk_files WHERE tsk_files.data_source_obj_id = " + dataSourceObjId);
171 if (resultSet.next()) {
172 contentSize = resultSet.getLong(
"sum");
174 }
catch (SQLException ex) {
175 throw new TskCoreException(String.format(
"There was a problem while querying the database for size data for object ID %d.", dataSourceObjId), ex);
177 closeResultSet(resultSet);
178 closeStatement(statement);
209 getSleuthkitCase().setAcquisitionToolDetails(
this, name, version, settings);
234 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_settings");
245 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_name");
256 return getSleuthkitCase().getDataSourceInfoString(
this,
"acquisition_tool_version");
292 private static void closeResultSet(ResultSet resultSet) {
293 if (resultSet != null) {
296 }
catch (SQLException ex) {
297 LOGGER.log(Level.SEVERE,
"Error closing ResultSet", ex);
307 private static void closeStatement(Statement statement) {
308 if (statement != null) {
311 }
catch (SQLException ex) {
312 LOGGER.log(Level.SEVERE,
"Error closing Statement", ex);
327 public <T> T accept(ContentVisitor<T> visitor) {
328 return visitor.visit(
this);
341 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
342 return visitor.visit(
this);
372 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) {
373 this(db, objId, dataSourceObjectId, deviceId, name,
dirType,
metaType,
dirFlag,
metaFlags, timezone,
md5Hash, null,
knownState,
parentPath);
final TSK_FS_NAME_TYPE_ENUM dirType
Host getHostByDataSource(DataSource dataSource)
VirtualDirectory getRootDirectory()
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, TskData.FileKnown knownState, String parentPath)
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()
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)