removed old sample ingest code that no longer compiled

This commit is contained in:
Brian Carrier 2013-09-05 15:38:59 -04:00
parent dd37c18aa8
commit d3870da587
2 changed files with 0 additions and 340 deletions

View File

@ -1,157 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 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.ingest.example;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.ModuleType;
import org.sleuthkit.autopsy.ingest.IngestModuleAbstractFile;
import org.sleuthkit.autopsy.ingest.IngestModuleInit;
import org.sleuthkit.datamodel.AbstractFile;
/**
* Example implementation of a file ingest module
*
*/
public class ExampleAbstractFileIngestModule implements IngestModuleAbstractFile {
private static final Logger logger = Logger.getLogger(ExampleAbstractFileIngestModule.class.getName());
private static ExampleAbstractFileIngestModule instance = null;
private IngestServices services;
private static int messageId = 0;
public static final String MODULE_NAME = "Example AbstractFile Module";
public static final String MODULE_DESC = "Example AbstractFile Module description";
public static final String MODULE_VERSION = "1.0";
private String args;
//file ingest modules require a private constructor
//to ensure singleton instances
private ExampleAbstractFileIngestModule() {
}
public static synchronized ExampleAbstractFileIngestModule getDefault() {
if (instance == null) {
instance = new ExampleAbstractFileIngestModule();
}
return instance;
}
@Override
public ProcessResult process(AbstractFile fsContent) {
services.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Processing " + fsContent.getName()));
//module specific AbstractFile processing code here
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
return ProcessResult.OK;
}
@Override
public void complete() {
logger.log(Level.INFO, "complete()");
services.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Complete"));
//module specific cleanup due completion here
}
@Override
public String getName() {
return MODULE_NAME;
}
@Override
public String getDescription() {
return MODULE_DESC;
}
@Override
public String getVersion() {
return MODULE_VERSION;
}
@Override
public String getArguments() {
return args;
}
@Override
public void setArguments(String args) {
this.args = args;
}
@Override
public void init(IngestModuleInit initContext) {
logger.log(Level.INFO, "init()");
services = IngestServices.getDefault();
//module specific initialization here
}
@Override
public void stop() {
logger.log(Level.INFO, "stop()");
services.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Stopped"));
//module specific cleanup due interruption here
}
@Override
public ModuleType getType() {
return ModuleType.AbstractFile;
}
@Override
public boolean hasSimpleConfiguration() {
return false;
}
@Override
public boolean hasAdvancedConfiguration() {
return false;
}
@Override
public javax.swing.JPanel getSimpleConfiguration() {
return null;
}
@Override
public javax.swing.JPanel getAdvancedConfiguration() {
return null;
}
@Override
public boolean hasBackgroundJobsRunning() {
return false;
}
@Override
public void saveAdvancedConfiguration() {
}
@Override
public void saveSimpleConfiguration() {
}
}

View File

@ -1,183 +0,0 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011 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.ingest.example;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestImageWorkerController;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
import org.sleuthkit.autopsy.ingest.IngestModuleImage;
import org.sleuthkit.autopsy.ingest.IngestModuleInit;
import org.sleuthkit.datamodel.Image;
/**
* Example implementation of an image ingest service
*
*/
public final class ExampleImageIngestModule implements IngestModuleImage {
private static final Logger logger = Logger.getLogger(ExampleImageIngestModule.class.getName());
private static ExampleImageIngestModule defaultInstance = null;
private IngestServices services;
private static int messageId = 0;
public static final String MODULE_NAME = "Example Image Module";
public static final String MODULE_DESC = "Example Image Module description";
public static final String MODULE_VERSION = "1.0";
private String args;
//public constructor is required
//as multiple instances are created for processing multiple images simultenously
public ExampleImageIngestModule() {
}
//default instance used for service registration
public static synchronized ExampleImageIngestModule getDefault() {
if (defaultInstance == null) {
defaultInstance = new ExampleImageIngestModule();
}
return defaultInstance;
}
@Override
public void process(Image image, IngestImageWorkerController controller) {
logger.log(Level.INFO, "process() " + this.toString());
services.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Processing " + image.getName()));
//service specific Image processing code here
//example:
//if we know amount of work units, we can switch to determinate and update progress bar
int filesToProcess = 100;
controller.switchToDeterminate(filesToProcess);
int processedFiles = 0;
while (filesToProcess-- > 0) {
//check if should terminate on every loop iteration
if (controller.isCancelled()) {
return;
}
try {
//do the work
Thread.sleep(500);
//post message to user if found something interesting
services.postMessage(IngestMessage.createMessage(processedFiles, MessageType.INFO, this, "Processed " + image.getName() + ": " + Integer.toString(processedFiles)));
//update progress
controller.progress(++processedFiles);
} catch (InterruptedException e) {
}
}
}
@Override
public void complete() {
logger.log(Level.INFO, "complete() " + this.toString());
final IngestMessage msg = IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Complete");
services.postMessage(msg);
//service specific cleanup due to completion here
}
@Override
public String getName() {
return MODULE_NAME;
}
@Override
public String getDescription() {
return MODULE_DESC;
}
@Override
public String getVersion() {
return MODULE_VERSION;
}
@Override
public String getArguments() {
return args;
}
@Override
public void setArguments(String args) {
this.args = args;
}
@Override
public void init(IngestModuleInit initContext) {
logger.log(Level.INFO, "init() " + this.toString());
services = IngestServices.getDefault();
//service specific initialization here
}
@Override
public void stop() {
logger.log(Level.INFO, "stop()");
services.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Stopped"));
//service specific cleanup due to interruption here
}
@Override
public ModuleType getType() {
return ModuleType.Image;
}
@Override
public boolean hasSimpleConfiguration() {
return false;
}
@Override
public boolean hasAdvancedConfiguration() {
return false;
}
@Override
public javax.swing.JPanel getSimpleConfiguration() {
return null;
}
@Override
public javax.swing.JPanel getAdvancedConfiguration() {
return null;
}
@Override
public boolean hasBackgroundJobsRunning() {
return false;
}
@Override
public void saveAdvancedConfiguration() {
}
@Override
public void saveSimpleConfiguration() {
}
}