mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Public API fixes/removes for release 4.7.0
This commit is contained in:
parent
fef6c5f510
commit
bee4d28c14
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Sleuth Kit Data Model
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Copyright 2015-2018 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
|
||||
* 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,
|
||||
@ -65,7 +65,7 @@ public final class Blackboard implements Closeable {
|
||||
throw new BlackboardException("Keyword search service not found");
|
||||
}
|
||||
try {
|
||||
searchService.indexArtifact(artifact);
|
||||
searchService.index(artifact);
|
||||
} catch (TskCoreException ex) {
|
||||
throw new BlackboardException("Error indexing artifact", ex);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.corecomponentinterfaces;
|
||||
package org.sleuthkit.autopsy.contentviewers;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.List;
|
||||
@ -26,7 +26,7 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
* Defines an interface for application specific content viewer
|
||||
*
|
||||
*/
|
||||
public interface FileTypeViewer {
|
||||
interface FileTypeViewer {
|
||||
|
||||
/**
|
||||
* Returns list of MIME types supported by this viewer
|
||||
@ -45,6 +45,11 @@ public interface FileTypeViewer {
|
||||
|
||||
/**
|
||||
* Clears the data in the panel
|
||||
*
|
||||
* IMPORTANT IF MAKING THIS PUBLIC: I (RC) am not sure that this method
|
||||
* belongs in this interface. If we are not going to use setFile(null) as a
|
||||
* reset method as in DataContentViewer and DataResultViewer, then this is
|
||||
* fine. Otherwise, it is ambiguous.
|
||||
*/
|
||||
void resetComponent();
|
||||
}
|
@ -31,7 +31,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
||||
|
||||
/**
|
||||
* Generic Application content viewer
|
||||
|
@ -24,7 +24,6 @@ import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
|
@ -58,7 +58,6 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
||||
|
||||
/**
|
||||
* PListViewer - a file viewer for binary plist files.
|
||||
|
@ -50,7 +50,6 @@ import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.FileTypeViewer;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
|
||||
/**
|
||||
|
@ -197,6 +197,7 @@ public final class IngestServices {
|
||||
*
|
||||
* @deprecated Use getCase instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Case getCurrentCase() {
|
||||
return Case.getCurrentCase();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2018 Basis Technology Corp.
|
||||
* Copyright 2015-2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -68,63 +68,70 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
private static final Logger logger = Logger.getLogger(SolrSearchService.class.getName());
|
||||
|
||||
/**
|
||||
* Adds an artifact to the keyword search text index as a concantenation of
|
||||
* all of its attributes.
|
||||
* Indexes the given content for keyword search.
|
||||
*
|
||||
* @param artifact The artifact to index.
|
||||
* IMPORTANT: Currently, there are two correct uses for this code:
|
||||
*
|
||||
* 1) Indexing an artifact created during while either the file level ingest
|
||||
* module pipeline or the first stage data source level ingest module
|
||||
* pipeline of an ingest job is running.
|
||||
*
|
||||
* 2) Indexing a report.
|
||||
*
|
||||
* @throws org.sleuthkit.datamodel.TskCoreException
|
||||
*/
|
||||
@Override
|
||||
public void indexArtifact(BlackboardArtifact artifact) throws TskCoreException {
|
||||
if (artifact == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We only support artifact indexing for Autopsy versions that use
|
||||
// the negative range for artifact ids.
|
||||
if (artifact.getArtifactID() > 0) {
|
||||
return;
|
||||
}
|
||||
final Ingester ingester = Ingester.getDefault();
|
||||
|
||||
try {
|
||||
ingester.indexMetaDataOnly(artifact);
|
||||
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
||||
} catch (Ingester.IngesterException ex) {
|
||||
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given Content object to the text index.
|
||||
* @param content The content to index.
|
||||
* @throws TskCoreException
|
||||
*
|
||||
* @throws TskCoreException If there is a problem indexing the content.
|
||||
*/
|
||||
@Override
|
||||
public void index(Content content) throws TskCoreException {
|
||||
/*
|
||||
* TODO (JIRA-1099): The following code has some issues that need to be
|
||||
* resolved. For artifacts, it is assumed that the posting of artifacts
|
||||
* is only occuring during an ingest job with an enabled keyword search
|
||||
* ingest module handling index commits; it also assumes that the
|
||||
* artifacts are only posted by modules in the either the file level
|
||||
* ingest pipeline or the first stage data source level ingest pipeline,
|
||||
* so that the artifacts will be searched during a periodic or final
|
||||
* keyword search. It also assumes that the only other type of Content
|
||||
* for which this API will be called are Reports generated at a time
|
||||
* when doing a commit is required and desirable, i.e., in a context
|
||||
* other than an ingest job.
|
||||
*/
|
||||
if (content == null) {
|
||||
return;
|
||||
}
|
||||
final Ingester ingester = Ingester.getDefault();
|
||||
|
||||
try {
|
||||
ingester.indexText(new TikaTextExtractor(), content, null);
|
||||
} catch (Ingester.IngesterException ex) {
|
||||
if (content instanceof BlackboardArtifact) {
|
||||
BlackboardArtifact artifact = (BlackboardArtifact) content;
|
||||
if (artifact.getArtifactID() > 0) {
|
||||
/*
|
||||
* Artifact indexing is only supported for artifacts that use
|
||||
* negative artifact ids to avoid overlapping with the object
|
||||
* ids of other types of Content.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Try the StringsTextExtractor if Tika extractions fails.
|
||||
ingester.indexText(new StringsTextExtractor(), content, null);
|
||||
} catch (Ingester.IngesterException ex1) {
|
||||
throw new TskCoreException(ex.getCause().getMessage(), ex1);
|
||||
}
|
||||
ingester.indexMetaDataOnly(artifact);
|
||||
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
||||
} catch (Ingester.IngesterException ex) {
|
||||
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
ingester.indexText(new TikaTextExtractor(), content, null);
|
||||
} catch (Ingester.IngesterException ex) {
|
||||
try {
|
||||
// Try the StringsTextExtractor if Tika extractions fails.
|
||||
ingester.indexText(new StringsTextExtractor(), content, null);
|
||||
} catch (Ingester.IngesterException ex1) {
|
||||
throw new TskCoreException(ex.getCause().getMessage(), ex1);
|
||||
}
|
||||
}
|
||||
ingester.commit();
|
||||
}
|
||||
|
||||
// TODO: Review whether this is the right thing to do. We typically use
|
||||
// a combination of autoCommit and the SearchRunner to ensure that data
|
||||
// is committed but that might not be sufficient for reports (or artifacts).
|
||||
ingester.commit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to connect to the keyword search service.
|
||||
*
|
||||
@ -205,7 +212,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
*/
|
||||
KeywordSearch.getServer().deleteCore(index.getIndexName(), metadata);
|
||||
if (!FileUtil.deleteDir(new File(index.getIndexPath()).getParentFile())) {
|
||||
throw new KeywordSearchServiceException(Bundle.SolrSearchService_exceptionMessage_failedToDeleteIndexFiles(index.getIndexPath()));
|
||||
throw new KeywordSearchServiceException(Bundle.SolrSearchService_exceptionMessage_failedToDeleteIndexFiles(index.getIndexPath()));
|
||||
}
|
||||
}
|
||||
return; //only one core exists for each combination of solr and schema version
|
||||
@ -213,9 +220,9 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
|
||||
//this code this code will only execute if an index for the current core was not found
|
||||
logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class,
|
||||
"SolrSearchService.exceptionMessage.noCurrentSolrCore"));
|
||||
"SolrSearchService.exceptionMessage.noCurrentSolrCore"));
|
||||
throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class,
|
||||
"SolrSearchService.exceptionMessage.noCurrentSolrCore"));
|
||||
"SolrSearchService.exceptionMessage.noCurrentSolrCore"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,6 +238,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
* Creates/opens the Solr core/text index for a case
|
||||
*
|
||||
* @param context The case context.
|
||||
*
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||
*/
|
||||
@ -366,7 +374,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
} else {
|
||||
progress.switchToIndeterminate(Bundle.SolrSearch_openGiantCore_msg());
|
||||
}
|
||||
|
||||
|
||||
KeywordSearch.getServer().openCoreForCase(theCase, currentVersionIndex);
|
||||
} catch (KeywordSearchModuleException ex) {
|
||||
throw new AutopsyServiceException(String.format("Failed to open or create core for %s", caseDirPath), ex);
|
||||
@ -379,6 +387,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
* Closes the open core.
|
||||
*
|
||||
* @param context
|
||||
*
|
||||
* @throws
|
||||
* org.sleuthkit.autopsy.appservices.AutopsyService.AutopsyServiceException
|
||||
*/
|
||||
@ -403,4 +412,36 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
throw new AutopsyServiceException(String.format("Failed to close core for %s", context.getCase().getCaseDirectory()), ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an artifact to the keyword search text index as a concantenation of
|
||||
* all of its attributes.
|
||||
*
|
||||
* @param artifact The artifact to index.
|
||||
*
|
||||
* @throws org.sleuthkit.datamodel.TskCoreException
|
||||
* @deprecated Call index(Content) instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public void indexArtifact(BlackboardArtifact artifact) throws TskCoreException {
|
||||
if (artifact == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We only support artifact indexing for Autopsy versions that use
|
||||
// the negative range for artifact ids.
|
||||
if (artifact.getArtifactID() > 0) {
|
||||
return;
|
||||
}
|
||||
final Ingester ingester = Ingester.getDefault();
|
||||
|
||||
try {
|
||||
ingester.indexMetaDataOnly(artifact);
|
||||
ingester.indexText(new ArtifactTextExtractor(), artifact, null);
|
||||
} catch (Ingester.IngesterException ex) {
|
||||
throw new TskCoreException(ex.getCause().getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user