index only files, added info log to indexing, fixed strings extraction, reduced calls to DataContentViewers

This commit is contained in:
Brian Carrier 2011-12-30 15:55:10 -05:00
parent c03e49fcfd
commit 5f8a2581f2
8 changed files with 26 additions and 34 deletions

View File

@ -200,7 +200,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
}
}
resetTabs(currentNode);
setupTabs(currentNode);
}
@Override
@ -248,14 +248,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
currentNode = selectedNode;
resetTabs(selectedNode);
// set the display on the current active tab
int currentActiveTab = dataContentTabbedPane.getSelectedIndex();
if (currentActiveTab != -1) {
UpdateWrapper dcv = viewers.get(currentActiveTab);
dcv.setNode(selectedNode);
}
setupTabs(selectedNode);
} finally {
this.setCursor(null);
}
@ -296,7 +289,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
*
* @param selectedNode the selected content Node
*/
public void resetTabs(Node selectedNode) {
public void setupTabs(Node selectedNode) {
int totalTabs = dataContentTabbedPane.getTabCount();

View File

@ -223,11 +223,9 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
}
// set the data on the bottom and show it
String text = "";
Boolean setVisible = false;
if (data != null) {
text = DataConversion.getString(data, 4);
setVisible = true;
}

View File

@ -133,6 +133,7 @@ public class DataConversion {
Charset.forName("UTF-8").newEncoder();
*/
final StringBuilder result = new StringBuilder();
StringBuilder temp = new StringBuilder();
int counter = 0;
@ -141,28 +142,25 @@ public class DataConversion {
final char NL = (char) 10; // ASCII char for new line
final String NLS = Character.toString(NL);
for (int i = 0; i < args.length; i++) {
char tempChar = (char) args[i];
int dec = (int) tempChar;
char curChar = (char) args[i];
int curCharInt = (int) curChar;
// the printable ASCII chars are dec 32-126
// and we want to include TAB as well (dec 9)
if (!((dec < 32 || dec > 126) && dec != 9)) {
temp.append(NLS);
++counter;
} else {
// ignore non-printable ASCII chars
// 32-126 and TAB ( 9)
if (((curCharInt < 32) && (curCharInt != 9)) || (curCharInt > 126)) {
if (counter >= parameter) {
// add to the result and also add the new line at the end
result.append(temp);
result.append(Character.toString(NL));
// reset the temp and counter
temp = new StringBuilder();
counter = 0;
}
// reset the temp and counter
temp = new StringBuilder();
counter = 0;
}
else {
temp.append(curChar);
++counter;
}
}
result.append(temp);

View File

@ -29,12 +29,12 @@ import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskData.FileKnown;
/**
* Visitor for getting all the files to try to index from any Content object.
* Currently gets all the files with a file extensions that match a list of
* document types that Tika/Solr-Cell supports.
* Currently gets all non-zero files.
*/
class GetAllFilesContentVisitor extends GetFilesContentVisitor {
@ -53,7 +53,8 @@ class GetAllFilesContentVisitor extends GetFilesContentVisitor {
SleuthkitCase sc = Case.getCurrentCase().getSleuthkitCase();
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
+ " AND (known != " + FileKnown.KNOWN.toLong() + ")";
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType() +
") AND (known != " + FileKnown.KNOWN.toLong() + ") AND (size > 0)";
try {
ResultSet rs = sc.runQuery(query);
return sc.resultSetToFsContents(rs);

View File

@ -31,11 +31,12 @@ import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData.FileKnown;
import org.sleuthkit.datamodel.TskData;
/**
* Visitor for getting all the files to try to index from any Content object.
* Currently gets all the files with a file extensions that match a list of
* Currently gets all the non-zero sized files with a file extensions that match a list of
* document types that Tika/Solr-Cell supports.
*/
class GetIngestableFilesContentVisitor extends GetFilesContentVisitor {
@ -88,7 +89,9 @@ class GetIngestableFilesContentVisitor extends GetFilesContentVisitor {
String query = "SELECT * FROM tsk_files WHERE fs_obj_id = " + fs.getId()
+ " AND (" + extensionsLikePredicate + ")"
+ " AND (known != " + FileKnown.KNOWN.toLong() + ")";
+ " AND (known != " + FileKnown.KNOWN.toLong() + ")"
+ " AND (meta_type = " + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG.getMetaType() + ")"
+ " AND (size > 0)";
try {
ResultSet rs = sc.runQuery(query);
return sc.resultSetToFsContents(rs);
@ -97,6 +100,4 @@ class GetIngestableFilesContentVisitor extends GetFilesContentVisitor {
return Collections.EMPTY_SET;
}
}
}

View File

@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import java.util.logging.Level;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
@ -113,6 +114,7 @@ class Ingester {
setFields(up, fields);
up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
logger.log(Level.INFO, "Ingesting " + fields.get("file_name"));
up.setParam("commit", "false");
try {

View File

@ -306,8 +306,7 @@ class Server {
@Override
public void actionPerformed(ActionEvent e) {
logger.log(Level.INFO, e.paramString());
}
logger.log(Level.INFO, e.paramString().trim());
}
}
}