19 package org.sleuthkit.autopsy.datamodel;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.sql.ResultSet;
24 import java.sql.SQLException;
25 import java.util.ArrayList;
26 import java.util.Collections;
27 import java.util.EnumSet;
28 import java.util.List;
29 import java.util.logging.Level;
30 import javax.swing.Action;
31 import org.openide.nodes.Children;
32 import org.openide.nodes.Sheet;
33 import org.openide.util.NbBundle;
34 import org.openide.util.NbBundle.Messages;
46 import org.
sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
66 static String nameForImage(Image i) {
77 String imgName = nameForImage(img);
78 this.setDisplayName(imgName);
79 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/hard-drive-icon.jpg");
100 @Messages({
"ImageNode.action.runIngestMods.text=Run Ingest Modules",
101 "ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes",})
104 List<Action> actionsList =
new ArrayList<>();
105 for (Action a : super.getActions(
true)) {
110 Bundle.ImageNode_getActions_openFileSearchByAttr_text()));
113 NbBundle.getMessage(
this.getClass(),
"ImageNode.getActions.viewInNewWin.text"),
this));
114 return actionsList.toArray(
new Action[0]);
118 @Messages({
"ImageNode.createSheet.size.name=Size (Bytes)",
119 "ImageNode.createSheet.size.displayName=Size (Bytes)",
120 "ImageNode.createSheet.size.desc=Size of the data source in bytes.",
121 "ImageNode.createSheet.type.name=Type",
122 "ImageNode.createSheet.type.displayName=Type",
123 "ImageNode.createSheet.type.desc=Type of the image.",
124 "ImageNode.createSheet.type.text=Image",
125 "ImageNode.createSheet.sectorSize.name=Sector Size (Bytes)",
126 "ImageNode.createSheet.sectorSize.displayName=Sector Size (Bytes)",
127 "ImageNode.createSheet.sectorSize.desc=Sector size of the image in bytes.",
128 "ImageNode.createSheet.timezone.name=Timezone",
129 "ImageNode.createSheet.timezone.displayName=Timezone",
130 "ImageNode.createSheet.timezone.desc=Timezone of the image",
131 "ImageNode.createSheet.deviceId.name=Device ID",
132 "ImageNode.createSheet.deviceId.displayName=Device ID",
133 "ImageNode.createSheet.deviceId.desc=Device ID of the image"})
135 Sheet sheet = super.createSheet();
136 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
137 if (sheetSet == null) {
138 sheetSet = Sheet.createPropertiesSet();
142 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.name"),
143 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.displayName"),
144 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.desc"),
147 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_type_name(),
148 Bundle.ImageNode_createSheet_type_displayName(),
149 Bundle.ImageNode_createSheet_type_desc(),
150 Bundle.ImageNode_createSheet_type_text()));
152 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_size_name(),
153 Bundle.ImageNode_createSheet_size_displayName(),
154 Bundle.ImageNode_createSheet_size_desc(),
155 this.content.getSize()));
156 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_sectorSize_name(),
157 Bundle.ImageNode_createSheet_sectorSize_displayName(),
158 Bundle.ImageNode_createSheet_sectorSize_desc(),
159 this.content.getSsize()));
161 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_timezone_name(),
162 Bundle.ImageNode_createSheet_timezone_displayName(),
163 Bundle.ImageNode_createSheet_timezone_desc(),
164 this.content.getTimeZone()));
167 ResultSet deviceIdSet = query.getResultSet();
168 if (deviceIdSet.next()) {
169 sheetSet.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_deviceId_name(),
170 Bundle.ImageNode_createSheet_deviceId_displayName(),
171 Bundle.ImageNode_createSheet_deviceId_desc(),
172 deviceIdSet.getString(
"device_id")));
175 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
182 public <T> T accept(ContentNodeVisitor<T> visitor) {
183 return visitor.visit(
this);
193 return visitor.
visit(
this);
198 return getClass().getName();
206 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
207 String eventType = evt.getPropertyName();
215 if ((moduleContentEvent.getSource() instanceof Content) ==
false) {
218 Content newContent = (Content) moduleContentEvent.getSource();
221 Content parent = newContent.getParent();
222 if (parent != null) {
224 if (parent.getName().equals(VirtualDirectory.NAME_CARVED)) {
226 if (parent.getParent().getId() ==
getContent().getId()) {
227 Children children = getChildren();
228 if (children != null) {
229 ((ContentChildren) children).refreshChildren();
230 children.getNodesCount();
235 }
catch (TskCoreException ex) {
239 if (evt.getNewValue() == null) {
void removeIngestModuleEventListener(final PropertyChangeListener listener)
static synchronized IngestManager getInstance()
static List< Action > getActions(Content c)
Action[] getActions(boolean context)
T visit(DataSourcesNode in)
SleuthkitCase getSleuthkitCase()
final PropertyChangeListener pcl
static final Logger logger
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)