Sleuth Kit Java Bindings (JNI)  4.6.0
Java bindings for using The Sleuth Kit
IngestJobInfo.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2011-2016 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.datamodel;
20 
21 import java.util.Date;
22 import java.util.List;
23 import java.util.ResourceBundle;
24 
28 public final class IngestJobInfo {
29 
30  private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle");
31 
32  public enum IngestJobStatusType {
33 
34  //DO NOT CHANGE ORDER
35  STARTED(bundle.getString("IngestJobInfo.IngestJobStatusType.Started.displayName")),
36  CANCELLED(bundle.getString("IngestJobInfo.IngestJobStatusType.Cancelled.displayName")),
37  COMPLETED(bundle.getString("IngestJobInfo.IngestJobStatusType.Completed.displayName"));
38 
39  private String displayName;
40 
41  private IngestJobStatusType(String displayName) {
42  this.displayName = displayName;
43  }
44 
45  public static IngestJobStatusType fromID(int typeId) {
46  for (IngestJobStatusType statusType : IngestJobStatusType.values()) {
47  if (statusType.ordinal() == typeId) {
48  return statusType;
49  }
50  }
51  return null;
52  }
53 
57  public String getDisplayName() {
58  return displayName;
59  }
60  }
61 
62  private final long ingestJobId;
63  private final long objectId;
64  private final String hostName;
65  private final Date startDateTime;
66  private Date endDateTime = new Date(0);
67  private final String settingsDir;
68  private final List<IngestModuleInfo> ingestModuleInfo;
69  private final SleuthkitCase skCase;
70  private IngestJobStatusType status;
71 
83  IngestJobInfo(long ingestJobId, long objectId, String hostName, Date startDateTime, String settingsDir, List<IngestModuleInfo> ingestModuleInfo, SleuthkitCase skCase) {
84  this.ingestJobId = ingestJobId;
85  this.objectId = objectId;
86  this.hostName = hostName;
87  this.startDateTime = startDateTime;
88  this.settingsDir = settingsDir;
89  this.skCase = skCase;
90  this.ingestModuleInfo = ingestModuleInfo;
91  this.status = IngestJobStatusType.STARTED;
92  }
93 
107  IngestJobInfo(long ingestJobId, long dataSourceId, String hostName, Date startDateTime, Date endDateTime, IngestJobStatusType status, String settingsDir, List<IngestModuleInfo> ingestModuleInfo, SleuthkitCase skCase) {
108  this.ingestJobId = ingestJobId;
109  this.objectId = dataSourceId;
110  this.hostName = hostName;
111  this.startDateTime = startDateTime;
112  this.endDateTime = endDateTime;
113  this.settingsDir = settingsDir;
114  this.skCase = skCase;
115  this.ingestModuleInfo = ingestModuleInfo;
116  this.status = status;
117  }
118 
123  public Date getEndDateTime() {
124  return endDateTime;
125  }
126 
134  public void setEndDateTime(Date endDateTime) throws TskCoreException {
135  Date oldDate = this.endDateTime;
136  this.endDateTime = endDateTime;
137  try {
138  skCase.setIngestJobEndDateTime(getIngestJobId(), endDateTime.getTime());
139  } catch (TskCoreException ex) {
140  this.endDateTime = oldDate;
141  throw ex;
142  }
143  }
144 
153  IngestJobStatusType oldStatus = this.getStatus();
154  this.status = status;
155  try {
156  skCase.setIngestJobStatus(getIngestJobId(), status);
157  } catch (TskCoreException ex) {
158  this.status = oldStatus;
159  throw ex;
160  }
161  }
162 
166  public long getIngestJobId() {
167  return ingestJobId;
168  }
169 
173  public long getObjectId() {
174  return objectId;
175  }
176 
180  public String getHostName() {
181  return hostName;
182  }
183 
187  public Date getStartDateTime() {
188  return startDateTime;
189  }
190 
194  public String getSettingsDir() {
195  return settingsDir;
196  }
197 
201  public List<IngestModuleInfo> getIngestModuleInfo() {
202  return ingestModuleInfo;
203  }
204 
209  return status;
210  }
211 }
List< IngestModuleInfo > getIngestModuleInfo()
static IngestJobStatusType fromID(int typeId)
void setIngestJobStatus(IngestJobStatusType status)

Copyright © 2011-2018 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.