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();
93 long startTime = System.currentTimeMillis();
95 addToTotals(jobId, (System.currentTimeMillis() - startTime));
97 }
catch (Exception e) {
98 logger.log(Level.WARNING, String.format(
"Error while attempting to determine file type of file %d", file.
getId()), e);
111 synchronized (
this) {
112 jobTotals = totalsForIngestJobs.remove(jobId);
114 if (jobTotals != null) {
115 StringBuilder detailsSb =
new StringBuilder();
116 detailsSb.append(
"<table border='0' cellpadding='4' width='280'>");
118 detailsSb.append(
"<tr><td>")
119 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalProcTime"))
120 .append(
"</td><td>").append(jobTotals.matchTime).append(
"</td></tr>\n");
121 detailsSb.append(
"<tr><td>")
122 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalFiles"))
123 .append(
"</td><td>").append(jobTotals.numFiles).append(
"</td></tr>\n");
124 detailsSb.append(
"</table>");
126 NbBundle.getMessage(this.getClass(),
127 "FileTypeIdIngestModule.complete.srvMsg.text"),
128 detailsSb.toString()));
140 private static synchronized void addToTotals(
long jobId,
long matchTimeInc) {
142 if (ingestJobTotals == null) {
144 totalsForIngestJobs.put(jobId, ingestJobTotals);
147 ingestJobTotals.matchTime += matchTimeInc;
148 ingestJobTotals.numFiles++;
149 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()