mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-18 10:37:43 +00:00
Ingest service dummy examples
This commit is contained in:
parent
dd2a3e83ec
commit
a91376c3e7
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* 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 java.util.logging.Logger;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestMessage;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestServiceAbstract.ServiceType;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestServiceFsContent;
|
||||||
|
import org.sleuthkit.datamodel.FsContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example implementation of a fscontent image ingest service
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExampleFsContentIngestService implements IngestServiceFsContent {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(ExampleFsContentIngestService.class.getName());
|
||||||
|
private static ExampleFsContentIngestService instance = null;
|
||||||
|
private IngestManager manager;
|
||||||
|
private static int messageId = 0;
|
||||||
|
|
||||||
|
public static synchronized ExampleFsContentIngestService getDefault() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new ExampleFsContentIngestService();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(FsContent fsContent) {
|
||||||
|
manager.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Processing " + fsContent.getName()));
|
||||||
|
|
||||||
|
//service specific FsContent processing code here
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void complete() {
|
||||||
|
logger.log(Level.INFO, "complete()");
|
||||||
|
manager.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "COMPLETE"));
|
||||||
|
|
||||||
|
//service specific cleanup due completion here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Example FsContent Service";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(IngestManager manager) {
|
||||||
|
logger.log(Level.INFO, "init()");
|
||||||
|
this.manager = manager;
|
||||||
|
|
||||||
|
//service specific initialization here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
logger.log(Level.INFO, "stop()");
|
||||||
|
|
||||||
|
//service specific cleanup due interruption here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceType getType() {
|
||||||
|
return ServiceType.FsContent;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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 java.util.logging.Logger;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestMessage;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestServiceImage;
|
||||||
|
import org.sleuthkit.datamodel.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example implementation of an image ingest service
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class ExampleImageIngestService implements IngestServiceImage {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(ExampleImageIngestService.class.getName());
|
||||||
|
private static ExampleImageIngestService instance = null;
|
||||||
|
private IngestManager manager;
|
||||||
|
|
||||||
|
private static int messageId = 0;
|
||||||
|
|
||||||
|
public static synchronized ExampleImageIngestService getDefault() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new ExampleImageIngestService();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(Image image) {
|
||||||
|
manager.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Processing " + image.getName()));
|
||||||
|
|
||||||
|
//service specific Image processing code here
|
||||||
|
try {
|
||||||
|
Thread.sleep(5000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void complete() {
|
||||||
|
logger.log(Level.INFO, "complete()");
|
||||||
|
manager.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "COMPLETE"));
|
||||||
|
|
||||||
|
//service specific cleanup due completion here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Example Image Service";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(IngestManager manager) {
|
||||||
|
logger.log(Level.INFO, "init()");
|
||||||
|
this.manager = manager;
|
||||||
|
|
||||||
|
//service specific initialization here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
logger.log(Level.INFO, "stop()");
|
||||||
|
|
||||||
|
//service specific cleanup due interruption here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceType getType() {
|
||||||
|
return ServiceType.Image;
|
||||||
|
}
|
||||||
|
}
|
@ -7,5 +7,18 @@
|
|||||||
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.ingest.IngestTopComponent.getDefault"/>
|
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.ingest.IngestTopComponent.getDefault"/>
|
||||||
<attr name="position" intvalue="300"/>
|
<attr name="position" intvalue="300"/>
|
||||||
</file>
|
</file>
|
||||||
|
<!-- example services -->
|
||||||
|
<!--
|
||||||
|
<file name="org-sleuthkit-autopsy-ingest-example-ExampleImageIngestService.instance">
|
||||||
|
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.ingest.IngestServiceImage"/>
|
||||||
|
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.ingest.example.ExampleImageIngestService.getDefault"/>
|
||||||
|
<attr name="position" intvalue="1000"/>
|
||||||
|
</file>
|
||||||
|
<file name="org-sleuthkit-autopsy-ingest-example-ExampleFsContentIngestService.instance">
|
||||||
|
<attr name="instanceOf" stringvalue="org.sleuthkit.autopsy.ingest.IngestServiceFsContent"/>
|
||||||
|
<attr name="instanceCreate" methodvalue="org.sleuthkit.autopsy.ingest.example.ExampleFsContentIngestService.getDefault"/>
|
||||||
|
<attr name="position" intvalue="1100"/>
|
||||||
|
</file>
|
||||||
|
-->
|
||||||
</folder>
|
</folder>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user