mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
Changed code to conform to design changes
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Sleuth Kit Data Model
|
||||
*
|
||||
* Copyright 2011-2015 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.casemodule.services;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Provides utility methods for blackboard artifact indexing.
|
||||
*/
|
||||
public final class Blackboard implements Closeable {
|
||||
|
||||
Blackboard() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Index the text associated with the given artifact.
|
||||
*
|
||||
* @param artifact The artifact to be indexed.
|
||||
*
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.casemodule.services.Blackboard.BlackboardException
|
||||
*/
|
||||
public static void indexArtifact(BlackboardArtifact artifact) throws BlackboardException {
|
||||
KeywordSearchService searchService = Lookup.getDefault().lookup(KeywordSearchService.class);
|
||||
if (null != searchService) {
|
||||
throw new BlackboardException("Keyword search service not found");
|
||||
}
|
||||
|
||||
try {
|
||||
searchService.indexArtifact(artifact);
|
||||
} catch (TskCoreException ex) {
|
||||
throw new BlackboardException("Unable to index blackboard artifact", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a system exception for the Keyword Search package.
|
||||
*/
|
||||
public static final class BlackboardException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception with null as its message.
|
||||
*/
|
||||
public BlackboardException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified message.
|
||||
*
|
||||
* @param message The message.
|
||||
*/
|
||||
public BlackboardException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified message and cause.
|
||||
*
|
||||
* @param message The message.
|
||||
* @param cause The cause.
|
||||
*/
|
||||
public BlackboardException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* @deprecated Use org.sleuthkit.datamodel.KeywordSearchService instead.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public interface KeywordSearchService extends Closeable {
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,8 +37,8 @@ import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleReferenceCounter;
|
||||
import org.sleuthkit.autopsy.ingest.IngestServices;
|
||||
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
|
||||
import org.sleuthkit.datamodel.KeywordSearchService;
|
||||
import org.sleuthkit.datamodel.KeywordSearchServiceException;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
|
||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.KeywordSearchService;
|
||||
import org.sleuthkit.datamodel.KeywordSearchServiceException;
|
||||
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
|
||||
import org.apache.solr.common.util.ContentStreamBase.StringStream;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@@ -37,6 +37,7 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.openide.util.NbBundle;
|
||||
import java.net.InetAddress;
|
||||
import java.util.MissingResourceException;
|
||||
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
|
||||
|
||||
/**
|
||||
* An implementation of the KeywordSearchService interface that uses Solr for
|
||||
@@ -175,7 +176,7 @@ public class SolrSearchService implements KeywordSearchService {
|
||||
*
|
||||
* @param host the remote hostname or IP address of the Solr server
|
||||
* @param port the remote port for Solr
|
||||
* @throws org.sleuthkit.datamodel.KeywordSearchServiceException
|
||||
* @throws org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@@ -222,15 +223,4 @@ public class SolrSearchService implements KeywordSearchService {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not keyword search is enabled for the current job.
|
||||
*
|
||||
* @return True is keyword search is enabled for the current job, false
|
||||
* otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user