/*
 * Autopsy Forensic Browser
 *
 * Copyright 2014 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
 *
 * 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.keywordsearch;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;

/**
 * A manager for keyword lists.
 */
// TODO (RC): This class is a first step towards a fully functional and public
// keyword list manager, establishing the beginning of a public API. It is
// motivated by a desire to not expose XmlKeywordSearchList to public clients.
// It should be futher developed as time constraints and needs dictate.
public class KeywordListsManager extends Observable {
    
    private static KeywordListsManager instance;
    private final PropertyChangeListener listsChangeListener;

    /**
     * Constructs a keyword lists manager.
     */
    private KeywordListsManager() {
        this.listsChangeListener = new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                KeywordListsManager.this.setChanged();
                KeywordListsManager.this.notifyObservers();
            }
        };
        XmlKeywordSearchList.getCurrent().addPropertyChangeListener(this.listsChangeListener);
    }

    /**
     * Gets the singleton instance of the keyword lists manager.
     */
    public static synchronized KeywordListsManager getInstance() {
        if (instance == null) {
            instance = new KeywordListsManager();
        }
        return instance;
    }

    /**
     * Gets the configured keyword lists.
     *
     * @return A collection of keyword list objects.
     */
    public List<KeywordList> getKeywordLists() {
        return new ArrayList<>(XmlKeywordSearchList.getCurrent().getListsL());
    }
    
}

@@ -2186,16 +2186,29 @@
 ets the 
+names of the 
 configur
@@ -2251,43 +2251,23 @@
 urn 
-A collection of keyword list object
+The name string
 s.%0A 
@@ -2289,27 +2289,22 @@
 ic List%3C
-KeywordList
+String
 %3E getKey
@@ -2329,77 +2329,198 @@
     
-return new ArrayList%3C%3E(XmlKeywordSearchList.getCurrent().getListsL())
+List%3CString%3E names = new ArrayList%3C%3E();%0A        for (KeywordList list : XmlKeywordSearchList.getCurrent().getListsL()) %7B%0A            names.add(list.getName());%0A        %7D%0A        return names
 ;%0A  

Rework initial API of new keyword lists manager class