/*
 * 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.hashdatabase;

import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.coreutils.Version;
import org.sleuthkit.autopsy.ingest.AbstractIngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;

/**
 * An factory that creates file ingest modules that do hash database lookups.
 */
@ServiceProvider(service=IngestModuleFactory.class)
public class HashLookupModuleFactory extends AbstractIngestModuleFactory {
    private final static String MODULE_NAME = "Hash Lookup";
    private final static String MODULE_DESCRIPTION = "Identifies known and notables files using supplied hash databases, such as a standard NSRL database.";
    
    @Override
    public String getModuleDisplayName() {
        return MODULE_NAME;
    }
    
    @Override
    public String getModuleDescription() {
        return MODULE_DESCRIPTION;        
    }
    
    @Override
    public String getModuleVersionNumber() {
        return Version.getVersion();        
    }
}

@@ -721,16 +721,134 @@
 abase;%0A%0A
+import java.io.Serializable;%0Aimport java.util.ArrayList;%0Aimport javax.swing.JPanel;%0Aimport org.openide.util.NbBundle;%0A
 import o
@@ -1000,16 +1000,70 @@
 actory;%0A
+import org.sleuthkit.autopsy.ingest.FileIngestModule;%0A
 import o
@@ -1328,232 +1328,1727 @@
 ry %7B
-%0A    private final static String MODULE_NAME = %22Hash Lookup%22;%0A    private final static String MODULE_DESCRIPTION = %22Identifies known and notables files using supplied hash databases, such as a standard NSRL database.%22;%0A
+ %0A    @Override%0A    public String getModuleDisplayName() %7B%0A        return NbBundle.getMessage(HashDbIngestModule.class, %22HashDbIngestModule.moduleName%22);%0A    %7D%0A    %0A    @Override%0A    public String getModuleDescription() %7B%0A        return NbBundle.getMessage(HashDbIngestModule.class, %22HashDbIngestModule.moduleDescription%22);        %0A    %7D%0A    %0A    @Override%0A    public String getModuleVersionNumber() %7B%0A        return Version.getVersion();        %0A    %7D%0A    %0A    @Override%0A    public Serializable getDefaultIngestOptions() %7B%0A        return new IngestOptions();        %0A    %7D%0A    %0A    @Override%0A    public boolean providesIngestOptionsPanels() %7B%0A        return true;%0A    %7D%0A    %0A    @Override%0A    public JPanel getIngestOptionsPanel(Serializable ingestOptions) %7B%0A        HashDbSimpleConfigPanel ingestOptionsPanel = new HashDbSimpleConfigPanel();  %0A        ingestOptionsPanel.load();%0A        return ingestOptionsPanel;                %0A    %7D%0A    %0A    @Override%0A    public Serializable getIngestOptionsFromPanel(JPanel ingestOptionsPanel) throws InvalidOptionsException %7B%0A        if (!(ingestOptionsPanel instanceof HashDbSimpleConfigPanel)) %7B%0A            throw new InvalidOptionsException(%22%22); // RJCTODO%0A        %7D%0A%0A        HashDbSimpleConfigPanel panel = (HashDbSimpleConfigPanel)ingestOptionsPanel;%0A        panel.store();%0A                %0A        return new IngestOptions(); // RJCTODO%0A    %7D%0A    %0A    @Override%0A    public boolean providesGlobalOptionsPanels() %7B%0A        return true;    %0A    %7D%0A    %0A    @Override%0A    public JPanel getGlobalOptionsPanel() %7B%0A        HashDbConfigPanel globalOptionsPanel = new HashDbConfigPanel();        %0A        globalOptionsPanel.load();%0A        return globalOptionsPanel;%0A    %7D
     %0A
+    %0A
     
@@ -3072,36 +3072,162 @@
 lic 
-String getModuleDisplayName(
+void saveGlobalOptionsFromPanel(JPanel globalOptionsPanel) throws InvalidOptionsException %7B%0A        if (!(globalOptionsPanel instanceof HashDbConfigPanel)
 ) %7B%0A
@@ -3238,26 +3238,175 @@
     
+   
-return MODULE_NAME
+ throw new InvalidOptionsException(%22%22); // RJCTODO%0A        %7D%0A        %0A        HashDbConfigPanel panel = (HashDbConfigPanel)globalOptionsPanel;%0A        panel.store()
 ;%0A  
@@ -3443,35 +3443,41 @@
 lic 
-String 
+boolean isFileIn
 ge
+s
 tModule
-Description
+Factory
 () %7B
@@ -3496,27 +3496,17 @@
 urn 
-MODULE_DESCRIPTION;
+true;    
     
@@ -3550,86 +3550,317 @@
 lic 
-String getModuleVersionNumber() %7B%0A        return Version.getVersion();        
+FileIngestModule createFileIngestModule(Serializable ingestOptions) throws InvalidOptionsException %7B%0A        return null; // RJCTODO%0A    %7D%0A    %0A    private static class IngestOptions implements Serializable %7B%0A        boolean alwaysCalcHashes = true;%0A        ArrayList%3CString%3E hashSetNames = new ArrayList%3C%3E();
 %0A   

Complete method stubs for HashLookupModuleFactory