Autopsy  4.19.1
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 2014-2021 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;
34 
43  FileIngestTask(IngestJobPipeline ingestJobPipeline, AbstractFile file) {
44  super(ingestJobPipeline);
45  this.file = file;
46  fileId = file.getId();
47  }
48 
59  FileIngestTask(IngestJobPipeline ingestJobPipeline, long fileId) {
60  super(ingestJobPipeline);
61  this.fileId = fileId;
62  }
63 
69  long getFileId() {
70  return fileId;
71  }
72 
81  synchronized AbstractFile getFile() throws TskCoreException {
82  if (file == null) {
83  file = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(fileId);
84  }
85  return file;
86  }
87 
88  @Override
89  void execute(long threadId) {
90  super.setThreadId(threadId);
91  getIngestJobPipeline().execute(this);
92  }
93 
94  @Override
95  public boolean equals(Object obj) {
96  if (obj == null) {
97  return false;
98  }
99  if (getClass() != obj.getClass()) {
100  return false;
101  }
102  FileIngestTask other = (FileIngestTask) obj;
103  IngestJobPipeline thisPipeline = getIngestJobPipeline();
104  IngestJobPipeline otherPipeline = other.getIngestJobPipeline();
105  if (thisPipeline != otherPipeline && (thisPipeline == null || !thisPipeline.equals(otherPipeline))) {
106  return false;
107  }
108  return (this.fileId == other.fileId);
109  }
110 
111  @Override
112  public int hashCode() {
113  int hash = 5;
114  hash = 47 * hash + Objects.hashCode(getIngestJobPipeline());
115  hash = 47 * hash + Objects.hashCode(this.fileId);
116  return hash;
117  }
118 
119 }

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