19 package org.sleuthkit.autopsy.modules.filetypeid;
21 import java.util.HashMap;
22 import java.util.logging.Level;
23 import org.openide.util.NbBundle;
60 logger.log(Level.SEVERE,
"Failed to create file type detector", ex);
80 jobId = context.getJobId();
85 throw new IngestModuleException(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.startUp.fileTypeDetectorInitializationException.msg"));
108 long startTime = System.currentTimeMillis();
110 addToTotals(jobId, (System.currentTimeMillis() - startTime));
112 }
catch (Exception e) {
113 logger.log(Level.WARNING, String.format(
"Error while attempting to determine file type of file %d", file.
getId()), e);
129 synchronized (
this) {
130 jobTotals = totalsForIngestJobs.remove(jobId);
132 if (jobTotals != null) {
133 StringBuilder detailsSb =
new StringBuilder();
134 detailsSb.append(
"<table border='0' cellpadding='4' width='280'>");
136 detailsSb.append(
"<tr><td>")
137 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalProcTime"))
138 .append(
"</td><td>").append(jobTotals.matchTime).append(
"</td></tr>\n");
139 detailsSb.append(
"<tr><td>")
140 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalFiles"))
141 .append(
"</td><td>").append(jobTotals.numFiles).append(
"</td></tr>\n");
142 detailsSb.append(
"</table>");
144 NbBundle.getMessage(this.getClass(),
145 "FileTypeIdIngestModule.complete.srvMsg.text"),
146 detailsSb.toString()));
158 private static synchronized void addToTotals(
long jobId,
long matchTimeInc) {
160 if (ingestJobTotals == null) {
162 totalsForIngestJobs.put(jobId, ingestJobTotals);
165 ingestJobTotals.matchTime += matchTimeInc;
166 ingestJobTotals.numFiles++;
167 totalsForIngestJobs.put(jobId, ingestJobTotals);
synchronized long decrementAndGet(long jobId)
boolean isDetectable(String mimeType)
FileTypeDetector fileTypeDetector
static final HashMap< Long, IngestJobTotals > totalsForIngestJobs
synchronized long incrementAndGet(long jobId)
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
void startUp(IngestJobContext context)
static final IngestModuleReferenceCounter refCounter
TskData.FileKnown getKnown()
ProcessResult process(AbstractFile file)
void postMessage(final IngestMessage message)
static boolean isMimeTypeDetectable(String mimeType)
static final Logger logger
final FileTypeIdModuleSettings settings
String getFileType(AbstractFile file)
static synchronized void addToTotals(long jobId, long matchTimeInc)
static Logger getLogger(String name)
static synchronized IngestServices getInstance()