Autopsy  4.13.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();
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  try {
90  getController().handleCaseEvent(evt);
91  } catch (NoCurrentCaseException ex) {
92  // ignore
93  return;
94  } catch (TskCoreException ex) {
95  MessageNotifyUtil.Message.error("Error creating timeline controller.");
96  logger.log(Level.SEVERE, "Error creating timeline controller", ex);
97  }
98 
99  if (Case.Events.valueOf(evt.getPropertyName()).equals(CURRENT_CASE)) {
100  // we care only about case closing here
101  if (evt.getNewValue() == null) {
102  synchronized (controllerLock) {
103  if (controller != null) {
104  SwingUtilities.invokeLater(controller::shutDownTimeLine);
105  }
106  controller = null;
107  }
108  }
109  }
110  }
111  }
112 
116  static private class IngestModuleEventListener implements PropertyChangeListener {
117 
118  @Override
119  public void propertyChange(PropertyChangeEvent evt) {
120  try {
121  getController().handleIngestModuleEvent(evt);
122  } catch (NoCurrentCaseException ex) {
123  // ignore
124  return;
125  } catch (TskCoreException ex) {
126  MessageNotifyUtil.Message.error("Error creating timeline controller.");
127  logger.log(Level.SEVERE, "Error creating timeline controller", ex);
128  }
129  }
130  }
131 }
static synchronized IngestManager getInstance()
static void addPropertyChangeListener(PropertyChangeListener listener)
Definition: Case.java:449
void addIngestModuleEventListener(final PropertyChangeListener listener)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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