Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
XRYReportProcessor.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019-2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.datasourceprocessors.xry;
20 
21 import java.io.IOException;
22 import java.util.List;
23 import java.util.logging.Level;
25 import org.sleuthkit.datamodel.Blackboard.BlackboardException;
26 import org.sleuthkit.datamodel.Content;
27 import org.sleuthkit.datamodel.SleuthkitCase;
28 import org.sleuthkit.datamodel.TskCoreException;
29 
33 final class XRYReportProcessor {
34 
35  private static final Logger logger = Logger.getLogger(XRYReportProcessor.class.getName());
36 
48  static void process(XRYFolder folder, Content parent, SleuthkitCase currentCase) throws IOException, TskCoreException, BlackboardException {
49  //Get all XRY file readers from this folder.
50  List<XRYFileReader> xryFileReaders = folder.getXRYFileReaders();
51 
52  try {
53  for (XRYFileReader xryFileReader : xryFileReaders) {
54  String reportType = xryFileReader.getReportType();
55  if (XRYFileParserFactory.supports(reportType)) {
56  XRYFileParser parser = XRYFileParserFactory.get(reportType);
57  parser.parse(xryFileReader, parent, currentCase);
58  } else {
59  logger.log(Level.WARNING, String.format("[XRY DSP] XRY File (in brackets) "
60  + "[ %s ] was found, but no parser to support its report type exists. "
61  + "Report type is [ %s ]", xryFileReader.getReportPath().toString(), reportType));
62  }
63  }
64  } finally {
65  try {
66  //Try to close all resources
67  for (XRYFileReader xryFileReader : xryFileReaders) {
68  xryFileReader.close();
69  }
70  } catch (IOException ex) {
71  logger.log(Level.WARNING, "[XRY DSP] Encountered I/O exception trying "
72  + "to close all xry file readers.", ex);
73  }
74  }
75  }
76 
77  //Prevent direct instantiation.
78  private XRYReportProcessor() {
79 
80  }
81 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.