mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
volume node work
This commit is contained in:
parent
33c5c08a43
commit
3d634568b8
@ -1,154 +1,181 @@
|
|||||||
///*
|
/*
|
||||||
// * Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
// *
|
*
|
||||||
// * Copyright 2011-2021 Basis Technology Corp.
|
* Copyright 2011-2021 Basis Technology Corp.
|
||||||
// * Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
// *
|
*
|
||||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// * you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
// * You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
// *
|
*
|
||||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
// *
|
*
|
||||||
// * Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// * See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
// * limitations under the License.
|
* limitations under the License.
|
||||||
// */
|
*/
|
||||||
//package org.sleuthkit.autopsy.datamodel;
|
package org.sleuthkit.autopsy.datamodel;
|
||||||
//
|
|
||||||
//import java.beans.PropertyChangeEvent;
|
import java.util.ArrayList;
|
||||||
//import java.beans.PropertyChangeListener;
|
import java.util.Arrays;
|
||||||
//import java.util.ArrayList;
|
import java.util.List;
|
||||||
//import java.util.Arrays;
|
import javax.swing.Action;
|
||||||
//import java.util.EnumSet;
|
import org.openide.nodes.AbstractNode;
|
||||||
//import java.util.List;
|
import org.openide.nodes.Sheet;
|
||||||
//import java.util.Set;
|
import org.openide.util.NbBundle;
|
||||||
//import java.util.logging.Level;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
//import javax.swing.Action;
|
import org.sleuthkit.autopsy.directorytree.ExplorerNodeActionVisitor;
|
||||||
//import org.openide.nodes.AbstractNode;
|
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
||||||
//import org.openide.nodes.Sheet;
|
import org.sleuthkit.datamodel.Volume;
|
||||||
//import org.openide.util.NbBundle;
|
import org.sleuthkit.autopsy.directorytree.FileSystemDetailsAction;
|
||||||
//import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
//import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.datamodel.TskData.TSK_VS_PART_FLAG_ENUM;
|
||||||
//import org.sleuthkit.autopsy.datamodel.BaseChildFactory.NoSuchEventBusException;
|
|
||||||
//import org.sleuthkit.autopsy.directorytree.ExplorerNodeActionVisitor;
|
/**
|
||||||
//import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
|
* This class is used to represent the "Node" for the volume. Its child is the
|
||||||
//import org.sleuthkit.autopsy.ingest.IngestManager;
|
* root directory of a file system
|
||||||
//import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
|
*/
|
||||||
//import org.sleuthkit.datamodel.Content;
|
public class VolumeNodev2 extends AbstractNode {
|
||||||
//import org.sleuthkit.datamodel.Pool;
|
|
||||||
//import org.sleuthkit.datamodel.TskCoreException;
|
private static final Logger logger = Logger.getLogger(VolumeNodev2.class.getName());
|
||||||
//import org.sleuthkit.datamodel.VirtualDirectory;
|
|
||||||
//import org.sleuthkit.datamodel.Volume;
|
public static class VolumeTableDTO {
|
||||||
//import org.sleuthkit.autopsy.directorytree.FileSystemDetailsAction;
|
|
||||||
//import org.sleuthkit.datamodel.Tag;
|
private final Volume volume;
|
||||||
//
|
private final long id;
|
||||||
///**
|
private final long addr;
|
||||||
// * This class is used to represent the "Node" for the volume. Its child is the
|
private final long start;
|
||||||
// * root directory of a file system
|
private final long length;
|
||||||
// */
|
private final String description;
|
||||||
//public class VolumeNodev2 extends AbstractNode {
|
private final boolean contiguousVolume; // based on vol.getParent() != null && vol.getParent().getParent() instanceof Pool
|
||||||
//
|
private final TskData.TSK_VS_PART_FLAG_ENUM partitionFlag; // see Volume.vsFlagToString
|
||||||
// private static final Logger logger = Logger.getLogger(VolumeNodev2.class.getName());
|
|
||||||
//
|
public VolumeTableDTO(Volume volume, long id, long addr, long start, long length, String description, boolean contiguousVolume, TSK_VS_PART_FLAG_ENUM partitionFlag) {
|
||||||
//
|
this.volume = volume;
|
||||||
// public static class VolumeTableDTO {
|
this.id = id;
|
||||||
// private final long volAddr;
|
this.addr = addr;
|
||||||
//
|
this.start = start;
|
||||||
// public long getVolAddr() {
|
this.length = length;
|
||||||
// return volAddr;
|
this.description = description;
|
||||||
// }
|
this.contiguousVolume = contiguousVolume;
|
||||||
// }
|
this.partitionFlag = partitionFlag;
|
||||||
//
|
}
|
||||||
////
|
|
||||||
//// static String nameForVolume(VolumeTableDTO vol) {
|
|
||||||
//// return "vol" + Long.toString(vol.getAddr()); //NON-NLS
|
public long getAddr() {
|
||||||
//// }
|
return addr;
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// *
|
public long getStart() {
|
||||||
// * @param vol underlying Content instance
|
return start;
|
||||||
// */
|
}
|
||||||
// public VolumeNodev2(VolumeTableDTO vol) {
|
|
||||||
// super(vol);
|
public long getLength() {
|
||||||
//
|
return length;
|
||||||
// // set name, display name, and icon
|
}
|
||||||
// String volName = nameForVolume(vol);
|
|
||||||
// long end = vol.getStart() + (vol.getLength() - 1);
|
public String getDescription() {
|
||||||
// String tempVolName = volName + " (" + vol.getDescription() + ": " + vol.getStart() + "-" + end + ")";
|
return description;
|
||||||
//
|
}
|
||||||
// // If this is a pool volume use a custom display name
|
|
||||||
// try {
|
public boolean isContiguousVolume() {
|
||||||
// if (vol.getParent() != null
|
return contiguousVolume;
|
||||||
// && vol.getParent().getParent() instanceof Pool) {
|
}
|
||||||
// // Pool volumes are not contiguous so printing a range of blocks is inaccurate
|
|
||||||
// tempVolName = volName + " (" + vol.getDescription() + ": " + vol.getStart() + ")";
|
public TSK_VS_PART_FLAG_ENUM getPartitionFlag() {
|
||||||
// }
|
return partitionFlag;
|
||||||
// } catch (TskCoreException ex) {
|
}
|
||||||
// logger.log(Level.WARNING, "Error looking up parent(s) of volume with obj ID = " + vol.getId(), ex);
|
|
||||||
// }
|
public long getId() {
|
||||||
// this.setDisplayName(tempVolName);
|
return id;
|
||||||
//
|
}
|
||||||
// this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/vol-icon.png"); //NON-NLS
|
|
||||||
// }
|
public Volume getVolume() {
|
||||||
//
|
return volume;
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * Right click action for volume node
|
}
|
||||||
// *
|
|
||||||
// * @param popup
|
private final VolumeTableDTO volData;
|
||||||
// *
|
|
||||||
// * @return
|
/**
|
||||||
// */
|
*
|
||||||
// @Override
|
* @param vol underlying Content instance
|
||||||
// public Action[] getActions(boolean popup) {
|
*/
|
||||||
// List<Action> actionsList = new ArrayList<>();
|
public VolumeNodev2(VolumeTableDTO vol) {
|
||||||
// actionsList.add(new FileSystemDetailsAction(content));
|
super(ContentNodeUtilv2.getChildren(vol.getId()), ContentNodeUtilv2.getLookup(vol.getVolume()));
|
||||||
// actionsList.add(new NewWindowViewAction(
|
setIconBaseWithExtension("org/sleuthkit/autopsy/images/vol-icon.png");
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this));
|
setDisplayName(getDisplayName(vol));
|
||||||
// actionsList.addAll(ExplorerNodeActionVisitor.getActions(content));
|
setName(ContentNodeUtilv2.getContentName(vol.getId()));
|
||||||
// actionsList.add(null);
|
this.volData = vol;
|
||||||
// actionsList.addAll(Arrays.asList(super.getActions(true)));
|
|
||||||
//
|
}
|
||||||
// return actionsList.toArray(new Action[actionsList.size()]);
|
|
||||||
// }
|
private String getDisplayName(VolumeTableDTO vol) {
|
||||||
//
|
// set name, display name, and icon
|
||||||
// @Override
|
String volName = "vol" + Long.toString(vol.getAddr());
|
||||||
// protected Sheet createSheet() {
|
long end = vol.getStart() + (vol.getLength() - 1);
|
||||||
// Sheet sheet = super.createSheet();
|
return vol.isContiguousVolume()
|
||||||
// Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
|
? volName + " (" + vol.getDescription() + ": " + vol.getStart() + "-" + end + ")"
|
||||||
// if (sheetSet == null) {
|
: volName + " (" + vol.getDescription() + ": " + vol.getStart() + ")";
|
||||||
// sheetSet = Sheet.createPropertiesSet();
|
}
|
||||||
// sheet.put(sheetSet);
|
|
||||||
// }
|
/**
|
||||||
//
|
* Right click action for volume node
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"),
|
*
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
|
* @param popup
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
|
*
|
||||||
// this.getDisplayName()));
|
* @return
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"),
|
*/
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
|
@Override
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
|
public Action[] getActions(boolean popup) {
|
||||||
// content.getAddr()));
|
List<Action> actionsList = new ArrayList<>();
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"),
|
actionsList.add(new FileSystemDetailsAction(volData.getVolume()));
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
|
actionsList.add(new NewWindowViewAction(
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
|
NbBundle.getMessage(this.getClass(), "VolumeNode.getActions.viewInNewWin.text"), this));
|
||||||
// content.getStart()));
|
actionsList.addAll(ExplorerNodeActionVisitor.getActions(volData.getVolume()));
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"),
|
actionsList.add(null);
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
|
actionsList.addAll(Arrays.asList(super.getActions(true)));
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
|
|
||||||
// content.getLength()));
|
return actionsList.toArray(new Action[actionsList.size()]);
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"),
|
}
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
|
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
|
@Override
|
||||||
// content.getDescription()));
|
protected Sheet createSheet() {
|
||||||
// sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"),
|
Sheet sheet = super.createSheet();
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
|
Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
|
||||||
// NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
|
if (sheetSet == null) {
|
||||||
// content.getFlagsAsString()));
|
sheetSet = Sheet.createPropertiesSet();
|
||||||
//
|
sheet.put(sheetSet);
|
||||||
// return sheet;
|
}
|
||||||
// }
|
|
||||||
//}
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.name.desc"),
|
||||||
|
this.getDisplayName()));
|
||||||
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.id.desc"),
|
||||||
|
volData.getAddr()));
|
||||||
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.startSector.desc"),
|
||||||
|
volData.getStart()));
|
||||||
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.lenSectors.desc"),
|
||||||
|
volData.getLength()));
|
||||||
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.description.desc"),
|
||||||
|
volData.getDescription()));
|
||||||
|
sheetSet.put(new NodeProperty<>(NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.name"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.displayName"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "VolumeNode.createSheet.flags.desc"),
|
||||||
|
Volume.vsFlagToString(volData.getPartitionFlag().getVsFlag())));
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user