19 package org.sleuthkit.autopsy.modules.filetypeid;
21 import java.util.HashMap;
22 import java.util.logging.Level;
23 import org.openide.util.NbBundle;
38 "CannotRunFileTypeDetection=Unable to run file type detection."
44 private static final HashMap<Long, IngestJobTotals> totalsForIngestJobs =
new HashMap<>();
62 logger.log(Level.SEVERE,
"Failed to create file type detector", ex);
76 jobId = context.getJobId();
94 long startTime = System.currentTimeMillis();
96 addToTotals(jobId, (System.currentTimeMillis() - startTime));
98 }
catch (Exception e) {
99 logger.log(Level.WARNING, String.format(
"Error while attempting to determine file type of file %d", file.getId()), e);
112 synchronized (
this) {
113 jobTotals = totalsForIngestJobs.remove(jobId);
115 if (jobTotals != null) {
116 StringBuilder detailsSb =
new StringBuilder();
117 detailsSb.append(
"<table border='0' cellpadding='4' width='280'>");
119 detailsSb.append(
"<tr><td>")
120 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalProcTime"))
121 .append(
"</td><td>").append(jobTotals.matchTime).append(
"</td></tr>\n");
122 detailsSb.append(
"<tr><td>")
123 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalFiles"))
124 .append(
"</td><td>").append(jobTotals.numFiles).append(
"</td></tr>\n");
125 detailsSb.append(
"</table>");
127 NbBundle.getMessage(this.getClass(),
128 "FileTypeIdIngestModule.complete.srvMsg.text"),
129 detailsSb.toString()));
141 private static synchronized void addToTotals(
long jobId,
long matchTimeInc) {
143 if (ingestJobTotals == null) {
145 totalsForIngestJobs.put(jobId, ingestJobTotals);
148 ingestJobTotals.matchTime += matchTimeInc;
149 ingestJobTotals.numFiles++;
150 totalsForIngestJobs.put(jobId, ingestJobTotals);
synchronized long decrementAndGet(long jobId)
boolean isDetectable(String mimeType)
FileTypeDetector fileTypeDetector
synchronized long incrementAndGet(long jobId)
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
void startUp(IngestJobContext context)
ProcessResult process(AbstractFile file)
void postMessage(final IngestMessage message)
static boolean isMimeTypeDetectable(String mimeType)
synchronized static Logger getLogger(String name)
String getFileType(AbstractFile file)
static synchronized void addToTotals(long jobId, long matchTimeInc)
static synchronized IngestServices getInstance()