Autopsy  4.9.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordSearchModuleFactory.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.keywordsearch;
20 
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.HashSet;
24 import java.util.List;
25 import org.openide.util.NbBundle;
26 import org.openide.util.lookup.ServiceProvider;
34 
39 @ServiceProvider(service = IngestModuleFactory.class)
41 
42  private static final HashSet<String> defaultDisabledKeywordListNames = new HashSet<>(Arrays.asList("Phone Numbers", "IP Addresses", "URLs", "Credit Card Numbers")); //NON-NLS
43  private KeywordSearchJobSettingsPanel jobSettingsPanel = null;
44 
45  @Override
46  public String getModuleDisplayName() {
47  return getModuleName();
48  }
49 
50  static String getModuleName() {
51  return NbBundle.getMessage(KeywordSearchIngestModule.class, "KeywordSearchIngestModule.moduleName");
52  }
53 
54  @Override
55  public String getModuleDescription() {
56  return NbBundle.getMessage(KeywordSearchIngestModule.class, "KeywordSearchIngestModule.moduleDescription");
57  }
58 
59  @Override
60  public String getModuleVersionNumber() {
61  return Version.getVersion();
62  }
63 
64  @Override
66  XmlKeywordSearchList listManager = XmlKeywordSearchList.getCurrent();
67  List<String> enabledKeywordLists = new ArrayList<>();
68  List<KeywordList> keywordLists = listManager.getListsL();
69  for (KeywordList keywordList : keywordLists) {
70  if (!defaultDisabledKeywordListNames.contains(keywordList.getName())) {
71  enabledKeywordLists.add(keywordList.getName());
72  }
73  }
74  return new KeywordSearchJobSettings(enabledKeywordLists);
75  }
76 
77  @Override
78  public boolean hasIngestJobSettingsPanel() {
79  return true;
80  }
81 
82  @Override
84  assert settings instanceof KeywordSearchJobSettings;
85  if (!(settings instanceof KeywordSearchJobSettings)) {
86  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
87  "KeywordSearchModuleFactory.getIngestJobSettingsPanel.exception.msg"));
88  }
89 
90  if (jobSettingsPanel == null) {
91  jobSettingsPanel = new KeywordSearchJobSettingsPanel((KeywordSearchJobSettings) settings);
92  } else {
93  jobSettingsPanel.reset((KeywordSearchJobSettings) settings);
94  }
95  return jobSettingsPanel;
96  }
97 
98  @Override
99  public boolean hasGlobalSettingsPanel() {
100  return true;
101  }
102 
103  @Override
105  KeywordSearchGlobalSettingsPanel globalSettingsPanel = new KeywordSearchGlobalSettingsPanel();
106  globalSettingsPanel.load();
107  return globalSettingsPanel;
108  }
109 
110  @Override
111  public boolean isFileIngestModuleFactory() {
112  return true;
113  }
114 
115  @Override
117  assert settings instanceof KeywordSearchJobSettings;
118  if (!(settings instanceof KeywordSearchJobSettings)) {
119  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
120  "KeywordSearchModuleFactory.createFileIngestModule.exception.msg"));
121  }
122  return new KeywordSearchIngestModule((KeywordSearchJobSettings) settings);
123  }
124 }
FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings settings)
IngestModuleIngestJobSettingsPanel getIngestJobSettingsPanel(IngestModuleIngestJobSettings settings)

Copyright © 2012-2018 Basis Technology. Generated on: Tue Dec 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.