mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
More work
This commit is contained in:
parent
0068d3acfd
commit
8494453a09
@ -24,7 +24,6 @@ import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
|
||||
/**
|
||||
* A DataContentViewer that displays text with the TextViewers available.
|
||||
|
@ -42,7 +42,7 @@ AbstractKeywordSearchPerformer.search.emptyKeywordErrorBody=Keyword list is empt
|
||||
AbstractKeywordSearchPerformer.search.noFilesInIdxMsg=<html>No files are in index yet. <br />If Solr keyword search indexing was enabled, wait for ingest to complete</html>
|
||||
AbstractKeywordSearchPerformer.search.noFilesIdxdMsg=<html>No files were indexed.<br />Re-ingest the image with the Keyword Search Module and Solr indexing enabled. </html>
|
||||
ExtractedContentViewer.toolTip=Displays extracted text from files and keyword-search results. Requires Keyword Search ingest to be run on a file to activate this viewer.
|
||||
ExtractedContentViewer.getTitle=Indexed Text
|
||||
ExtractedContentViewer.getTitle=Extracted Text
|
||||
HighlightedMatchesSource.toString=Search Results
|
||||
Installer.reportPortError=Indexing server port {0} is not available. Check if your security software does not block {1} and consider changing {2} in {3} property file in the application user folder. Then try rebooting your system if another process was causing the conflict.
|
||||
Installer.reportStopPortError=Indexing server stop port {0} is not available. Consider changing {1} in {2} property file in the application user folder.
|
||||
|
@ -556,7 +556,11 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
* @param total total number of pages to update the display with
|
||||
*/
|
||||
void updateTotalPagesDisplay(int total) {
|
||||
if (total >= 0) {
|
||||
pageTotalLabel.setText(Integer.toString(total));
|
||||
} else {
|
||||
pageTotalLabel.setText("-");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -655,13 +659,14 @@ class ExtractedContentPanel extends javax.swing.JPanel implements ResizableTextP
|
||||
int totalPages = source.getNumberPages();
|
||||
updateTotalPagesDisplay(totalPages);
|
||||
|
||||
if (totalPages < 2) {
|
||||
enableNextPageControl(false);
|
||||
enablePrevPageControl(false);
|
||||
} else {
|
||||
// ELTODO
|
||||
//if (totalPages < 2) {
|
||||
// enableNextPageControl(false);
|
||||
// enablePrevPageControl(false);
|
||||
//} else {
|
||||
enableNextPageControl(source.hasNextPage());
|
||||
enablePrevPageControl(source.hasPreviousPage());
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,19 +32,16 @@ import org.sleuthkit.autopsy.textextractors.TextExtractor;
|
||||
import org.sleuthkit.autopsy.textextractors.TextExtractorFactory;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
/**
|
||||
/** ELTODO
|
||||
* A "source" for the extracted abstractFile viewer that displays "raw" (not
|
||||
* highlighted) indexed text for a file or an artifact.
|
||||
*/
|
||||
class ExtractedText implements IndexedText { // ELTODO
|
||||
class ExtractedText implements IndexedText {
|
||||
|
||||
private int numPages = 0;
|
||||
private int currentPage = 0;
|
||||
private final AbstractFile abstractFile;
|
||||
private final long objectId;
|
||||
//keep last abstractFile cached
|
||||
private String cachedString;
|
||||
private int cachedChunk;
|
||||
private Chunker chunker = null;
|
||||
private static final Logger logger = Logger.getLogger(ExtractedText.class.getName());
|
||||
|
||||
@ -62,8 +59,7 @@ class ExtractedText implements IndexedText { // ELTODO
|
||||
ExtractedText(AbstractFile file, long objectId) throws TextExtractorFactory.NoTextExtractorFound, TextExtractor.InitReaderException {
|
||||
this.abstractFile = file;
|
||||
this.objectId = objectId;
|
||||
this.currentPage = 0; // ELTODO
|
||||
this.numPages = 1;
|
||||
this.numPages = -1; // We don't know how many pages there are until we reach end of the document
|
||||
initialize();
|
||||
}
|
||||
|
||||
@ -83,8 +79,11 @@ class ExtractedText implements IndexedText { // ELTODO
|
||||
|
||||
@Override
|
||||
public boolean hasNextPage() {
|
||||
if (chunker.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPreviousPage() {
|
||||
@ -144,7 +143,7 @@ class ExtractedText implements IndexedText { // ELTODO
|
||||
@Override
|
||||
public String getText() {
|
||||
try {
|
||||
return getContentText(currentPage + 1); // ELTODO
|
||||
return getContentText(currentPage);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Couldn't get extracted text", ex); //NON-NLS
|
||||
}
|
||||
@ -201,15 +200,6 @@ class ExtractedText implements IndexedText { // ELTODO
|
||||
* @return the extracted text
|
||||
*/
|
||||
private String getContentText(int currentPage) throws TextExtractor.InitReaderException, IOException, Exception {
|
||||
|
||||
// ELTODO
|
||||
//check if cached
|
||||
if (cachedString != null) {
|
||||
if (cachedChunk == currentPage) {
|
||||
return cachedString;
|
||||
}
|
||||
}
|
||||
|
||||
String indexedText;
|
||||
if (chunker.hasNext()) {
|
||||
Chunker.Chunk chunk = chunker.next();
|
||||
@ -225,13 +215,10 @@ class ExtractedText implements IndexedText { // ELTODO
|
||||
return Bundle.IndexedText_errorMessage_errorGettingText();
|
||||
}
|
||||
|
||||
cachedString = EscapeUtil.escapeHtml(indexedText).trim();
|
||||
StringBuilder sb = new StringBuilder(cachedString.length() + 20);
|
||||
sb.append("<pre>").append(cachedString).append("</pre>"); //NON-NLS
|
||||
cachedString = sb.toString();
|
||||
cachedChunk = currentPage;
|
||||
|
||||
return cachedString;
|
||||
indexedText = EscapeUtil.escapeHtml(indexedText).trim();
|
||||
StringBuilder sb = new StringBuilder(indexedText.length() + 20);
|
||||
sb.append("<pre>").append(indexedText).append("</pre>"); //NON-NLS
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Reader getTikaOrTextExtractor(TextExtractor extractor, AbstractFile aFile,
|
||||
|
@ -173,8 +173,7 @@ public class ExtractedTextViewer implements TextViewer {
|
||||
if (solrHasFullyIndexedContent(file.getId())) {
|
||||
rawContentText = new SolrIndexedText(file, file.getId());
|
||||
sources.add(rawContentText);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Solr does not have fully indexed content.
|
||||
// see if it's a file type for which we can extract text
|
||||
if (ableToExtractTextFromFile(file)) {
|
||||
@ -186,6 +185,7 @@ public class ExtractedTextViewer implements TextViewer {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the "raw" (not highlighted) text, if any, for any report
|
||||
@ -501,7 +501,7 @@ public class ExtractedTextViewer implements TextViewer {
|
||||
}
|
||||
|
||||
if (MimeTypes.OCTET_STREAM.equals(mimeType)) {
|
||||
return false;
|
||||
// ELTODO return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -40,9 +40,6 @@ class SolrIndexedText implements IndexedText {
|
||||
private final Content content;
|
||||
private final BlackboardArtifact blackboardArtifact;
|
||||
private final long objectId;
|
||||
//keep last content cached
|
||||
private String cachedString;
|
||||
private int cachedChunk;
|
||||
private static final Logger logger = Logger.getLogger(SolrIndexedText.class.getName());
|
||||
|
||||
/**
|
||||
@ -249,14 +246,6 @@ class SolrIndexedText implements IndexedText {
|
||||
}
|
||||
|
||||
int chunkId = currentPage;
|
||||
|
||||
//check if cached
|
||||
if (cachedString != null) {
|
||||
if (cachedChunk == chunkId) {
|
||||
return cachedString;
|
||||
}
|
||||
}
|
||||
|
||||
//not cached
|
||||
String indexedText = solrServer.getSolrContent(this.objectId, chunkId);
|
||||
if (indexedText == null) {
|
||||
@ -269,13 +258,10 @@ class SolrIndexedText implements IndexedText {
|
||||
return Bundle.IndexedText_warningMessage_noTextAvailable();
|
||||
}
|
||||
|
||||
cachedString = EscapeUtil.escapeHtml(indexedText).trim();
|
||||
StringBuilder sb = new StringBuilder(cachedString.length() + 20);
|
||||
sb.append("<pre>").append(cachedString).append("</pre>"); //NON-NLS
|
||||
cachedString = sb.toString();
|
||||
cachedChunk = chunkId;
|
||||
|
||||
return cachedString;
|
||||
indexedText = EscapeUtil.escapeHtml(indexedText).trim();
|
||||
StringBuilder sb = new StringBuilder(indexedText.length() + 20);
|
||||
sb.append("<pre>").append(indexedText).append("</pre>"); //NON-NLS
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user