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;
69 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) {
70 super(db, objId, dataSourceObjectId, name,
dirType,
metaType,
dirFlag, metaFlags, md5Hash,
knownState, parentPath);
71 this.objectId = objId;
72 this.deviceId = deviceId;
73 this.timezone = timezone;
148 Statement statement = null;
149 ResultSet resultSet = null;
150 long contentSize = 0;
152 connection = sleuthkitCase.getConnection();
155 statement = connection.createStatement();
156 resultSet = connection.executeQuery(statement,
"SELECT SUM (size) FROM tsk_files WHERE tsk_files.data_source_obj_id = " + dataSourceObjId);
157 if (resultSet.next()) {
158 contentSize = resultSet.getLong(
"sum");
160 }
catch (SQLException ex) {
161 throw new TskCoreException(String.format(
"There was a problem while querying the database for size data for object ID %d.", dataSourceObjId), ex);
163 closeResultSet(resultSet);
164 closeStatement(statement);
176 private static void closeResultSet(ResultSet resultSet) {
177 if (resultSet != null) {
180 }
catch (SQLException ex) {
181 LOGGER.log(Level.SEVERE,
"Error closing ResultSet", ex);
191 private static void closeStatement(Statement statement) {
192 if (statement != null) {
195 }
catch (SQLException ex) {
196 LOGGER.log(Level.SEVERE,
"Error closing Statement", ex);
final TSK_FS_NAME_TYPE_ENUM dirType
final TSK_FS_NAME_FLAG_ENUM dirFlag
VirtualDirectory getRootDirectory()
final Set< TSK_FS_META_FLAG_ENUM > metaFlags
TskData.FileKnown knownState
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)