Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
BlackboardPostEvent.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 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.ingest.events;
20 
21 import java.io.Serializable;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.Collections;
25 import java.util.logging.Level;
26 import java.util.stream.Collectors;
27 import javax.annotation.concurrent.Immutable;
35 
40 public final class BlackboardPostEvent extends AutopsyEvent implements Serializable {
41 
42  private static final long serialVersionUID = 1L;
43  private static final Logger logger = Logger.getLogger(BlackboardPostEvent.class.getName());
44  private transient ModuleDataEvent eventData;
45 
61  super(
63  new SerializableEventData(eventData.getModuleName(), eventData.getBlackboardArtifactType(), eventData.getArtifacts() != null
64  ? eventData.getArtifacts()
65  .stream()
67  .collect(Collectors.toList()) : Collections.emptyList()),
68  null
69  );
70  this.eventData = eventData;
71  }
72 
78  @Override
79  public Object getOldValue() {
89  if (null != eventData) {
90  return eventData;
91  }
92  try {
93  SerializableEventData data = (SerializableEventData) super.getOldValue();
94  Collection<BlackboardArtifact> artifacts = new ArrayList<>();
95  for (Long id : data.artifactIds) {
97  }
98  eventData = new ModuleDataEvent(data.moduleName, data.artifactTypeId, !artifacts.isEmpty() ? artifacts : null);
99  return eventData;
100  } catch (IllegalStateException | TskCoreException ex) {
101  logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS
102  return null;
103  }
104  }
105 
109  @Immutable
110  private static final class SerializableEventData implements Serializable {
111 
112  private static final long serialVersionUID = 1L;
113  private final String moduleName;
115  private Collection<Long> artifactIds;
116 
117  private SerializableEventData(String moduleName, BlackboardArtifact.Type artifactTypeId, Collection<Long> artifactIds) {
118  this.moduleName = moduleName;
120  this.artifactIds = new ArrayList<>(artifactIds);
121  }
122 
123  }
124 
125 }
Collection< BlackboardArtifact > getArtifacts()
static final long serialVersionUID
BlackboardArtifact.Type artifactTypeId
BlackboardArtifact getBlackboardArtifact(long artifactID)
transient ModuleDataEvent eventData
Object getOldValue()
final String moduleName
synchronized static Logger getLogger(String name)
Definition: Logger.java:161
SerializableEventData(String moduleName, BlackboardArtifact.Type artifactTypeId, Collection< Long > artifactIds)
Collection< Long > artifactIds
static final Logger logger
BlackboardPostEvent(ModuleDataEvent eventData)

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.