diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsOptionsPanelController.java index 2ee820433b..39daa7419f 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsOptionsPanelController.java @@ -1,21 +1,21 @@ /* -* Autopsy Forensic Browser -* -* Copyright 2011-2016 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. -*/ + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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.casemodule.services; import java.beans.PropertyChangeEvent; @@ -38,7 +38,7 @@ public final class TagsOptionsPanelController extends OptionsPanelController { private TagOptionsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - + /** * Component should load its data here. */ @@ -105,7 +105,7 @@ public final class TagsOptionsPanelController extends OptionsPanelController { public void removePropertyChangeListener(PropertyChangeListener l) { pcs.removePropertyChangeListener(l); } - + private TagOptionsPanel getPanel() { if (panel == null) { panel = new TagOptionsPanel(); @@ -117,7 +117,7 @@ public final class TagsOptionsPanelController extends OptionsPanelController { } return panel; } - + void changed() { if (!changed) { changed = true; diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index 20ce2db7e8..64cd419024 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -799,7 +799,8 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat * Set the selected node using a path to a previously selected node. * * @param previouslySelectedNodePath Path to a previously selected node. - * @param rootNodeName Name of the root node to match, may be null. + * @param rootNodeName Name of the root node to match, may be + * null. */ private void setSelectedNode(final String[] previouslySelectedNodePath, final String rootNodeName) { if (previouslySelectedNodePath == null) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index cbb98512d3..f3c9f520d2 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -432,7 +432,13 @@ public class IngestJobSettings { } /** - * @return the ENABLED_MODULES_KEY + * Get a set which contains all the names of enabled modules for the + * specified context. + * + * @param defaultSetting - The default list of module names. + * @param context -the execution context (profile name) to check + * + * @return the names of the enabled modules */ static HashSet getEnabledModules(String context, String defaultSetting) { return getModulesNamesFromSetting(context, ENABLED_MODULES_KEY, defaultSetting); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index ea9f5b52cf..0bb16b90f9 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -184,11 +184,11 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ pastJobsButton.setEnabled(!dataSources.isEmpty() && !ingestJobs.isEmpty()); } - - void setPastJobsButtonVisible(boolean isVisible){ + + void setPastJobsButtonVisible(boolean isVisible) { pastJobsButton.setVisible(isVisible); } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java index 0125e9b37a..42d94674e9 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java @@ -67,7 +67,7 @@ class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements Opti tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.text"), null, filterPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.toolTipText"), 0); tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.text"), null, - profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), 1); + profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), 1); tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.text"), null, settingsPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.toolTipText"), 2); //Listener for when tabbed panes are switched, because we can have two file filter definitions panels open at the same time @@ -84,7 +84,7 @@ class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements Opti } } }); - + addIngestJobEventsListener(); enableTabs(); } @@ -156,7 +156,7 @@ class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements Opti public void saveSettings() { //if a new filter was created in the profilePanel we don't want to save over it accidently if (profilePanel.shouldFiltersBeRefreshed()) { - filterPanel.load(); + filterPanel.load(); } filterPanel.store(); settingsPanel.store(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java index ec086ba9b4..b9c4ea9546 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanelController.java @@ -51,7 +51,7 @@ public class IngestOptionsPanelController extends OptionsPanelController { /** * Get the IngestOptionsPanel which is contained inside this controller. - * + * * @return panel */ private IngestOptionsPanel getPanel() { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index 329b38d124..2f62ac2633 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -22,8 +22,8 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Map; -import java.util.TreeMap; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.io.FileUtils; import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.ModuleSettings; @@ -38,7 +38,7 @@ public final class IngestProfiles { private static final String PROFILE_NAME_KEY = "Profile_Name"; private static final String PROFILE_DESC_KEY = "Profile_Description"; private static final String PROFILE_FILTER_KEY = "Profile_Filter"; - private Map profileMap = null; + private List profileList = null; private static final Object PROFILE_LOCK = new Object(); /** @@ -46,11 +46,11 @@ public final class IngestProfiles { * * @return profileList */ - public Map getIngestProfileMap() { - if (profileMap == null) { + public List getIngestProfiles() { + if (profileList == null) { loadProfileList(); } - return profileMap; + return profileList; } /** @@ -61,14 +61,14 @@ public final class IngestProfiles { File dir = Paths.get(PlatformUtil.getUserConfigDirectory(), PROFILE_FOLDER).toFile(); File[] directoryListing = dir.listFiles(); - profileMap = new TreeMap<>(); + profileList = new ArrayList<>(); if (directoryListing != null) { for (File child : directoryListing) { String name = child.getName().split("\\.")[0]; String context = PROFILE_FOLDER + File.separator + name; String desc = ModuleSettings.getConfigSetting(context, PROFILE_DESC_KEY); String fileIngestFilter = ModuleSettings.getConfigSetting(context, PROFILE_FILTER_KEY); - profileMap.put(name, new IngestProfile(name, desc, fileIngestFilter)); + profileList.add(new IngestProfile(name, desc, fileIngestFilter)); } } } @@ -86,7 +86,7 @@ public final class IngestProfiles { */ void saveProfileList() { //save last used profile - for (IngestProfile profile : getIngestProfileMap().values()) { + for (IngestProfile profile : getIngestProfiles()) { IngestProfile.saveProfile(profile); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index 4a393acfad..9e15f0bb47 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -386,9 +386,10 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op public void load() { int currentIndex = this.profileList.getSelectedIndex(); this.profilesListModel.clear(); - this.profiles = (TreeMap) new IngestProfiles().getIngestProfileMap(); - for (IngestProfile profile : this.profiles.values()) { + this.profiles = new TreeMap(); + for (IngestProfile profile : new IngestProfiles().getIngestProfiles()) { profilesListModel.addElement(profile); + profiles.put(profile.getName(), profile); } if (currentIndex < 0 || currentIndex >= profilesListModel.getSize()) { currentIndex = 0; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 4ba0b16553..6509f4f6c8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -1003,7 +1003,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed FilesSet selectedSet = this.setsList.getSelectedValue(); if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { - for (IngestProfile profile : new IngestProfiles().getIngestProfileMap().values()) { + for (IngestProfile profile : new IngestProfiles().getIngestProfiles()) { if (profile.getFileIngestFilter().equals(selectedSet.getName())) { MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.ingest.fileFilterInUseError", diff --git a/Core/src/org/sleuthkit/autopsy/report/testfixtures/CustomArtifactsCreatorIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/report/testfixtures/CustomArtifactsCreatorIngestModuleFactory.java index 766a3260dd..90bae4fc9e 100644 --- a/Core/src/org/sleuthkit/autopsy/report/testfixtures/CustomArtifactsCreatorIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/report/testfixtures/CustomArtifactsCreatorIngestModuleFactory.java @@ -18,10 +18,8 @@ */ package org.sleuthkit.autopsy.report.testfixtures; -import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.autopsy.ingest.FileIngestModule; -import org.sleuthkit.autopsy.ingest.IngestModuleFactory; import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; @@ -31,8 +29,8 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; * annotation to activate this test fixture. */ //@ServiceProvider(service = IngestModuleFactory.class) -public final class CustomArtifactsCreatorIngestModuleFactory extends IngestModuleFactoryAdapter { - +public final class CustomArtifactsCreatorIngestModuleFactory extends IngestModuleFactoryAdapter { + @Override public String getModuleDisplayName() { return getModuleName(); @@ -57,8 +55,8 @@ public final class CustomArtifactsCreatorIngestModuleFactory extends IngestModu public FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings settings) { return new CustomArtifactsCreatorIngestModule(); } - - static String getModuleName() { + + static String getModuleName() { return "Custom Artifacts Creator"; - } + } } diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java index 0377a704b8..8ba7e76a2e 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java @@ -114,7 +114,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { * @param inStartup True if we're doing the initial population of the UI */ final void load(boolean inStartup) { - + // multi user mode must be enabled if (!UserPreferences.getIsMultiUserModeEnabled()) { tbOops.setText(MULTI_USER_SETTINGS_MUST_BE_ENABLED); @@ -123,23 +123,25 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { } cbJoinAutoIngestCluster.setSelected(AutoIngestUserPreferences.getJoinAutoModeCluster()); cbJoinAutoIngestCluster.setEnabled(UserPreferences.getIsMultiUserModeEnabled()); - + if (inStartup) { AutoIngestUserPreferences.SelectedMode storedMode = AutoIngestUserPreferences.getMode(); inputPathTextField.requestFocusInWindow(); - if (null != storedMode) switch (storedMode) { - case REVIEW: - jRadioButtonReview.setSelected(true); - enableOptionsBasedOnMode(OptionsUiMode.REVIEW); - break; - case AUTOMATED: - jRadioButtonAutomated.setSelected(true); - enableOptionsBasedOnMode(OptionsUiMode.AIM); - break; - default: - cbJoinAutoIngestCluster.setSelected(false); - enableOptionsBasedOnMode(OptionsUiMode.STANDALONE); - break; + if (null != storedMode) { + switch (storedMode) { + case REVIEW: + jRadioButtonReview.setSelected(true); + enableOptionsBasedOnMode(OptionsUiMode.REVIEW); + break; + case AUTOMATED: + jRadioButtonAutomated.setSelected(true); + enableOptionsBasedOnMode(OptionsUiMode.AIM); + break; + default: + cbJoinAutoIngestCluster.setSelected(false); + enableOptionsBasedOnMode(OptionsUiMode.STANDALONE); + break; + } } } @@ -206,11 +208,11 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { void store() { boolean needsRestart = false; AutoIngestUserPreferences.SelectedMode storedMode = AutoIngestUserPreferences.getMode(); - + if (AutoIngestUserPreferences.getJoinAutoModeCluster() != cbJoinAutoIngestCluster.isSelected()) { needsRestart = true; } - + AutoIngestUserPreferences.setJoinAutoModeCluster(cbJoinAutoIngestCluster.isSelected()); if (!cbJoinAutoIngestCluster.isSelected()) { AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.STANDALONE); @@ -224,8 +226,8 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { }); } return; - } - + } + if (jRadioButtonAutomated.isSelected()) { if (storedMode != AutoIngestUserPreferences.SelectedMode.AUTOMATED) { needsRestart = true; @@ -261,7 +263,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.REVIEW); String resultsFolderPath = getNormalizedFolderPath(outputPathTextField.getText().trim()); - AutoIngestUserPreferences.setAutoModeResultsFolder(resultsFolderPath); + AutoIngestUserPreferences.setAutoModeResultsFolder(resultsFolderPath); } if (needsRestart) { SwingUtilities.invokeLater(() -> { @@ -303,11 +305,11 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { * Validate current panel settings. */ boolean valid() { - + if (!cbJoinAutoIngestCluster.isSelected()) { return true; } - + boolean isValidNodePanel = true; switch (getModeFromRadioButtons()) { @@ -333,13 +335,13 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { break; default: break; - } - + } + if (jRadioButtonAutomated.isSelected()) { if (sharedConfigCheckbox.isEnabled() && sharedConfigCheckbox.isSelected() && !validSharedConfigSettings()) { isValidNodePanel = false; } - } + } return isValidNodePanel; } @@ -593,10 +595,10 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { } private void enableOptionsBasedOnMode(OptionsUiMode mode) { - if (mode != OptionsUiMode.DOWNLOADING_CONFIGURATION) { + if (mode != OptionsUiMode.DOWNLOADING_CONFIGURATION) { jRadioButtonAutomated.setEnabled(cbJoinAutoIngestCluster.isSelected()); jRadioButtonReview.setEnabled(cbJoinAutoIngestCluster.isSelected()); - + jLabelSelectInputFolder.setEnabled(mode == OptionsUiMode.AIM); inputPathTextField.setEnabled(mode == OptionsUiMode.AIM); browseInputFolderButton.setEnabled(mode == OptionsUiMode.AIM); @@ -629,7 +631,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { if (!cbJoinAutoIngestCluster.isSelected()) { return OptionsUiMode.STANDALONE; } - + if (jRadioButtonAutomated.isSelected()) { return OptionsUiMode.AIM; } else if (jRadioButtonReview.isSelected()) { @@ -1269,9 +1271,9 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { private void bnAdvancedSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnAdvancedSettingsActionPerformed AdvancedAutoIngestSettingsPanel advancedAutoIngestSettingsPanel = new AdvancedAutoIngestSettingsPanel(getModeFromRadioButtons()); if (JOptionPane.showConfirmDialog(null, advancedAutoIngestSettingsPanel, - NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.AdvancedAutoIngestSettingsPanel.Title"), - JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { - advancedAutoIngestSettingsPanel.store(); + NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.AdvancedAutoIngestSettingsPanel.Title"), + JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { + advancedAutoIngestSettingsPanel.store(); } }//GEN-LAST:event_bnAdvancedSettingsActionPerformed