19 package org.sleuthkit.autopsy.datamodel;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.ArrayList;
24 import java.util.EnumSet;
25 import java.util.List;
27 import java.util.logging.Level;
28 import javax.swing.Action;
29 import org.apache.commons.lang3.tuple.Pair;
30 import org.openide.nodes.Sheet;
31 import org.openide.util.NbBundle;
67 static String nameForVolume(Volume vol) {
68 return "vol" + Long.toString(vol.getAddr());
79 String volName = nameForVolume(vol);
80 long end = vol.getStart() + (vol.getLength() - 1);
81 String tempVolName = volName +
" (" + vol.getDescription() +
": " + vol.getStart() +
"-" + end +
")";
85 if (vol.getParent() != null &&
86 vol.getParent().getParent() instanceof Pool) {
88 tempVolName = volName +
" (" + vol.getDescription() +
": " + vol.getStart() +
")";
90 }
catch (TskCoreException ex) {
91 logger.log(Level.WARNING,
"Error looking up parent(s) of volume with obj ID = "+ vol.getId(), ex);
93 this.setDisplayName(tempVolName);
95 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/vol-icon.png");
111 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
112 String eventType = evt.getPropertyName();
120 if ((moduleContentEvent.getSource() instanceof Content) ==
false) {
123 Content newContent = (Content) moduleContentEvent.getSource();
126 Content parent = newContent.getParent();
127 if (parent != null) {
129 if (parent.getName().equals(VirtualDirectory.NAME_CARVED)) {
131 if (newContent.getDataSource().getId() ==
getContent().getDataSource().getId()) {
134 while ((parent = parent.getParent()) != null) {
143 }
catch (TskCoreException ex) {
146 logger.log(Level.WARNING, eventType, ex);
149 if (evt.getNewValue() == null) {
165 List<Action> actionsList =
new ArrayList<>();
167 for (Action a : super.getActions(
true)) {
172 NbBundle.getMessage(
this.getClass(),
"VolumeNode.getActions.viewInNewWin.text"),
this));
175 return actionsList.toArray(
new Action[actionsList.size()]);
180 Sheet sheet = super.createSheet();
181 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
182 if (sheetSet == null) {
183 sheetSet = Sheet.createPropertiesSet();
187 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.name.name"),
188 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.name.displayName"),
189 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.name.desc"),
190 this.getDisplayName()));
191 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.id.name"),
192 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.id.displayName"),
193 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.id.desc"),
195 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.startSector.name"),
196 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.startSector.displayName"),
197 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.startSector.desc"),
198 content.getStart()));
199 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.lenSectors.name"),
200 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.lenSectors.displayName"),
201 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.lenSectors.desc"),
202 content.getLength()));
203 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.description.name"),
204 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.description.displayName"),
205 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.description.desc"),
206 content.getDescription()));
207 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.flags.name"),
208 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.flags.displayName"),
209 NbBundle.getMessage(
this.getClass(),
"VolumeNode.createSheet.flags.desc"),
210 content.getFlagsAsString()));
216 public <T> T accept(ContentNodeVisitor<T> visitor) {
217 return visitor.visit(
this);
227 return visitor.
visit(
this);
244 return new ArrayList<>();
void removeIngestModuleEventListener(final PropertyChangeListener listener)
Pair< Long, String > getCountPropertyAndDescription(CorrelationAttributeInstance.Type attributeType, String attributeValue, String defaultDescription)
static synchronized IngestManager getInstance()
Action[] getActions(boolean popup)
static final Set< IngestManager.IngestModuleEvent > INGEST_MODULE_EVENTS_OF_INTEREST
Pair< DataResultViewerTable.Score, String > getScorePropertyAndDescription(List< Tag > tags)
static List< Action > getActions(Content c)
static final Logger logger
DataResultViewerTable.HasCommentStatus getCommentProperty(List< Tag > tags, CorrelationAttributeInstance attribute)
T visit(DataSourcesNode in)
CorrelationAttributeInstance getCorrelationAttributeInstance()
List< Tag > getAllTagsFromDatabase()
final PropertyChangeListener pcl
static void post(String nodeName, Object event)
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static final String NO_DESCR