Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordListsManager.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.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.Observable;
26 
30 // TODO (RC): This class is a first step towards a fully functional and public
31 // keyword list manager, establishing the beginning of a public API. It is
32 // motivated by a desire to not expose XmlKeywordSearchList to public clients.
33 // It should be futher developed as time constraints and needs dictate.
34 public class KeywordListsManager extends Observable {
35 
36  private static KeywordListsManager instance;
37  private final PropertyChangeListener listsChangeListener;
38 
42  private KeywordListsManager() {
43  this.listsChangeListener = new PropertyChangeListener() {
44  @Override
45  public void propertyChange(PropertyChangeEvent evt) {
46  KeywordListsManager.this.setChanged();
47  KeywordListsManager.this.notifyObservers();
48  }
49  };
50  XmlKeywordSearchList.getCurrent().addPropertyChangeListener(this.listsChangeListener);
51  }
52 
56  public static synchronized KeywordListsManager getInstance() {
57  if (instance == null) {
58  instance = new KeywordListsManager();
59  }
60  return instance;
61  }
62 
68  public List<String> getKeywordListNames() {
69  List<String> names = new ArrayList<>();
70  for (KeywordList list : XmlKeywordSearchList.getCurrent().getListsL()) {
71  names.add(list.getName());
72  }
73  return names;
74  }
75 
79  public static void reloadKeywordLists(){
80  XmlKeywordSearchList.getCurrent().reload();
81  }
82 
83 }
static synchronized KeywordListsManager getInstance()

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.