Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataSourceUpdateService.java
Go to the documentation of this file.
1 /*
2  * Central Repository
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.centralrepository.datamodel;
20 
21 import org.openide.util.NbBundle;
22 import org.openide.util.lookup.ServiceProvider;
24 import org.sleuthkit.datamodel.Content;
25 import org.sleuthkit.datamodel.DataSource;
26 import org.sleuthkit.datamodel.TskCoreException;
27 
33 @ServiceProvider(service = AutopsyService.class)
34 public class DataSourceUpdateService implements AutopsyService {
35 
36  @Override
37  @NbBundle.Messages({"DataSourceUpdateService.serviceName.text=Update Central Repository Data Sources"})
38  public String getServiceName() {
39  return Bundle.DataSourceUpdateService_serviceName_text();
40  }
41 
42  @Override
44  if (EamDb.isEnabled()) {
45  try {
46  EamDb centralRepository = EamDb.getInstance();
47  CorrelationCase correlationCase = centralRepository.getCase(context.getCase());
48  //if the case isn't in the central repository yet there won't be data sources in it to update
49  if (correlationCase != null) {
50  for (CorrelationDataSource correlationDataSource : centralRepository.getDataSources()) {
51  //ResultSet.getLong has a value of 0 when the value is null
52  if (correlationDataSource.getCaseID() == correlationCase.getID() && correlationDataSource.getDataSourceObjectID() == 0) {
53  for (Content dataSource : context.getCase().getDataSources()) {
54  if (((DataSource) dataSource).getDeviceId().equals(correlationDataSource.getDeviceID()) && dataSource.getName().equals(correlationDataSource.getName())) {
55  centralRepository.addDataSourceObjectId(correlationDataSource.getID(), dataSource.getId());
56  break;
57  }
58  }
59  }
60  }
61  }
62  } catch (EamDbException | TskCoreException ex) {
63  throw new AutopsyServiceException("Unabe to update datasources in central repository", ex);
64  }
65  }
66  }
67 
68 }
void addDataSourceObjectId(int rowId, long dataSourceObjectId)

Copyright © 2012-2018 Basis Technology. Generated on: Wed Sep 18 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.