Make Blackboard use SleuthkitCase field

This commit is contained in:
Richard Cordovano 2016-05-27 15:19:39 -04:00
parent 9095e927be
commit e6fad48c0a

View File

@ -56,7 +56,7 @@ public final class Blackboard implements Closeable {
*
* @throws BlackboardException If there is a problem indexing the artifact.
*/
public void indexArtifact(BlackboardArtifact artifact) throws BlackboardException {
public synchronized void indexArtifact(BlackboardArtifact artifact) throws BlackboardException {
if (null == caseDb) {
throw new BlackboardException("Blackboard has been closed");
}
@ -83,15 +83,15 @@ public final class Blackboard implements Closeable {
* @throws BlackboardBlackboardException If there is a problem getting or
* adding the artifact type.
*/
public BlackboardArtifact.Type getOrAddArtifactType(String typeName, String displayName) throws BlackboardException {
public synchronized BlackboardArtifact.Type getOrAddArtifactType(String typeName, String displayName) throws BlackboardException {
if (null == caseDb) {
throw new BlackboardException("Blackboard has been closed");
}
try {
return Case.getCurrentCase().getSleuthkitCase().addBlackboardArtifactType(typeName, displayName);
return caseDb.addBlackboardArtifactType(typeName, displayName);
} catch (TskDataException typeExistsEx) {
try {
return Case.getCurrentCase().getSleuthkitCase().getArtifactType(typeName);
return caseDb.getArtifactType(typeName);
} catch (TskCoreException ex) {
throw new BlackboardException("Failed to get or add artifact type", ex);
}
@ -113,15 +113,15 @@ public final class Blackboard implements Closeable {
* @throws BlackboardBlackboardException If there is a problem getting or
* adding the attribute type.
*/
public BlackboardAttribute.Type getOrAddAttributeType(String typeName, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, String displayName) throws BlackboardException {
public synchronized BlackboardAttribute.Type getOrAddAttributeType(String typeName, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, String displayName) throws BlackboardException {
if (null == caseDb) {
throw new BlackboardException("Blackboard has been closed");
}
try {
return Case.getCurrentCase().getSleuthkitCase().addArtifactAttributeType(typeName, valueType, displayName);
return caseDb.addArtifactAttributeType(typeName, valueType, displayName);
} catch (TskDataException typeExistsEx) {
try {
return Case.getCurrentCase().getSleuthkitCase().getAttributeType(typeName);
return caseDb.getAttributeType(typeName);
} catch (TskCoreException ex) {
throw new BlackboardException("Failed to get or add attribute type", ex);
}