Remove ContentNode.getContent()

This commit is contained in:
Peter J. Martel 2011-12-08 17:46:58 -05:00
parent dfcf854109
commit c842c9a6b5
13 changed files with 306 additions and 329 deletions

View File

@ -23,6 +23,7 @@ import java.awt.Cursor;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTextPane;
import org.openide.nodes.Node;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.datamodel.ContentNode;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
@ -274,12 +275,16 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
@Override
public void setNode(ContentNode selectedNode) {
if (selectedNode != null) {
this.setDataView(selectedNode.getContent(), 0, false);
} else {
this.setDataView(null, 0, true);
Content content = ((Node) selectedNode).getLookup().lookup(Content.class);
if (content != null) {
this.setDataView(content, 0, false);
return;
}
}
this.setDataView(null, 0, true);
}
@Override
public String getTitle() {
return "Hex View";

View File

@ -31,6 +31,7 @@ import org.openide.nodes.Node;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.datamodel.ContentNode;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskException;
/**
@ -90,7 +91,10 @@ public class DataContentViewerPicture extends javax.swing.JPanel implements Data
if (selectedNode != null) {
try {
// read the byte of the image file
byte[] dataSource = selectedNode.getContent().read(0, selectedNode.getContent().getSize());
// TODO: ContentNode fix - get rid of cast to Node
Content content = ((Node) selectedNode).getLookup().lookup(Content.class);
byte[] dataSource = content.read(0, content.getSize());
// create the input stream for the content
InputStream is = new ByteArrayInputStream(dataSource);

View File

@ -22,6 +22,7 @@ import java.awt.Component;
import java.awt.Cursor;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.nodes.Node;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.datamodel.ContentNode;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
@ -268,12 +269,16 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
@Override
public void setNode(ContentNode selectedNode) {
if (selectedNode != null) {
this.setDataView(selectedNode.getContent(), 0, false);
} else {
this.setDataView(null, 0, true);
Content content = ((Node) selectedNode).getLookup().lookup(Content.class);
if (content != null) {
this.setDataView(content, 0, false);
return;
}
}
this.setDataView(null, 0, true);
}
@Override
public String getTitle() {
return "String View";

View File

@ -49,7 +49,6 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
private transient ExplorerManager em = new ExplorerManager();
private String firstColumnLabel = "Name";
private boolean isImageNode;
/** Creates new form DataResultViewerTable */
public DataResultViewerTable() {
@ -63,7 +62,6 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
// don't show the root node
ov.getOutline().setRootVisible(false);
this.isImageNode = false;
this.em.addPropertyChangeListener(this);
}
@ -98,13 +96,6 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
}// </editor-fold>//GEN-END:initComponents
private void tableScrollPanelComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_tableScrollPanelComponentResized
if (this.tableScrollPanel.getWidth() < 700 && isImageNode) {
((OutlineView) this.tableScrollPanel).getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
} else {
if (isImageNode) {
((OutlineView) this.tableScrollPanel).getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
}
}
}//GEN-LAST:event_tableScrollPanelComponentResized
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane tableScrollPanel;
@ -211,8 +202,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
// show the horizontal scroll panel and show all the content & header
if (!(selectedNode.getContent() instanceof Image)) {
this.isImageNode = false;
int totalColumns = props.length;
//int scrollWidth = ttv.getWidth();
@ -252,12 +242,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
// turn on the auto resize
ov.getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
}
} else {
this.isImageNode = true;
// turn on the auto resize for image result
ov.getOutline().getColumnModel().getColumn(0).setPreferredWidth(175);
ov.getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
}
} else {
Node emptyNode = new AbstractNode(Children.LEAF);
em.setRootContext(emptyNode); // make empty node

View File

@ -90,16 +90,6 @@ abstract class AbstractContentNode<T extends Content> extends AbstractNode imple
return content.read(offset, len);
}
/**
* Returns the content of this node.
*
* @return content the content of this node (can be image, volume, directory, or file)
*/
@Override
public Content getContent() {
return content;
}
private static final ShortNameVisitor shortName = new ShortNameVisitor();
private static final GetPathVisitor getDisplayPath = new GetPathVisitor(shortName);

View File

@ -22,7 +22,6 @@ import java.sql.SQLException;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.sleuthkit.datamodel.Content;
public class ContentFilterNode extends FilterNode implements ContentNode {
@ -43,11 +42,6 @@ public class ContentFilterNode extends FilterNode implements ContentNode {
return ((ContentNode) super.getOriginal()).getRowValues(rows);
}
@Override
public Content getContent() {
return ((ContentNode) super.getOriginal()).getContent();
}
@Override
public String[] getDisplayPath() {
return ((ContentNode) super.getOriginal()).getDisplayPath();

View File

@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.datamodel;
import java.sql.SQLException;
import org.sleuthkit.datamodel.Content;
/**
* Interface class that all Data nodes inherit from.
@ -38,13 +37,6 @@ public interface ContentNode {
*/
public Object[][] getRowValues(int rows) throws SQLException;
/**
* Returns the content of this node.
*
* @return content the content of this node (can be image, volume, directory, or file)
*/
public Content getContent();
/**
* Returns full path to this node.
*

View File

@ -74,27 +74,34 @@ public class DataResultFilterNode extends FilterNode implements ContentNode {
List<Action> actions = new ArrayList<Action>();
// TODO: ContentNode fix - restore right-click actions
// TODO: ContentVisitor instead of instanceof
Content nodeContent = this.currentNode.getLookup().lookup(Content.class);
// right click action(s) for image node
if (this.currentNode instanceof ImageNode) {
actions.add(new NewWindowViewAction("View in New Window", (ImageNode) this.currentNode));
actions.addAll(ShowDetailActionVisitor.getActions(((ImageNode) this.currentNode).getContent()));
actions.addAll(ShowDetailActionVisitor.getActions(nodeContent));
} // right click action(s) for volume node
else if (this.currentNode instanceof VolumeNode) {
actions.add(new NewWindowViewAction("View in New Window", (VolumeNode) this.currentNode));
//new ShowDetailActionVisitor("Volume Details", this.currentNode.getName(), (VolumeNode) this.currentNode),
actions.addAll(ShowDetailActionVisitor.getActions(((VolumeNode) this.currentNode).getContent()));
actions.addAll(ShowDetailActionVisitor.getActions(nodeContent));
actions.add(new ChangeViewAction("View", 0, (ContentNode) currentNode));
} // right click action(s) for directory node
else if (this.currentNode instanceof DirectoryNode) {
actions.add(new NewWindowViewAction("View in New Window", (DirectoryNode) this.currentNode));
actions.add(new ChangeViewAction("View", 0, (ContentNode) currentNode));
actions.add(new ExtractAction("Extract Directory", (DirectoryNode) this.currentNode));
// TODO: ContentNode fix - reimplement ExtractAction
//actions.add(new ExtractAction("Extract Directory", (DirectoryNode) this.currentNode));
} // right click action(s) for the file node
else if (this.currentNode instanceof FileNode) {
actions.add(new ExternalViewerAction("Open File in External Viewer", (FileNode) this.currentNode));
actions.add(new NewWindowViewAction("View in New Window", (FileNode) this.currentNode));
actions.add(new ExtractAction("Extract", (FileNode) this.currentNode));
// TODO: ContentNode fix - reimplement ExtractAction
//actions.add(new ExtractAction("Extract", (FileNode) this.currentNode));
actions.add(new ChangeViewAction("View", 0, (ContentNode) currentNode));
}
@ -194,11 +201,6 @@ public class DataResultFilterNode extends FilterNode implements ContentNode {
return ((ContentNode) currentNode).getRowValues(rows);
}
@Override
public Content getContent() {
return ((ContentNode) currentNode).getContent();
}
@Override
public String[] getDisplayPath() {
return ((ContentNode) currentNode).getDisplayPath();

View File

@ -46,11 +46,14 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
@Override
protected Node[] createNodes(Node arg0) {
//TODO: ContentNode fix - replace with ContentVisitor
// filter out the FileNode and the "." and ".." directories
if (arg0 != null && (arg0 instanceof ImageNode
|| arg0 instanceof VolumeNode || (arg0 instanceof DirectoryNode
&& !((Directory) ((DirectoryNode) arg0).getContent()).getName().equals(".")
&& !((Directory) ((DirectoryNode) arg0).getContent()).getName().equals("..")))) {
&& !((DirectoryNode) arg0).getDisplayName().equals("."))
&& !((DirectoryNode) arg0).getDisplayName().equals(".."))) {
return new Node[]{this.copyNode(arg0)};
} else {
return new Node[]{};

View File

@ -30,8 +30,8 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.openide.nodes.Node;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.autopsy.logging.Log;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskException;
/**
@ -41,7 +41,7 @@ import org.sleuthkit.datamodel.TskException;
public class ExternalViewerAction extends AbstractAction {
private byte[] content;
private FileNode fileNode;
private Content contentObject;
private String fileName;
private String extension;
// for error handling
@ -49,12 +49,12 @@ public class ExternalViewerAction extends AbstractAction {
private String className = this.getClass().toString();
/** the constructor */
public ExternalViewerAction(String title, FileNode fileNode) {
public ExternalViewerAction(String title, Node fileNode) {
super(title);
this.fileNode = fileNode;
this.contentObject = fileNode.getLookup().lookup(Content.class);
long size = fileNode.getContent().getSize();
String fullFileName = ((Node)fileNode).getDisplayName();
long size = contentObject.getSize();
String fullFileName = fileNode.getDisplayName();
if (fullFileName.contains(".") && size > 0) {
String tempFileName = fullFileName.substring(0, fullFileName.indexOf("."));
String tempExtension = fullFileName.substring(fullFileName.indexOf("."));
@ -63,7 +63,7 @@ public class ExternalViewerAction extends AbstractAction {
} else {
this.fileName = fullFileName;
this.extension = "";
this.setEnabled(false); // fix this later (right now only extract a file with extension)
this.setEnabled(false); //TODO: fix this later (right now only extract a file with extension)
}
}
@ -77,7 +77,7 @@ public class ExternalViewerAction extends AbstractAction {
// the menu should be disabled if we can't read the content (for example: on zero-sized file).
// Therefore, it should never throw the TSKException.
try {
this.content = fileNode.getContent().read(0, fileNode.getContent().getSize());
this.content = contentObject.read(0, contentObject.getSize());
} catch (TskException ex) {
Logger.getLogger(this.className).log(Level.WARNING, "Error: can't read the content of the file.", ex);
}

View File

@ -1,218 +1,225 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.directorytree;
import org.sleuthkit.autopsy.datamodel.FileNode;
import java.io.*;
import java.awt.event.ActionEvent;
import javax.swing.JFileChooser;
import java.io.File;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import org.openide.nodes.Node;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.datamodel.ContentNode;
import org.sleuthkit.autopsy.datamodel.DirectoryNode;
import org.sleuthkit.autopsy.logging.Log;
import org.sleuthkit.datamodel.TskException;
/**
* This is an action class to extract and save the bytes given as a file.
*
* @author jantonius
*/
public final class ExtractAction extends AbstractAction {
private JFileChooser fc = new JFileChooser();
private byte[] source;
private ContentNode contentNode;
private String fileName;
private String extension;
// for error handling
private JPanel caller;
private String className = this.getClass().toString();
/** the constructor */
public ExtractAction(String title, ContentNode contentNode) {
super(title);
String fullFileName = ((Node)contentNode).getDisplayName();
if (fullFileName.equals(".")) {
// . folders are not associated with their children in the database,
// so get original
Node parentNode = ((Node) contentNode).getParentNode();
this.contentNode = (ContentNode) parentNode;
fullFileName = parentNode.getDisplayName();
} else {
this.contentNode = contentNode;
}
long size = contentNode.getContent().getSize();
// TODO: ContentNode fix - reimplement ExtractAction
/**
* Checks first if the the selected it file or directory. If it's a file,
* check if the file size is bigger than 0. If it's a directory, check
* if it's not referring to the parent directory. Disables the menu otherwise.
*/
if ((contentNode instanceof FileNode && size > 0) || (contentNode instanceof DirectoryNode && !fullFileName.equals(".."))) {
if (contentNode instanceof FileNode && fullFileName.contains(".")) {
String tempFileName = fullFileName.substring(0, fullFileName.indexOf("."));
String tempExtension = fullFileName.substring(fullFileName.indexOf("."));
this.fileName = tempFileName;
this.extension = tempExtension;
} else {
this.fileName = fullFileName;
this.extension = "";
}
} else {
this.fileName = fullFileName;
this.extension = "";
this.setEnabled(false); // can't extract zero-sized file or ".." directory
}
}
/**
* Converts and saves the bytes into the file.
*
* @param e the action event
*/
@Override
public void actionPerformed(ActionEvent e) {
Log.noteAction(this.getClass());
// set the filter for FileNode
if (contentNode instanceof FileNode && !extension.equals("")) {
//FileFilter filter = new ExtensionFileFilter(extension.substring(1).toUpperCase() + " File (*" + extension + ")", new String[]{extension.substring(1)});
String[] fileExt = {extension};
FileFilter filter = new GeneralFilter(fileExt, extension.substring(1).toUpperCase() + " File (*" + extension + ")", false);
fc.setFileFilter(filter);
}
fc.setSelectedFile(new File(this.fileName));
int returnValue = fc.showSaveDialog((Component) e.getSource());
if (returnValue == JFileChooser.APPROVE_OPTION) {
String path = fc.getSelectedFile().getPath() + extension;
try {
// file extraction
if (contentNode instanceof FileNode) {
extractFile(path, (FileNode) contentNode);
}
// directory extraction
if (contentNode instanceof DirectoryNode) {
extractDirectory(path, (DirectoryNode) contentNode);
}
} catch (Exception ex) {
Logger.getLogger(this.className).log(Level.WARNING, "Error: Couldn't extract file/directory.", ex);
}
}
}
/**
* Extracts the content of the given fileNode into the given path.
*
* @param givenPath the path to extract the file
* @param fileNode the file node that contain the file
*/
private void extractFile(String givenPath, FileNode fileNode) throws Exception {
try {
if (fileNode.getContent().getSize() > 0) {
try {
this.source = fileNode.getContent().read(0, fileNode.getContent().getSize());
} catch (TskException ex) {
throw new Exception("Error: can't read the content of the file.", ex);
}
} else {
this.source = new byte[0];
}
String path = givenPath;
File file = new File(path);
if (file.exists()) {
file.delete();
}
file.createNewFile();
// convert char to byte
byte[] dataSource = new byte[source.length];
for (int i = 0; i < source.length; i++) {
dataSource[i] = (byte) source[i];
}
FileOutputStream fos = new FileOutputStream(file);
///*
// * Autopsy Forensic Browser
// *
// * Copyright 2011 Basis Technology Corp.
// * Contact: carrier <at> sleuthkit <dot> org
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package org.sleuthkit.autopsy.directorytree;
//
//import org.sleuthkit.autopsy.datamodel.FileNode;
//import java.io.*;
//import java.awt.event.ActionEvent;
//import javax.swing.JFileChooser;
//import java.io.File;
//import java.awt.Component;
//import java.util.logging.Level;
//import java.util.logging.Logger;
//import javax.swing.AbstractAction;
//import javax.swing.JPanel;
//import javax.swing.filechooser.FileFilter;
//import org.openide.nodes.Node;
//import org.sleuthkit.autopsy.casemodule.GeneralFilter;
//import org.sleuthkit.autopsy.datamodel.DirectoryNode;
//import org.sleuthkit.autopsy.logging.Log;
//import org.sleuthkit.datamodel.Content;
//import org.sleuthkit.datamodel.TskException;
//
///**
// * This is an action class to extract and save the bytes given as a file.
// *
// * @author jantonius
// */
//public final class ExtractAction extends AbstractAction {
//
// private JFileChooser fc = new JFileChooser();
// private byte[] source;
// private Content content;
// private String fileName;
// private String extension;
// // for error handling
// private JPanel caller;
// private String className = this.getClass().toString();
//
// /** the constructor */
// public ExtractAction(String title, Node contentNode) {
// super(title);
//
// String fullFileName = contentNode.getDisplayName();
//
//
// if (fullFileName.equals(".")) {
// // . folders are not associated with their children in the database,
// // so get original
// Node parentNode = contentNode.getParentNode();
// contentNode = parentNode;
// fullFileName = parentNode.getDisplayName();
// }
//
//
// this.content = contentNode.getLookup().lookup(Content.class);
//
// long size = content.getSize();
//
//
//
// /**
// * Checks first if the the selected it file or directory. If it's a file,
// * check if the file size is bigger than 0. If it's a directory, check
// * if it's not referring to the parent directory. Disables the menu otherwise.
// */
// if ((contentNode instanceof FileNode && size > 0) || (contentNode instanceof DirectoryNode && !fullFileName.equals(".."))) {
// if (contentNode instanceof FileNode && fullFileName.contains(".")) {
// String tempFileName = fullFileName.substring(0, fullFileName.indexOf("."));
// String tempExtension = fullFileName.substring(fullFileName.indexOf("."));
// this.fileName = tempFileName;
// this.extension = tempExtension;
// } else {
// this.fileName = fullFileName;
// this.extension = "";
// }
// } else {
// this.fileName = fullFileName;
// this.extension = "";
// this.setEnabled(false); // can't extract zero-sized file or ".." directory
// }
//
// }
//
// /**
// * Converts and saves the bytes into the file.
// *
// * @param e the action event
// */
// @Override
// public void actionPerformed(ActionEvent e) {
// Log.noteAction(this.getClass());
//
// // set the filter for File
// if (content instanceof org.sleuthkit.datamodel.File && !extension.equals("")) {
// //FileFilter filter = new ExtensionFileFilter(extension.substring(1).toUpperCase() + " File (*" + extension + ")", new String[]{extension.substring(1)});
// String[] fileExt = {extension};
// FileFilter filter = new GeneralFilter(fileExt, extension.substring(1).toUpperCase() + " File (*" + extension + ")", false);
// fc.setFileFilter(filter);
// }
//
// fc.setSelectedFile(new File(this.fileName));
//
// int returnValue = fc.showSaveDialog((Component) e.getSource());
// if (returnValue == JFileChooser.APPROVE_OPTION) {
// String path = fc.getSelectedFile().getPath() + extension;
//
//
// // TODO: convert this to a Content Visitor
// try {
// // file extraction
// if (content instanceof org.sleuthkit.datamodel.File) {
// extractFile(path, (org.sleuthkit.datamodel.File) content);
// }
//
// // directory extraction
// if (content instanceof org.sleuthkit.datamodel.File) {
// extractDirectory(path, (org.sleuthkit.datamodel.Directory) content);
// }
// } catch (Exception ex) {
// Logger.getLogger(this.className).log(Level.WARNING, "Error: Couldn't extract file/directory.", ex);
// }
//
// }
//
// }
//
// /**
// * Extracts the content of the given fileNode into the given path.
// *
// * @param givenPath the path to extract the file
// * @param file the file node that contain the file
// */
// private void extractFile(String givenPath, org.sleuthkit.datamodel.File file) throws Exception {
// try {
// if (file.getSize() > 0) {
// try {
// this.source = file.read(0, file.getSize());
// } catch (TskException ex) {
// throw new Exception("Error: can't read the content of the file.", ex);
// }
// } else {
// this.source = new byte[0];
// }
//
// String path = givenPath;
//
// File outputFile = new File(path);
// if (outputFile.exists()) {
// outputFile.delete();
// }
// outputFile.createNewFile();
// // convert char to byte
// byte[] dataSource = new byte[source.length];
// for (int i = 0; i < source.length; i++) {
// dataSource[i] = (byte) source[i];
// }
// FileOutputStream fos = new FileOutputStream(outputFile);
// //fos.write(dataSource);
// fos.write(dataSource);
fos.write(dataSource);
fos.close();
} catch (IOException ex) {
throw new Exception("Error while trying to extract the file.", ex);
}
}
/**
* Extracts the content of the given directoryNode into the given path.
*
* @param givenPath the path to extract the directory
* @param dirNode the directory node that contain the directory
*/
private void extractDirectory(String givenPath, DirectoryNode dirNode) throws Exception {
String path = givenPath;
File dir = new File(path);
if (!dir.exists()) {
dir.mkdir();
}
int totalChildren = dirNode.getChildren().getNodesCount();
for (int i = 0; i < totalChildren; i++) {
Node childNode = dirNode.getChildren().getNodeAt(i);
if (childNode instanceof FileNode) {
FileNode fileNode = (FileNode) childNode;
String tempPath = path + File.separator + ((Node)fileNode).getDisplayName();
try {
extractFile(tempPath, fileNode);
} catch (Exception ex) {
throw ex;
}
}
if (childNode instanceof DirectoryNode) {
DirectoryNode dirNode2 = (DirectoryNode) childNode;
String dirNode2Name = ((Node)dirNode2).getDisplayName();
if (!dirNode2Name.trim().equals(".") && !dirNode2Name.trim().equals("..")) {
String tempPath = path + File.separator + dirNode2Name;
extractDirectory(tempPath, dirNode2);
}
}
}
}
}
// fos.close();
// } catch (IOException ex) {
// throw new Exception("Error while trying to extract the file.", ex);
// }
// }
//
// /**
// * Extracts the content of the given directoryNode into the given path.
// *
// * @param givenPath the path to extract the directory
// * @param dirNode the directory node that contain the directory
// */
// private void extractDirectory(String givenPath, DirectoryNode dirNode) throws Exception {
// String path = givenPath;
// File dir = new File(path);
// if (!dir.exists()) {
// dir.mkdir();
// }
//
// int totalChildren = dirNode.getChildren().getNodesCount();
// for (int i = 0; i < totalChildren; i++) {
// Node childNode = dirNode.getChildren().getNodeAt(i);
//
// if (childNode instanceof FileNode) {
// FileNode fileNode = (FileNode) childNode;
// String tempPath = path + File.separator + ((Node)fileNode).getDisplayName();
// try {
// extractFile(tempPath, fileNode);
// } catch (Exception ex) {
// throw ex;
// }
// }
//
// if (childNode instanceof DirectoryNode) {
// DirectoryNode dirNode2 = (DirectoryNode) childNode;
// String dirNode2Name = ((Node)dirNode2).getDisplayName();
//
// if (!dirNode2Name.trim().equals(".") && !dirNode2Name.trim().equals("..")) {
// String tempPath = path + File.separator + dirNode2Name;
// extractDirectory(tempPath, dirNode2);
// }
// }
// }
//
//
// }
//}

View File

@ -28,7 +28,6 @@ import java.sql.SQLException;
import javax.swing.Action;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.autopsy.directorytree.ChangeViewAction;
/**
@ -74,7 +73,8 @@ public class DataResultFilterNode extends FilterNode implements ContentNode {
} // right click action(s) for the file node
else if (this.currentNode instanceof FileNode) {
return new Action[]{
new ExtractAction("Extract", (FileNode) this.currentNode),
// TODO: ContentNode fix - reimplement ExtractAction
// new ExtractAction("Extract", (FileNode) this.currentNode),
new ChangeViewAction("View", 0, (ContentNode) currentNode),
new OpenParentFolderAction("Open Parent Directory", ((ContentNode) currentNode).getSystemPath())
};
@ -99,11 +99,6 @@ public class DataResultFilterNode extends FilterNode implements ContentNode {
return ((ContentNode) currentNode).getRowValues(rows);
}
@Override
public Content getContent() {
return ((ContentNode) currentNode).getContent();
}
@Override
public String[] getDisplayPath() {
return ((ContentNode) currentNode).getDisplayPath();

View File

@ -78,11 +78,6 @@ class SearchNode extends AbstractNode implements ContentNode {
return objs;
}
@Override
public Content getContent() {
return null;
}
@Override
public String[] getDisplayPath() {
return new String[]{"KeyWord Search Result:"};