19 package org.sleuthkit.autopsy.datamodel;
21 import java.sql.ResultSet;
22 import java.sql.SQLException;
23 import java.util.LinkedHashMap;
25 import java.util.logging.Level;
26 import org.openide.nodes.Sheet;
27 import org.openide.util.NbBundle;
53 String name = ld.getName();
56 if (ld.isDataSource()) {
57 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
59 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/folder-icon-virtual.png");
64 @NbBundle.Messages({
"VirtualDirectoryNode.createSheet.size.name=Size (Bytes)",
65 "VirtualDirectoryNode.createSheet.size.displayName=Size (Bytes)",
66 "VirtualDirectoryNode.createSheet.size.desc=Size of the data source in bytes.",
67 "VirtualDirectoryNode.createSheet.type.name=Type",
68 "VirtualDirectoryNode.createSheet.type.displayName=Type",
69 "VirtualDirectoryNode.createSheet.type.desc=Type of the image.",
70 "VirtualDirectoryNode.createSheet.type.text=Logical File Set",
71 "VirtualDirectoryNode.createSheet.timezone.name=Timezone",
72 "VirtualDirectoryNode.createSheet.timezone.displayName=Timezone",
73 "VirtualDirectoryNode.createSheet.timezone.desc=Timezone of the image",
74 "VirtualDirectoryNode.createSheet.deviceId.name=Device ID",
75 "VirtualDirectoryNode.createSheet.deviceId.displayName=Device ID",
76 "VirtualDirectoryNode.createSheet.deviceId.desc=Device ID of the image"})
78 Sheet sheet = super.createSheet();
79 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
80 if (sheetSet == null) {
81 sheetSet = Sheet.createPropertiesSet();
85 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VirtualDirectoryNode.createSheet.name.name"),
86 NbBundle.getMessage(
this.getClass(),
87 "VirtualDirectoryNode.createSheet.name.displayName"),
88 NbBundle.getMessage(
this.getClass(),
"VirtualDirectoryNode.createSheet.name.desc"),
91 if (!this.content.isDataSource()) {
92 Map<String, Object> map =
new LinkedHashMap<>();
95 final String
NO_DESCR = NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.noDesc");
96 for (Map.Entry<String, Object> entry : map.entrySet()) {
101 sheetSet.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_type_name(),
102 Bundle.VirtualDirectoryNode_createSheet_type_displayName(),
103 Bundle.VirtualDirectoryNode_createSheet_type_desc(),
104 Bundle.VirtualDirectoryNode_createSheet_type_text()));
105 sheetSet.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_size_name(),
106 Bundle.VirtualDirectoryNode_createSheet_size_displayName(),
107 Bundle.VirtualDirectoryNode_createSheet_size_desc(),
108 this.content.getSize()));
109 try (SleuthkitCase.CaseDbQuery query =
Case.
getOpenCase().
getSleuthkitCase().executeQuery(
"SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) {
110 ResultSet timeZoneSet = query.getResultSet();
111 if (timeZoneSet.next()) {
112 sheetSet.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_timezone_name(),
113 Bundle.VirtualDirectoryNode_createSheet_timezone_displayName(),
114 Bundle.VirtualDirectoryNode_createSheet_timezone_desc(),
115 timeZoneSet.getString(
"time_zone")));
118 logger.log(Level.SEVERE,
"Failed to get time zone for the following image: " +
this.content.getId(), ex);
120 try (SleuthkitCase.CaseDbQuery query =
Case.
getOpenCase().
getSleuthkitCase().executeQuery(
"SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
121 ResultSet deviceIdSet = query.getResultSet();
122 if (deviceIdSet.next()) {
123 sheetSet.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_deviceId_name(),
124 Bundle.VirtualDirectoryNode_createSheet_deviceId_displayName(),
125 Bundle.VirtualDirectoryNode_createSheet_deviceId_desc(),
126 deviceIdSet.getString(
"device_id")));
129 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
138 public <T> T accept(ContentNodeVisitor<T> visitor) {
139 return visitor.visit(
this);
143 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
144 return visitor.visit(
this);
static Case getOpenCase()
static void fillPropertyMap(Map< String, Object > map, AbstractFile content)
VirtualDirectoryNode(VirtualDirectory ld)
static final Logger logger
static final String NO_DESCR
SleuthkitCase getSleuthkitCase()
synchronized static Logger getLogger(String name)
static final String LOGICAL_FILE_SET_PREFIX
void addTagProperty(Sheet.Set sheetSet)
static String nameForVirtualDirectory(VirtualDirectory ld)