Sleuth Kit Java Bindings (JNI)  4.11.0
Java bindings for using The Sleuth Kit
TskEvent.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2020-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.datamodel;
20 
21 import com.google.common.collect.ImmutableSet;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.Optional;
26 
30 public interface TskEvent {
31 
39  default Optional<Long> getDataSourceId() {
40  return Optional.ofNullable(null);
41  }
42 
50  abstract static class TskObjectsEvent<T> implements TskEvent {
51 
52  private final List<T> dataModelObjects;
53 
61  TskObjectsEvent(List<T> dataModelObjects) {
62  this.dataModelObjects = new ArrayList<>();
63  this.dataModelObjects.addAll(dataModelObjects);
64  }
65 
71  List<T> getDataModelObjects() {
72  return Collections.unmodifiableList(dataModelObjects);
73  }
74 
75  }
76 
81  public final static class AggregateScoresChangedEvent extends TskObjectsEvent<ScoreChange> {
82 
83  private final Long dataSourceObjectId;
84 
91  AggregateScoresChangedEvent(Long dataSourceObjectId, ImmutableSet<ScoreChange> scoreChanges) {
92  super(scoreChanges.asList());
93  this.dataSourceObjectId = dataSourceObjectId;
94  scoreChanges.stream().forEach(chg -> {
95  if (!chg.getDataSourceObjectId().equals(dataSourceObjectId)) {
96  throw new IllegalArgumentException("All data source object IDs in List<ScoreChange> must match dataSourceObjectId");
97  }
98  });
99  }
100 
101  @Override
102  public Optional<Long> getDataSourceId() {
103  return Optional.ofNullable(dataSourceObjectId);
104  }
105 
111  public List<ScoreChange> getScoreChanges() {
112  return getDataModelObjects();
113  }
114 
115  }
116 
120  public final static class AnalysisResultsDeletedTskEvent extends TskObjectsEvent<Long> {
121 
129  AnalysisResultsDeletedTskEvent(List<Long> deletedResultObjIds) {
130  super(deletedResultObjIds);
131  }
132 
138  public List<Long> getAnalysisResultObjectIds() {
139  return getDataModelObjects();
140  }
141 
142  }
143 
147  abstract static class HostsTskEvent extends TskObjectsEvent<Host> {
148 
154  HostsTskEvent(List<Host> hosts) {
155  super(hosts);
156  }
157 
163  public List<Host> getHosts() {
164  return getDataModelObjects();
165  }
166 
167  }
168 
172  public final static class HostsAddedTskEvent extends HostsTskEvent {
173 
179  HostsAddedTskEvent(List<Host> hosts) {
180  super(hosts);
181  }
182 
183  }
184 
188  public final static class HostsUpdatedTskEvent extends HostsTskEvent {
189 
195  HostsUpdatedTskEvent(List<Host> hosts) {
196  super(hosts);
197  }
198 
199  }
200 
204  public final static class HostsDeletedTskEvent extends TskObjectsEvent<Long> {
205 
211  HostsDeletedTskEvent(List<Long> hostIds) {
212  super(hostIds);
213  }
214 
220  public List<Long> getHostIds() {
221  return getDataModelObjects();
222  }
223 
224  }
225 
229  abstract static class OsAccountsTskEvent extends TskObjectsEvent<OsAccount> {
230 
236  OsAccountsTskEvent(List<OsAccount> osAccounts) {
237  super(osAccounts);
238  }
239 
245  public List<OsAccount> getOsAcounts() {
246  return getDataModelObjects();
247  }
248 
249  }
250 
254  public final static class OsAccountsAddedTskEvent extends OsAccountsTskEvent {
255 
261  OsAccountsAddedTskEvent(List<OsAccount> osAccounts) {
262  super(osAccounts);
263  }
264 
265  }
266 
270  public final static class OsAccountsUpdatedTskEvent extends OsAccountsTskEvent {
271 
277  OsAccountsUpdatedTskEvent(List<OsAccount> osAccounts) {
278  super(osAccounts);
279  }
280 
281  }
282 
286  public final static class OsAccountsDeletedTskEvent extends TskObjectsEvent<Long> {
287 
294  OsAccountsDeletedTskEvent(List<Long> accountObjectIds) {
295  super(accountObjectIds);
296  }
297 
303  public List<Long> getOsAccountObjectIds() {
304  return getDataModelObjects();
305  }
306 
307  }
308 
312  public final static class OsAcctInstancesAddedTskEvent extends TskObjectsEvent<OsAccountInstance> {
313 
321  OsAcctInstancesAddedTskEvent(List<OsAccountInstance> osAcctInstances) {
322  super(osAcctInstances);
323  }
324 
330  public List<OsAccountInstance> getOsAccountInstances() {
331  return getDataModelObjects();
332  }
333 
334  }
335 
339  static abstract class PersonsTskEvent extends TskObjectsEvent<Person> {
340 
346  PersonsTskEvent(List<Person> persons) {
347  super(persons);
348  }
349 
355  public List<Person> getPersons() {
356  return getDataModelObjects();
357  }
358 
359  }
360 
364  public final static class PersonsAddedTskEvent extends PersonsTskEvent {
365 
371  PersonsAddedTskEvent(List<Person> persons) {
372  super(persons);
373  }
374 
375  }
376 
380  public final static class PersonsUpdatedTskEvent extends PersonsTskEvent {
381 
387  PersonsUpdatedTskEvent(List<Person> persons) {
388  super(persons);
389  }
390 
391  }
392 
396  public final static class PersonsDeletedTskEvent extends TskObjectsEvent<Long> {
397 
403  PersonsDeletedTskEvent(List<Long> personObjectIDs) {
404  super(personObjectIDs);
405  }
406 
412  public List<Long> getPersonIds() {
413  return getDataModelObjects();
414  }
415 
416  }
417 
421  public final static class HostsAddedToPersonTskEvent extends TskObjectsEvent<Host> {
422 
423  private final Person person;
424 
432  HostsAddedToPersonTskEvent(Person person, List<Host> hosts) {
433  super(hosts);
434  this.person = person;
435  }
436 
442  public Person getPerson() {
443  return person;
444  }
445 
451  public List<Host> getHosts() {
452  return getDataModelObjects();
453  }
454 
455  }
456 
460  public final static class HostsRemovedFromPersonTskEvent extends TskObjectsEvent<Long> {
461 
462  private final Person person;
463 
471  HostsRemovedFromPersonTskEvent(Person person, List<Long> hostIds) {
472  super(hostIds);
473  this.person = person;
474  }
475 
481  public Person getPerson() {
482  return person;
483  }
484 
490  public List<Long> getHostIds() {
491  return getDataModelObjects();
492  }
493 
494  }
495 
496  static abstract class TagNamesTskEvent extends TskObjectsEvent<TagName> {
497 
498  public TagNamesTskEvent(List<TagName> tagNames) {
499  super(tagNames);
500  }
501 
507  public List<TagName> getTagNames() {
508  return getDataModelObjects();
509  }
510 
511  }
512 
516  public final static class TagNamesAddedTskEvent extends TagNamesTskEvent {
517 
523  public TagNamesAddedTskEvent(List<TagName> tagNames) {
524  super(tagNames);
525  }
526  }
527 
531  public final static class TagNamesUpdatedTskEvent extends TagNamesTskEvent {
532 
538  public TagNamesUpdatedTskEvent(List<TagName> tagNames) {
539  super(tagNames);
540  }
541  }
542 
546  public final static class TagNamesDeletedTskEvent extends TskObjectsEvent<Long> {
547 
553  public TagNamesDeletedTskEvent(List<Long> tagNameIds) {
554  super(tagNameIds);
555  }
556 
562  public List<Long> getTagNameIds() {
563  return getDataModelObjects();
564  }
565 
566  }
567 
571  public final static class TagSetsAddedTskEvent extends TskObjectsEvent<TagSet> {
572 
578  public TagSetsAddedTskEvent(List<TagSet> tagSets) {
579  super(tagSets);
580  }
581 
587  public List<TagSet> getTagSets() {
588  return getDataModelObjects();
589  }
590  }
591 
595  public final static class TagSetsDeletedTskEvent extends TskObjectsEvent<Long> {
596 
602  public TagSetsDeletedTskEvent(List<Long> tagSetIds) {
603  super(tagSetIds);
604  }
605 
611  public List<Long> getTagSetIds() {
612  return getDataModelObjects();
613  }
614  }
615 }
default Optional< Long > getDataSourceId()
Definition: TskEvent.java:39

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