Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
Blackboard.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2011-2015 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.casemodule.services;
20 
21 import java.io.Closeable;
22 import java.io.IOException;
23 import org.openide.util.Lookup;
24 import org.openide.util.NbBundle;
27 import org.sleuthkit.datamodel.BlackboardArtifact;
28 import org.sleuthkit.datamodel.BlackboardAttribute;
29 import org.sleuthkit.datamodel.TskCoreException;
30 import org.sleuthkit.datamodel.TskDataException;
31 
35 public final class Blackboard implements Closeable {
36 
45  public void indexArtifact(BlackboardArtifact artifact) throws BlackboardException {
46  KeywordSearchService searchService = Lookup.getDefault().lookup(KeywordSearchService.class);
47  if (null == searchService) {
48  throw new BlackboardException(NbBundle.getMessage(this.getClass(), "Blackboard.keywordSearchNotFound.exception.msg"));
49  }
50 
51  try {
52  searchService.indexArtifact(artifact);
53  } catch (TskCoreException ex) {
54  throw new BlackboardException(NbBundle.getMessage(this.getClass(), "Blackboard.unableToIndexArtifact.exception.msg"), ex);
55  }
56  }
57 
67  public BlackboardArtifact.Type addArtifactType(String typeName, String displayName) throws BlackboardException {
68  try {
69  return Case.getCurrentCase().getSleuthkitCase().addBlackboardArtifactType(typeName, displayName);
70  } catch (TskCoreException | TskDataException ex) {
71  throw new BlackboardException("New artifact type could not be added", ex);
72  }
73  }
74 
84  public BlackboardAttribute.Type addAttributeType(String attrTypeString, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, String displayName) throws BlackboardException {
85  try {
86  return Case.getCurrentCase().getSleuthkitCase().addArtifactAttributeType(attrTypeString, valueType, displayName);
87  } catch (TskDataException ex) {
88  throw new BlackboardException("New attribute type could not be added", ex);
89  } catch (TskCoreException ex) {
90  throw new BlackboardException("New attribute type could not be added", ex);
91  }
92  }
93 
94  @Override
95  public void close() throws IOException {
96  }
97 
101  public static final class BlackboardException extends Exception {
102 
103  private static final long serialVersionUID = 1L;
104 
109  super();
110  }
111 
117  public BlackboardException(String message) {
118  super(message);
119  }
120 
127  public BlackboardException(String message, Throwable cause) {
128  super(message, cause);
129  }
130  }
131 }
void indexArtifact(BlackboardArtifact artifact)
Definition: Blackboard.java:45
BlackboardAttribute.Type addAttributeType(String attrTypeString, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, String displayName)
Definition: Blackboard.java:84
BlackboardArtifact.Type addArtifactType(String typeName, String displayName)
Definition: Blackboard.java:67

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