diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourceVisual.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourceVisual.java index b4c15cc0e2..624c38383f 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourceVisual.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardChooseDataSourceVisual.java @@ -38,6 +38,7 @@ import javax.swing.event.DocumentEvent; import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; +import org.sleuthkit.autopsy.corecomponentinterfaces.WizardPathValidator; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -55,6 +56,8 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel { private Map datasourceProcessorsMap = new HashMap<>(); + List pathValidatorList = new ArrayList<>(); + List coreDSPTypes = new ArrayList<>(); /** @@ -75,6 +78,8 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel { typePanel.setLayout(new BorderLayout()); discoverDataSourceProcessors(); + + discoverWizardPathValidators(); // set up the DSP type combobox typeComboBox.removeAllItems(); @@ -128,6 +133,12 @@ final class AddImageWizardChooseDataSourceVisual extends JPanel { } } } + + private void discoverWizardPathValidators() { + for (WizardPathValidator pathValidator : Lookup.getDefault().lookupAll(WizardPathValidator.class)) { + pathValidatorList.add(pathValidator); + } + } private void dspSelectionChanged() { // update the current panel to selection diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/WizardPathValidator.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/WizardPathValidator.java new file mode 100644 index 0000000000..9cebb1411d --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/WizardPathValidator.java @@ -0,0 +1,52 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2014 Basis Technology Corp. + * Contact: carrier sleuthkit 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.corecomponentinterfaces; + +/* + * Defines an interface used by the Add DataSource wizard to validate path for selected + * case and/or data source. + * + * Different Autopsy implementations and modes may have its unique attributes and + * may need to be processed differently. + * + * The WizardPathValidator interface defines a uniform mechanism for the Autopsy UI + * to: + * - Validate path for selected case. + * - Validate path for selected data source. + */ +public interface WizardPathValidator { + + /** + * Validates case path. + * + * @param path Absolute path to case file. + * @return String Error message if path is invalid, empty string otherwise. + * + */ + String validateCasePath(String path); + + /** + * Validates data source path. + * + * @param path Absolute path to data source file. + * @return String Error message if path is invalid, empty string otherwise. + * + */ + String validateDataSourcePath(String path); +}