19 package org.sleuthkit.autopsy.modules.filetypeid;
21 import java.util.HashMap;
22 import java.util.logging.Level;
23 import org.openide.util.NbBundle;
59 logger.log(Level.SEVERE,
"Failed to create file type detector", ex);
76 jobId = context.getJobId();
81 throw new IngestModuleException(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.startUp.fileTypeDetectorInitializationException.msg"), ex);
97 long startTime = System.currentTimeMillis();
99 addToTotals(jobId, (System.currentTimeMillis() - startTime));
101 }
catch (Exception e) {
102 logger.log(Level.WARNING, String.format(
"Error while attempting to determine file type of file %d", file.getId()), e);
118 synchronized (
this) {
119 jobTotals = totalsForIngestJobs.remove(jobId);
121 if (jobTotals != null) {
122 StringBuilder detailsSb =
new StringBuilder();
123 detailsSb.append(
"<table border='0' cellpadding='4' width='280'>");
125 detailsSb.append(
"<tr><td>")
126 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalProcTime"))
127 .append(
"</td><td>").append(jobTotals.matchTime).append(
"</td></tr>\n");
128 detailsSb.append(
"<tr><td>")
129 .append(NbBundle.getMessage(
this.getClass(),
"FileTypeIdIngestModule.complete.totalFiles"))
130 .append(
"</td><td>").append(jobTotals.numFiles).append(
"</td></tr>\n");
131 detailsSb.append(
"</table>");
133 NbBundle.getMessage(this.getClass(),
134 "FileTypeIdIngestModule.complete.srvMsg.text"),
135 detailsSb.toString()));
147 private static synchronized void addToTotals(
long jobId,
long matchTimeInc) {
149 if (ingestJobTotals == null) {
151 totalsForIngestJobs.put(jobId, ingestJobTotals);
154 ingestJobTotals.matchTime += matchTimeInc;
155 ingestJobTotals.numFiles++;
156 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
ProcessResult process(AbstractFile file)
void postMessage(final IngestMessage message)
static boolean isMimeTypeDetectable(String mimeType)
static final Logger logger
synchronized static Logger getLogger(String name)
String getFileType(AbstractFile file)
static synchronized void addToTotals(long jobId, long matchTimeInc)
static synchronized IngestServices getInstance()