Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TimeLineModule.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2018 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.timeline;
20 
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.logging.Level;
24 import javafx.application.Platform;
25 import javax.swing.SwingUtilities;
32 import org.sleuthkit.datamodel.TskCoreException;
33 
38 public class TimeLineModule {
39 
40  private static final Logger logger = Logger.getLogger(TimeLineModule.class.getName());
41 
42  private static final Object controllerLock = new Object();
43  private static volatile TimeLineController controller;
44 
48  private TimeLineModule() {
49  }
50 
61  public static TimeLineController getController() throws NoCurrentCaseException, TskCoreException {
62  synchronized (controllerLock) {
63  if (controller == null) {
64  controller = new TimeLineController(Case.getCurrentCaseThrows());
65  }
66  return controller;
67  }
68  }
69 
74  static void onStart() {
75  Platform.setImplicitExit(false);
76  logger.info("Setting up TimeLine listeners"); //NON-NLS
77 
78  IngestManager.getInstance().addIngestModuleEventListener(new IngestModuleEventListener());
79  Case.addPropertyChangeListener(new CaseEventListener());
80  }
81 
85  static private class CaseEventListener implements PropertyChangeListener {
86 
87  @Override
88  public void propertyChange(PropertyChangeEvent evt) {
89  if (Case.Events.valueOf(evt.getPropertyName()).equals(CURRENT_CASE)) {
90  if (evt.getNewValue() == null) {
91  /*
92  * Current case is closing, shut down the timeline top
93  * component and set the pre case singleton controller
94  * reference to null.
95  */
96  synchronized (controllerLock) {
97  if (controller != null) {
98  controller.shutDownTimeLineListeners();
99  SwingUtilities.invokeLater(controller::shutDownTimeLineGui);
100  }
101  controller = null;
102  }
103  }
104  } else {
105  try {
106  getController().handleCaseEvent(evt);
107  } catch (NoCurrentCaseException ignored) {
108  } catch (TskCoreException ex) {
109  logger.log(Level.SEVERE, "Error handling application event", ex);
110  }
111  }
112  }
113  }
114 
118  static private class IngestModuleEventListener implements PropertyChangeListener {
119 
120  @Override
121  public void propertyChange(PropertyChangeEvent evt) {
122  try {
123  getController().handleIngestModuleEvent(evt);
124  } catch (NoCurrentCaseException ex) {
125  // ignore
126  return;
127  } catch (TskCoreException ex) {
128  MessageNotifyUtil.Message.error("Error creating timeline controller.");
129  logger.log(Level.SEVERE, "Error creating timeline controller", ex);
130  }
131  }
132  }
133 }
static synchronized IngestManager getInstance()
static volatile TimeLineController controller
static void addPropertyChangeListener(PropertyChangeListener listener)
Definition: Case.java:454
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.