Autopsy  4.4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CorrelationDataSource.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2015-2017 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.centralrepository.datamodel;
20 
21 import java.io.Serializable;
23 import org.sleuthkit.datamodel.Content;
24 import org.sleuthkit.datamodel.TskCoreException;
25 import org.sleuthkit.datamodel.TskDataException;
26 
32 public class CorrelationDataSource implements Serializable {
33 
34  private static final long serialVersionUID = 1L;
35 
36  private final int dataSourceId; //< Id in the central repo
37  private final String deviceID; //< Unique to its associated case (not necessarily globally unique)
38  private final String name;
39 
40 
41  CorrelationDataSource(int dataSourceId,
42  String deviceID,
43  String name) {
44  this.dataSourceId = dataSourceId;
45  this.deviceID = deviceID;
46  this.name = name;
47  }
48 
56  public static CorrelationDataSource fromTSKDataSource(Content dataSource) throws EamDbException {
57  Case curCase;
58  try {
59  curCase = Case.getCurrentCase();
60  } catch (IllegalStateException ex) {
61  throw new EamDbException("Autopsy case is closed");
62  }
63  String deviceId;
64  try {
65  deviceId = curCase.getSleuthkitCase().getDataSource(dataSource.getId()).getDeviceId();
66  } catch (TskDataException | TskCoreException ex) {
67  throw new EamDbException("Error getting data source info: " + ex.getMessage());
68  }
69  return new CorrelationDataSource(-1, deviceId, dataSource.getName());
70  }
71 
72  @Override
73  public String toString() {
74  StringBuilder str = new StringBuilder();
75  str.append("(");
76  str.append("ID=").append(Integer.toString(getID()));
77  str.append(",deviceID=").append(getDeviceID());
78  str.append(",name=").append(getName());
79  str.append(")");
80  return str.toString();
81  }
82 
88  int getID() {
89  return dataSourceId;
90  }
91 
96  public String getDeviceID() {
97  return deviceID;
98  }
99 
103  public String getName() {
104  return name;
105  }
106 }

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