Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
FileIngestTask.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012-2015 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.ingest;
20 
21 import java.util.Objects;
23 import org.sleuthkit.datamodel.AbstractFile;
24 import org.sleuthkit.datamodel.TskCoreException;
25 
30 final class FileIngestTask extends IngestTask {
31 
32  private final long fileId;
33  private AbstractFile file = null;
34 
35  FileIngestTask(IngestJobPipeline ingestJobPipeline, AbstractFile file) {
36  super(ingestJobPipeline);
37  this.file = file;
38  fileId = file.getId();
39  }
40 
41  FileIngestTask(IngestJobPipeline ingestJobPipeline, long fileId) {
42  super(ingestJobPipeline);
43  this.fileId = fileId;
44  }
45 
46  long getFileId() {
47  return fileId;
48  }
49 
50  synchronized AbstractFile getFile() throws TskCoreException {
51  if (file == null) {
52  file = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(fileId);
53  }
54  return file;
55  }
56 
57  @Override
58  void execute(long threadId) throws InterruptedException {
59  super.setThreadId(threadId);
60  getIngestJobPipeline().process(this);
61  }
62 
63  @Override
64  public boolean equals(Object obj) {
65  if (obj == null) {
66  return false;
67  }
68  if (getClass() != obj.getClass()) {
69  return false;
70  }
71  FileIngestTask other = (FileIngestTask) obj;
72  IngestJobPipeline thisPipeline = getIngestJobPipeline();
73  IngestJobPipeline otherPipeline = other.getIngestJobPipeline();
74  if (thisPipeline != otherPipeline && (thisPipeline == null || !thisPipeline.equals(otherPipeline))) {
75  return false;
76  }
77  return (this.fileId == other.fileId);
78  }
79 
80  @Override
81  public int hashCode() {
82  int hash = 5;
83  hash = 47 * hash + Objects.hashCode(getIngestJobPipeline());
84  hash = 47 * hash + Objects.hashCode(this.fileId);
85  return hash;
86  }
87 }

Copyright © 2012-2021 Basis Technology. Generated on: Tue Jan 19 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.