7553 data model event changes

This commit is contained in:
Richard Cordovano 2021-05-04 14:05:49 -04:00
parent 856eced424
commit bb2e65a770
28 changed files with 588 additions and 293 deletions

View File

@ -432,7 +432,7 @@ public class Case {
* OSAccount associated with the current case added. Call getOsAccount
* to get the added account;
*/
OS_ACCOUNT_ADDED,
OS_ACCOUNTS_ADDED,
/**
* OSAccount associated with the current case has changed. Call
* getOsAccount to get the changed account;
@ -441,7 +441,7 @@ public class Case {
/**
* OSAccount associated with the current case has been deleted.
*/
OS_ACCOUNT_REMOVED,
OS_ACCOUNTS_DELETED,
/**
* Hosts associated with the current case added.
*/
@ -449,7 +449,7 @@ public class Case {
/**
* Hosts associated with the current case has changed.
*/
HOSTS_CHANGED,
HOSTS_UPDATED,
/**
* Hosts associated with the current case has been deleted.
*/
@ -461,11 +461,20 @@ public class Case {
/**
* Persons associated with the current case has changed.
*/
PERSONS_CHANGED,
PERSONS_UPDATED,
/**
* Persons associated with the current case has been deleted.
*/
PERSONS_DELETED;
PERSONS_DELETED,
/**
* Hosts have been added to a person.
*/
HOSTS_ADDED_TO_PERSON,
/**
* Hosts have been removed from a person.
*/
HOSTS_REMOVED_FROM_PERSON;
};
/**
@ -511,7 +520,7 @@ public class Case {
@Subscribe
public void publishOsAccountsDeletedEvent(TskEvent.OsAccountsDeletedTskEvent event) {
eventPublisher.publish(new OsAccountsDeletedEvent(event.getObjectIds()));
eventPublisher.publish(new OsAccountsDeletedEvent(event.getOsAccountObjectIds()));
}
/**
@ -544,7 +553,7 @@ public class Case {
*/
@Subscribe
public void publishHostsDeletedEvent(TskEvent.HostsDeletedTskEvent event) {
eventPublisher.publish(new HostsDeletedEvent(event.getObjectIds()));
eventPublisher.publish(new HostsDeletedEvent(event.getHostIds()));
}
/**
@ -577,7 +586,7 @@ public class Case {
*/
@Subscribe
public void publishPersonsDeletedEvent(TskEvent.PersonsDeletedTskEvent event) {
eventPublisher.publish(new PersonsDeletedEvent(event.getObjectIds()));
eventPublisher.publish(new PersonsDeletedEvent(event.getPersonIds()));
}
}

View File

@ -23,17 +23,21 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Host;
/**
* Event fired when new hosts are added.
* An application event published when hosts have been added to the Sleuth Kit
* data model for a case.
*/
public class HostsAddedEvent extends HostsEvent {
public final class HostsAddedEvent extends HostsEvent {
private static final long serialVersionUID = 1L;
/**
* Main constructor.
* @param dataModelObjects The hosts that have been added.
* Constructs an application event published when hosts have been added to
* the Sleuth Kit data model for a case.
*
* @param persons The hosts that have been added.
*/
public HostsAddedEvent(List<Host> dataModelObjects) {
super(Case.Events.HOSTS_ADDED.name(), dataModelObjects);
public HostsAddedEvent(List<Host> hosts) {
super(Case.Events.HOSTS_ADDED.name(), hosts);
}
}

View File

@ -0,0 +1,39 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2021 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.casemodule.events;
import java.util.Collections;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Host;
import org.sleuthkit.datamodel.Person;
/**
*
* @author rcordovano
*/
public final class HostsAddedToPersonEvent extends PersonHostsEvent {
private static final long serialVersionUID = 1L;
HostsAddedToPersonEvent(Person person, List<Host> hosts) {
super(Case.Events.HOSTS_ADDED_TO_PERSON.toString(), person, hosts);
}
}

View File

@ -18,34 +18,34 @@
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.util.Collections;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Host;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Event fired when hosts are deleted.
* Application events published when hosts have been deleted from the Sleuth
* Kit data model for a case.
*/
public class HostsDeletedEvent extends TskDataModelChangedEvent<Host> {
public final class HostsDeletedEvent extends TskDataModelObjectsDeletedEvent {
private static final long serialVersionUID = 1L;
/**
* Main constructor.
* Constructs an application event published when hosts have been deleted
* from the Sleuth Kit data model for a case.
*
* @param dataModelObjectIds The unique numeric IDs (TSK object IDs, case
* database row IDs, etc.) of the Hosts that have
* been deleted.
* @param hostIds The host IDs of the deleted hosts.
*/
public HostsDeletedEvent(List<Long> dataModelObjectIds) {
super(Case.Events.HOSTS_DELETED.name(), dataModelObjectIds);
public HostsDeletedEvent(List<Long> hostIds) {
super(Case.Events.HOSTS_DELETED.name(), hostIds);
}
@Override
protected List<Host> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
return Collections.emptyList();
/**
* Gets the host IDs of the hosts that have been deleted.
*
* @return The host IDs.
*/
public List<Long> getHostIds() {
return getOldValue();
}
}

View File

@ -22,44 +22,48 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.sleuthkit.datamodel.Host;
import org.sleuthkit.datamodel.HostManager;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Base event class for when something pertaining to hosts changes.
* A base class for application events published when hosts in the Sleuth Kit
* data model for a case have been added or updated.
*/
public class HostsEvent extends TskDataModelChangedEvent<Host> {
public class HostsEvent extends TskDataModelChangedEvent<Host, Host> {
private static final long serialVersionUID = 1L;
/**
* Main constructor.
* Constructs the base class part of an application event published when
* hosts in the Sleuth Kit data model for a case have been added or updated.
*
* @param eventName The name of the Case.Events enum value for the event
* type.
* @param dataModelObjects The list of hosts for the event.
* type.
* @param hosts The hosts.
*/
protected HostsEvent(String eventName, List<Host> dataModelObjects) {
super(eventName, dataModelObjects, Host::getHostId);
protected HostsEvent(String eventName, List<Host> hosts) {
super(eventName, null, null, hosts, Host::getHostId);
}
/**
* Gets the hosts that have been added or updated.
*
* @return The hosts.
*/
public List<Host> getHosts() {
return getNewValue();
}
@Override
protected List<Host> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
HostManager hostManager = caseDb.getHostManager();
List<Host> toRet = new ArrayList<>();
if (ids != null) {
for (Long id : ids) {
if (id == null) {
continue;
}
Optional<Host> thisHostOpt = hostManager.getHostById(id);
thisHostOpt.ifPresent((h) -> toRet.add(h));
protected List<Host> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<Host> hosts = new ArrayList<>();
for (Long id : ids) {
Optional<Host> host = caseDb.getHostManager().getHostById(id);
if (host.isPresent()) {
hosts.add(host.get());
}
}
return toRet;
return hosts;
}
}

View File

@ -0,0 +1,25 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Host;
import org.sleuthkit.datamodel.Person;
/**
*
* @author rcordovano
*/
public class HostsRemovedFromPersonEvent extends PersonHostsEvent {
private static final long serialVersionUID = 1L;
HostsRemovedFromPersonEvent(Person person, List<Host> hosts) {
super(Case.Events.HOSTS_REMOVED_FROM_PERSON.toString(), person, hosts);
}
}

View File

@ -23,19 +23,21 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Host;
/**
* Event fired when hosts are changed.
* Application events published when hosts in the Sleuth Kit data model for
* a case have been updated.
*/
public class HostsUpdatedEvent extends HostsEvent {
private static final long serialVersionUID = 1L;
/**
* Main constructor.
* Constructs an application event published when hosts in the Sleuth Kit
* data model for a case have been updated.
*
* @param dataModelObjects The new values for the hosts that have been
* changed.
* @param hosts The updated persons.
*/
public HostsUpdatedEvent(List<Host> dataModelObjects) {
super(Case.Events.HOSTS_CHANGED.name(), dataModelObjects);
public HostsUpdatedEvent(List<Host> hosts) {
super(Case.Events.HOSTS_UPDATED.name(), hosts);
}
}

View File

@ -19,22 +19,25 @@
package org.sleuthkit.autopsy.casemodule.events;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import static org.sleuthkit.autopsy.casemodule.Case.Events.OS_ACCOUNTS_ADDED;
import org.sleuthkit.datamodel.OsAccount;
/**
* Event published when OS accounts are added to a case.
* An application event published when OS accounts are added to the Sleuth Kit
* data model for a case.
*/
public final class OsAccountsAddedEvent extends OsAccountsEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event published when OS accounts are added to a case.
* @param accounts
* Constructs an application event published when OS accounts are added to
* the Sleuth Kit data model for a case.
*
* @param osAccounts The OS accounts that were added.
*/
public OsAccountsAddedEvent(List<OsAccount> accounts) {
super(Case.Events.OS_ACCOUNT_ADDED.toString(), accounts);
public OsAccountsAddedEvent(List<OsAccount> osAccounts) {
super(OS_ACCOUNTS_ADDED.toString(), osAccounts);
}
}

View File

@ -18,32 +18,34 @@
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.util.Collections;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.OsAccount;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* An event published when OS accounts are deleted from a case.
* An application event published when OS accounts have been deleted from the
* Sleuth Kit data model for a case.
*/
public final class OsAccountsDeletedEvent extends TskDataModelChangedEvent<OsAccount> {
public final class OsAccountsDeletedEvent extends TskDataModelObjectsDeletedEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event published when OS accounts are deleted from a case.
* Constructs an application event published when OS accounts have been
* deleted from the Sleuth Kit data model for a case.
*
* @param osAccountObjectIds The object IDs of the deleted accounts.
* @param osAccountObjectIds TSK object IDs of the deleted accounts.
*/
public OsAccountsDeletedEvent(List<Long> osAccountObjectIds) {
super(Case.Events.OS_ACCOUNT_REMOVED.toString(), osAccountObjectIds);
super(Case.Events.OS_ACCOUNTS_DELETED.toString(), osAccountObjectIds);
}
@Override
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
return Collections.emptyList();
/**
* Gets the Sleuth Kit object IDs of the deleted OS accounts.
*
* @return The object IDs.
*/
List<Long> getOsAccountObjectIds() {
return getOldValue();
}
}

View File

@ -20,45 +20,47 @@ package org.sleuthkit.autopsy.casemodule.events;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.sleuthkit.datamodel.OsAccount;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Parent class for specific OsAccount event classes.
* A base class for application events published when OS accounts in the Sleuth
* Kit data model for a case have been added or updated.
*/
class OsAccountsEvent extends TskDataModelChangedEvent<OsAccount> {
class OsAccountsEvent extends TskDataModelChangedEvent<OsAccount, OsAccount> {
private static final long serialVersionUID = 1L;
/**
* Construct a new OsAccountEvent.
*
* @param eventName The name of the event.
* @param account The OsAccount the event applies to.
* Constructs the base class part of an application event published when
* OS accounts in the Sleuth Kit data model for a case have been added or
* updated.
*
* @param eventName The name of the Case.Events enum value for the event
* type.
* @param account The OS accounts.
*/
OsAccountsEvent(String eventName, List<OsAccount> accounts) {
super(eventName, accounts, OsAccount::getId);
OsAccountsEvent(String eventName, List<OsAccount> osAccounts) {
super(eventName, null, null, osAccounts, OsAccount::getId);
}
/**
* Returns the OsAccount that changed.
*
* @return The OsAccount that was changed.
* Gets the OS accounts that have been added or updated.
*
* @return The OS accounts.
*/
public OsAccount getOsAccount() {
List<OsAccount> accounts = getNewValue();
return accounts.get(0);
public List<OsAccount> getOsAccounts() {
return getNewValue();
}
@Override
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
Long id = ids.get(0);
OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id);
List<OsAccount> accounts = new ArrayList<>();
accounts.add(account);
return accounts;
}
protected List<OsAccount> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<OsAccount> osAccounts = new ArrayList<>();
for (Long id : ids) {
osAccounts.add(caseDb.getOsAccountManager().getOsAccountByObjectId(id));
}
return osAccounts;
}
}

View File

@ -23,19 +23,21 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.OsAccount;
/**
* Event published when OS accounts in the case have been updated.
* An application event published when OS accounts in the Sleuth Kit data model
* for a case have been updated.
*/
public final class OsAccountsUpdatedEvent extends OsAccountsEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event published when OS accounts in the case have been
* updated.
* Constructs an application event published when OS accounts in the Sleuth
* Kit data model for a case have been updated.
*
* @param accounts The accounts.
* @param osAccounts The OS accounts that were updated.
*/
public OsAccountsUpdatedEvent(List<OsAccount> accounts) {
super(Case.Events.OS_ACCOUNT_CHANGED.toString(), accounts);
public OsAccountsUpdatedEvent(List<OsAccount> osAccounts) {
super(Case.Events.OS_ACCOUNT_CHANGED.toString(), osAccounts);
}
}

View File

@ -0,0 +1,75 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.sleuthkit.datamodel.Host;
import org.sleuthkit.datamodel.Person;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
*
* @author rcordovano
*/
public abstract class PersonHostsEvent extends TskDataModelChangedEvent<Person, Host> {
private static final long serialVersionUID = 1L;
/**
*
* @param eventName
* @param person
* @param hosts
*/
PersonHostsEvent(String eventName, Person person, List<Host> hosts) {
super(eventName, Collections.singletonList(person), Person::getPersonId, hosts, Host::getHostId);
}
/**
*
* @return
*/
Person getPerson() {
return getOldValue().get(0);
}
/**
*
* @return
*/
List<Host> getHosts() {
return getNewValue();
}
@Override
protected List<Person> getOldValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<Person> persons = new ArrayList<>();
for (Long id : ids) {
Optional<Person> person = caseDb.getPersonManager().getPerson(id);
if (person.isPresent()) {
persons.add(person.get());
}
}
return persons;
}
@Override
protected List<Host> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<Host> hosts = new ArrayList<>();
for (Long id : ids) {
Optional<Host> host = caseDb.getHostManager().getHostById(id);
if (host.isPresent()) {
hosts.add(host.get());
}
}
return hosts;
}
}

View File

@ -23,19 +23,21 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Person;
/**
* Event fired when new persons are added to a case.
* An application event published when persons have been added to the Sleuth Kit
* data model for a case.
*/
public class PersonsAddedEvent extends PersonsEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event fired when new persons are added to a case.
* Constructs an application event published when persons have been added to
* the Sleuth Kit data model for a case.
*
* @param persons The persons that have been added.
*/
public PersonsAddedEvent(List<Person> persons) {
super(Case.Events.PERSONS_ADDED.name(), persons);
}
}

View File

@ -18,33 +18,34 @@
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.util.Collections;
import java.util.List;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Person;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* An event fired when persons are deleted from the case.
* Application events published when persons have been deleted from the Sleuth
* Kit data model for a case.
*/
public class PersonsDeletedEvent extends TskDataModelChangedEvent<Person> {
public class PersonsDeletedEvent extends TskDataModelObjectsDeletedEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event fired when persons are deleted from the case.
* Constructs an application event published when persons have been deleted
* from the Sleuth Kit data model for a case.
*
* @param dataModelObjectIds The unique numeric IDs (case database row IDs)
* of the persons that have been deleted.
* @param personIds The IDs of the persons that have been deleted.
*/
public PersonsDeletedEvent(List<Long> dataModelObjectIds) {
super(Case.Events.PERSONS_DELETED.name(), dataModelObjectIds);
public PersonsDeletedEvent(List<Long> personIds) {
super(Case.Events.PERSONS_DELETED.name(), personIds);
}
@Override
protected List<Person> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
return Collections.emptyList();
/**
* Gets the person IDs of the persons that have been deleted.
*
* @return The person IDs.
*/
List<Long> getPersonIds() {
return getOldValue();
}
}

View File

@ -22,44 +22,49 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.sleuthkit.datamodel.Person;
import org.sleuthkit.datamodel.PersonManager;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Base event class for when something pertaining to persons changes.
* A base class for application events published when persons in the Sleuth Kit
* data model for a case have been added or updated.
*/
public class PersonsEvent extends TskDataModelChangedEvent<Person> {
public class PersonsEvent extends TskDataModelChangedEvent<Person, Person> {
private static final long serialVersionUID = 1L;
/**
* Main constructor.
* Constructs the base class part of an application event published when
* persons in the Sleuth Kit data model for a case have been added or
* updated.
*
* @param eventName The name of the Case.Events enum value for the event
* type.
* @param dataModelObjects The list of persons for the event.
* type.
* @param persons The persons.
*/
PersonsEvent(String eventName, List<Person> dataModelObjects) {
super(eventName, dataModelObjects, Person::getPersonId);
PersonsEvent(String eventName, List<Person> persons) {
super(eventName, null, null, persons, Person::getPersonId);
}
@Override
protected List<Person> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
PersonManager personManager = caseDb.getPersonManager();
List<Person> toRet = new ArrayList<>();
if (ids != null) {
for (Long id : ids) {
if (id == null) {
continue;
}
Optional<Person> thisPersonOpt = personManager.getPerson(id);
thisPersonOpt.ifPresent((h) -> toRet.add(h));
/**
* Gets the persons that have been added or updated.
*
* @return The persons.
*/
public List<Person> getPersons() {
return getNewValue();
}
@Override
protected List<Person> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<Person> persons = new ArrayList<>();
for (Long id : ids) {
Optional<Person> person = caseDb.getPersonManager().getPerson(id);
if (person.isPresent()) {
persons.add(person.get());
}
}
return toRet;
return persons;
}
}

View File

@ -23,19 +23,21 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.Person;
/**
* An event fired when persons in a case are updated.
* Application events published when persons in the Sleuth Kit data model for
* a case have been updated.
*/
public class PersonsUpdatedEvent extends PersonsEvent {
private static final long serialVersionUID = 1L;
/**
* Constructs an event fired when persons in a case are updated.
* Constructs an application event published when persons in the Sleuth Kit
* data model for a case have been updated.
*
* @param persons The updated persons.
*/
public PersonsUpdatedEvent(List<Person> persons) {
super(Case.Events.PERSONS_CHANGED.name(), persons);
super(Case.Events.PERSONS_UPDATED.name(), persons);
}
}

View File

@ -28,33 +28,38 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Event published when a report is added to a case.
* An application event published when a report is added to a case.
*/
public final class ReportAddedEvent extends TskDataModelChangedEvent<Report> {
public final class ReportAddedEvent extends TskDataModelChangedEvent<Report, Report> {
private static final long serialVersionUID = 1L;
/**
* Constructs an event published when a report is added to a case.
* Constructs an application event published when a report is added to a
* case.
*
* @param report The data source that was added.
* @param report The report that was added.
*/
public ReportAddedEvent(Report report) {
super(Case.Events.REPORT_ADDED.toString(), Stream.of(report).collect(Collectors.toList()), Report::getId);
super(Case.Events.REPORT_ADDED.toString(), null, null, Stream.of(report).collect(Collectors.toList()), Report::getId);
}
/**
* Gets the reoprt that was added to the case.
*
* @return The report.
*/
public Report getReport() {
List<Report> reports = getNewValue();
return reports.get(0);
}
@Override
protected List<Report> getDataModelObjects(SleuthkitCase caseD, List<Long> ids) throws TskCoreException {
protected List<Report> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
Long id = ids.get(0);
Report report = caseD.getReportById(id);
List<Report> reports = new ArrayList<>();
reports.add(report);
reports.add(caseDb.getReportById(id));
return reports;
}
}

View File

@ -32,123 +32,142 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* An abstract base class for application events published when Sleuth Kit Data
* Model objects for a case are added, updated, or deleted.
* An abstract base class for application events published when one or more
* Sleuth Kit Data Model objects for a case change in some way.
*
* @param <T> A Sleuth Kit Data Model object type.
* This class extends AutopsyEvent. The AutopsyEvent class extends
* PropertyChangeEvent to integrate with legacy use of JavaBeans
* PropertyChangeEvents and PropertyChangeListeners as an application event
* publisher-subcriber mechanism. Subclasses need to decide what constitutes
* "old" and "new" objects for them and are encouraged to provide getters for
* these values that do not require clients to cast the return values.
*
* The AutopsyEvent class implements Serializable to allow local event instances
* to be published to other Autopsy nodes over a network in serialized form. TSK
* Data Model objects are generally not serializable because they encapsulate a
* reference to a SleuthkitCase object that represents the case database and
* which has local JDBC Connection objects. For this reason, this class supports
* serialization of the unique numeric IDs (TSK object IDs, case database row
* IDs, etc.) of the subject TSK Data Model objects and the "reconstruction" of
* those objects on other Autopsy nodes by querying the case database by unique
* ID.
*
* @param <T> The Sleuth Kit Data Model object type of the "old" data model
* objects.
* @param <U> The Sleuth Kit Data Model object type of the "new" data model
* objects.
*/
public abstract class TskDataModelChangedEvent<T> extends AutopsyEvent {
public abstract class TskDataModelChangedEvent<T, U> extends AutopsyEvent {
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(TskDataModelChangedEvent.class.getName());
private final boolean isDeletionEvent;
private final List<Long> dataModelObjectIds;
private transient List<T> dataModelObjects;
private final boolean hasOldValue;
private final List<Long> oldValueIds;
private transient List<T> oldValueObjects;
private final boolean hasNewValue;
private final List<Long> newValueIds;
private transient List<U> newValueObjects;
/**
* Constructs an instance of an abstract base class for application events
* published when Sleuth Kit Data Model objects for a case are added or
* updated. The getNewValue() method of this event will return the objects
* and the getOldValue() method will return an empty list.
* Constructs the base class part for application events published when one
* or more Sleuth Kit Data Model objects for a case change in some way.
*
* @param eventName The event name.
* @param dataModelObjects The Sleuth Kit Data Model objects that have been
* added or updated.
* @param getIdMethod A method that can be applied to the data model
* objects to get their unique numeric IDs (TSK
* object IDs, case database row IDs, etc.).
* @param eventName The event name.
* @param oldValueObjects A list of he Data Model objects that have been
* designated as the "old" objects in the event.
* May be null.
* @param oldValueGetIdMethod A method that can be applied to the "old" data
* model objects to get their unique numeric IDs
* (TSK object IDs, case database row IDs, etc.).
* May be null if there are no "old" objects.
* @param newValueObjects A list of he Data Model objects that have been
* designated as the "new" objects in the event.
* May be null.
* @param newValueGetIdMethod A method that can be applied to the "new" data
* model objects to get their unique numeric IDs
* (TSK object IDs, case database row IDs, etc.).
* May be null if there are no "new" objects.
*/
protected TskDataModelChangedEvent(String eventName, List<T> dataModelObjects, Function<T, Long> getIdMethod) {
protected TskDataModelChangedEvent(String eventName, List<T> oldValueObjects, Function<T, Long> oldValueGetIdMethod, List<U> newValueObjects, Function<U, Long> newValueGetIdMethod) {
super(eventName, null, null);
isDeletionEvent = false;
this.dataModelObjectIds = new ArrayList<>();
this.dataModelObjectIds.addAll(dataModelObjects.stream().map(o -> getIdMethod.apply(o)).collect(Collectors.toList()));
this.dataModelObjects = new ArrayList<>();
this.dataModelObjects.addAll(dataModelObjects);
}
/**
* Constructs an instance of an abstract base class for application events
* published when Sleuth Kit Data Model objects for a case are added or
* updated. The getOldValue() method of this event will return the object
* IDs and the getNewValue() method will return an empty list.
*
* @param eventName The event name.
* @param dataModelObjectIds The unique numeric IDs (TSK object IDs, case
* database row IDs, etc.) of the Sleuth Kit Data
* Model objects that have been deleted.
*/
protected TskDataModelChangedEvent(String eventName, List<Long> dataModelObjectIds) {
super(eventName, null, null);
isDeletionEvent = true;
this.dataModelObjectIds = new ArrayList<>();
this.dataModelObjectIds.addAll(dataModelObjectIds);
dataModelObjects = Collections.emptyList();
}
/**
* Gets the the unique numeric IDs (TSK object IDs, case database row IDs,
* etc.) of the Sleuth Kit Data Model objects that were deleted.
*
* @return The unique IDs.
*/
@Override
public List<Long> getOldValue() {
if (isDeletionEvent) {
return getDataModelObjectIds();
oldValueIds = new ArrayList<>();
this.oldValueObjects = new ArrayList<>();
if (oldValueObjects != null) {
hasOldValue = true;
oldValueIds.addAll(oldValueObjects.stream()
.map(o -> oldValueGetIdMethod.apply(o))
.collect(Collectors.toList()));
this.oldValueObjects.addAll(oldValueObjects);
} else {
return Collections.emptyList();
hasOldValue = false;
}
newValueIds = new ArrayList<>();
this.newValueObjects = new ArrayList<>();
if (oldValueObjects != null) {
hasNewValue = true;
newValueIds.addAll(newValueObjects.stream()
.map(o -> newValueGetIdMethod.apply(o))
.collect(Collectors.toList()));
this.newValueObjects.addAll(newValueObjects);
} else {
hasNewValue = false;
}
}
/**
* Gets the Sleuth Kit Data Model objects that were added or updated. If
* this event came from another host collaborating on a multi-user case, the
* Sleuth Kit Data Model objects will be reconstructed on the current host.
* Gets a list of the Data Model objects that have been designated as the
* "old" objects in the event.
*
* @return The objects.
* @return The list of the "old" data model objects. May be empty.
*/
@Override
public List<T> getNewValue() {
if (!isDeletionEvent) {
if (dataModelObjects == null) {
public List<T> getOldValue() {
if (hasOldValue) {
if (oldValueObjects == null) {
try {
Case currentCase = Case.getCurrentCaseThrows();
SleuthkitCase caseDb = currentCase.getSleuthkitCase();
dataModelObjects = getDataModelObjects(caseDb, dataModelObjectIds);
oldValueObjects = getOldValueObjects(caseDb, oldValueIds);
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Error geting TSK Data Model objects for %s event (%s)", getPropertyName(), getSourceType()), ex);
logger.log(Level.SEVERE, String.format("Error getting oldValue() TSK Data Model objects for %s event (%s)", getPropertyName(), getSourceType()), ex);
return Collections.emptyList();
}
}
return Collections.unmodifiableList(dataModelObjects);
return Collections.unmodifiableList(oldValueObjects);
} else {
return Collections.emptyList();
}
}
/**
* Gets a list of the Data Model objects that have been designated as the
* "new" objects in the event.
*
* @return The list of the "new" data model objects. May be empty.
*/
@Override
public List<U> getNewValue() {
if (hasNewValue) {
if (newValueObjects == null) {
try {
Case currentCase = Case.getCurrentCaseThrows();
SleuthkitCase caseDb = currentCase.getSleuthkitCase();
newValueObjects = getNewValueObjects(caseDb, newValueIds);
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Error getting newValue() TSK Data Model objects for %s event (%s)", getPropertyName(), getSourceType()), ex);
return Collections.emptyList();
}
}
return Collections.unmodifiableList(newValueObjects);
} else {
return Collections.emptyList();
}
}
/**
* Gets the unique numeric IDs (TSK object IDs, case database row IDs, etc.)
* of the Sleuth Kit Data Model objects associated with this application
* event.
*
* This method is provided as an optimization that allows handling of an
* event that came from another host collaborating on a multi-user case
* without reconstructing the data model objects that are the subject s of
* the event.
*
* @return The unique IDs.
*/
public final List<Long> getDataModelObjectIds() {
return Collections.unmodifiableList(dataModelObjectIds);
}
/**
* Gets the Sleuth Kit Data Model objects associated with this application
* event. If this event came from another host collaborating on a multi-user
* case, the Sleuth Kit Data Model objects, this method will be called to
* reconstruct the objects on the curartifactExists(), I think we should continue to use what we have and suppress the deprecation warnings.Bent host.
* Reconstructs the "old" Sleuth Kit Data Model objects associated with this
* application event, if any, using the given unique numeric IDs (TSK object
* IDs, case database row IDs, etc.) to query the given case database.
*
* @param caseDb The case database.
* @param ids The unique, numeric IDs (TSK object IDs, case database row
@ -160,6 +179,27 @@ public abstract class TskDataModelChangedEvent<T> extends AutopsyEvent {
* getting the Sleuth Kit
* Data Model objects.
*/
abstract protected List<T> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException;
protected List<T> getOldValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
return Collections.emptyList();
}
/**
* Reconstructs the "new" Sleuth Kit Data Model objects associated with this
* application event, if any, using the given unique numeric IDs (TSK object
* IDs, case database row IDs, etc.) to query the given case database.
*
* @param caseDb The case database.
* @param ids The unique, numeric IDs (TSK object IDs, case database row
* IDs, etc.) of the Sleuth Kit Data Model objects.
*
* @return The objects.
*
* @throws org.sleuthkit.datamodel.TskCoreException If there is an error
* getting the Sleuth Kit
* Data Model objects.
*/
protected List<U> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
return Collections.emptyList();
}
}

View File

@ -0,0 +1,60 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2021 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.casemodule.events;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.sleuthkit.autopsy.events.AutopsyEvent;
/**
* An abstract base class for application events published when one or more
* Sleuth Kit Data Model objects for a case have been deleted.
*
* This class extends AutopsyEvent. The AutopsyEvent class extends
* PropertyChangeEvent to integrate with legacy use of JavaBeans
* PropertyChangeEvents and PropertyChangeListeners as an application event
* publisher-subcriber mechanism. Subclasses need to decide what constitutes
* "old" and "new" objects for them.
*
* For this class the "old" values are the unique numeric IDs (TSK object IDs,
* case database row IDs, etc.) of the deleted TSK Data Model objects. There are
* no "new" values. Subclasses are encouraged to provide less generic getters
* with descriptive names for the unique IDs than the override of the inherited
* getOldValue() method below. These getters can be implemented by delegating to
* getOldValue().
*/
public class TskDataModelObjectsDeletedEvent extends AutopsyEvent {
private static final long serialVersionUID = 1L;
private final List<Long> deletedObjectIds;
protected TskDataModelObjectsDeletedEvent(String eventName, List<Long> deletedObjectIds) {
super(eventName, null, null);
this.deletedObjectIds = new ArrayList<>();
this.deletedObjectIds.addAll(deletedObjectIds);
}
@Override
public List<Long> getOldValue() {
return Collections.unmodifiableList(deletedObjectIds);
}
}

View File

@ -47,13 +47,12 @@ import org.sleuthkit.datamodel.TskCoreException;
*/
public final class AutopsyTreeChildFactory extends ChildFactory.Detachable<Object> {
private static final Set<Case.Events> LISTENING_EVENTS = EnumSet.of(
Case.Events.DATA_SOURCE_ADDED,
private static final Set<Case.Events> LISTENING_EVENTS = EnumSet.of(Case.Events.DATA_SOURCE_ADDED,
Case.Events.HOSTS_ADDED,
Case.Events.HOSTS_DELETED,
Case.Events.PERSONS_ADDED,
Case.Events.PERSONS_DELETED,
Case.Events.PERSONS_CHANGED
Case.Events.PERSONS_UPDATED
);
private static final Set<String> LISTENING_EVENT_NAMES = LISTENING_EVENTS.stream()

View File

@ -50,11 +50,10 @@ public class DataSourcesByTypeNode extends DisplayableItemNode {
*/
public static class DataSourcesByTypeChildren extends ChildFactory.Detachable<HostDataSources> {
private static final Set<Case.Events> UPDATE_EVTS = EnumSet.of(
Case.Events.DATA_SOURCE_ADDED,
private static final Set<Case.Events> UPDATE_EVTS = EnumSet.of(Case.Events.DATA_SOURCE_ADDED,
Case.Events.HOSTS_ADDED,
Case.Events.HOSTS_DELETED,
Case.Events.HOSTS_CHANGED);
Case.Events.HOSTS_UPDATED);
private static final Set<String> UPDATE_EVT_STRS = UPDATE_EVTS.stream()
.map(evt -> evt.name())

View File

@ -177,7 +177,7 @@ public class HostNode extends DisplayableItemNode {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String eventType = evt.getPropertyName();
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsUpdatedEvent) {
if (hostId != null && eventType.equals(Case.Events.HOSTS_UPDATED.toString()) && evt instanceof HostsUpdatedEvent) {
((HostsUpdatedEvent) evt).getNewValue().stream()
.filter(h -> h != null && h.getHostId() == hostId)
.findFirst()
@ -246,7 +246,7 @@ public class HostNode extends DisplayableItemNode {
host == null ? Lookups.fixed(displayName) : Lookups.fixed(host, displayName));
hostId = host == null ? null : host.getHostId();
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_CHANGED),
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_UPDATED),
WeakListeners.propertyChange(hostChangePcl, this));
super.setName(displayName);
super.setDisplayName(displayName);

View File

@ -124,8 +124,8 @@ public final class OsAccounts implements AutopsyVisitableItem {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String eventType = evt.getPropertyName();
if (eventType.equals(Case.Events.OS_ACCOUNT_ADDED.toString())
|| eventType.equals(Case.Events.OS_ACCOUNT_REMOVED.toString())) {
if (eventType.equals(Case.Events.OS_ACCOUNTS_ADDED.toString())
|| eventType.equals(Case.Events.OS_ACCOUNTS_DELETED.toString())) {
refresh(true);
} else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) {
// case was closed. Remove listeners so that we don't get called with a stale case handle
@ -139,13 +139,13 @@ public final class OsAccounts implements AutopsyVisitableItem {
@Override
protected void addNotify() {
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.OS_ACCOUNT_ADDED, Case.Events.OS_ACCOUNT_REMOVED), listener);
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.OS_ACCOUNTS_ADDED, Case.Events.OS_ACCOUNTS_DELETED), listener);
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), listener);
}
@Override
protected void removeNotify() {
Case.removeEventTypeSubscriber(Collections.singleton(Case.Events.OS_ACCOUNT_ADDED), listener);
Case.removeEventTypeSubscriber(Collections.singleton(Case.Events.OS_ACCOUNTS_ADDED), listener);
Case.removeEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), listener);
}
@ -184,10 +184,13 @@ public final class OsAccounts implements AutopsyVisitableItem {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(Case.Events.OS_ACCOUNT_CHANGED.name())) {
if (((OsAccountsUpdatedEvent) evt).getOsAccount().getId() == account.getId()) {
// Update the account node to the new one
account = ((OsAccountsUpdatedEvent) evt).getOsAccount();
updateSheet();
OsAccountsUpdatedEvent updateEvent = (OsAccountsUpdatedEvent) evt;
for (OsAccount acct : updateEvent.getOsAccounts()) {
if (acct.getId() == account.getId()) {
account = acct;
updateSheet();
break;
}
}
} else if (evt.getPropertyName().equals(REALM_DATA_AVAILABLE_EVENT)) {
OsAccountRealm realm = (OsAccountRealm) evt.getNewValue();

View File

@ -68,10 +68,9 @@ public class PersonGroupingNode extends DisplayableItemNode {
private static final Logger logger = Logger.getLogger(PersonChildren.class.getName());
private static final Set<Case.Events> CHILD_EVENTS = EnumSet.of(
Case.Events.HOSTS_ADDED,
private static final Set<Case.Events> CHILD_EVENTS = EnumSet.of(Case.Events.HOSTS_ADDED,
Case.Events.HOSTS_DELETED,
Case.Events.PERSONS_CHANGED);
Case.Events.PERSONS_UPDATED);
private static final Set<String> CHILD_EVENTS_STR = CHILD_EVENTS.stream()
.map(ev -> ev.name())
@ -145,7 +144,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String eventType = evt.getPropertyName();
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsUpdatedEvent) {
if (personId != null && eventType.equals(Case.Events.PERSONS_UPDATED.toString()) && evt instanceof PersonsUpdatedEvent) {
((PersonsUpdatedEvent) evt).getNewValue().stream()
.filter(p -> p != null && p.getPersonId() == personId)
.findFirst()
@ -192,7 +191,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
this.setIconBaseWithExtension(ICON_PATH);
this.person = person;
this.personId = person == null ? null : person.getPersonId();
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_CHANGED),
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_UPDATED),
WeakListeners.propertyChange(personChangePcl, this));
}

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.datamodel.hosts;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
@ -66,7 +67,7 @@ public class AssociateNewPersonAction extends AbstractAction {
newPersonName = getAddDialogName();
if (StringUtils.isNotBlank(newPersonName)) {
Person person = Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().newPerson(newPersonName);
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().setPerson(host, person);
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().addHostsToPerson(person, Collections.singletonList(host));
}
} catch (NoCurrentCaseException | TskCoreException ex) {
String hostName = this.host == null || this.host.getName() == null ? "" : this.host.getName();

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.datamodel.hosts;
import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
@ -65,7 +66,7 @@ public class AssociatePersonAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
try {
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().setPerson(host, person);
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().addHostsToPerson(person, Collections.singletonList(host));
} catch (NoCurrentCaseException | TskCoreException ex) {
String hostName = this.host == null || this.host.getName() == null ? "" : this.host.getName();
String personName = this.person == null || this.person.getName() == null ? "" : this.person.getName();

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.datamodel.hosts;
import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
@ -46,6 +47,7 @@ public class RemoveParentPersonAction extends AbstractAction {
private static final Logger logger = Logger.getLogger(RemoveParentPersonAction.class.getName());
private final Person person;
private final Host host;
/**
@ -59,12 +61,13 @@ public class RemoveParentPersonAction extends AbstractAction {
person == null || person.getName() == null
? Bundle.RemoveParentPersonAction_unknownPerson() : person.getName()));
this.host = host;
this.person = person;
}
@Override
public void actionPerformed(ActionEvent e) {
try {
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().setPerson(host, null);
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().removeHostsFromPerson(person, Collections.singletonList(host));
} catch (NoCurrentCaseException | TskCoreException ex) {
String hostName = this.host == null || this.host.getName() == null ? "" : this.host.getName();
logger.log(Level.WARNING, String.format("Unable to remove parent from host: %s", hostName), ex);

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2015 Basis Technology Corp.
* Copyright 2015-2021 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -22,12 +22,18 @@ import java.beans.PropertyChangeEvent;
import java.io.Serializable;
/**
* A base class for events to be published to registered subscribers on both
* this Autopsy node and other Autopsy nodes. The class extends
* PropertyChangeEvent to integrate with legacy use of JavaBeans
* PropertyChangeEvents and PropertyChangeListeners as an application event
* system, and implements Serializable to allow it to be published over a
* network in serialized form.
* A base class for application events that can be published to registered
* subscribers on both this Autopsy node and other Autopsy nodes.
*
* The class extends PropertyChangeEvent to integrate with legacy use of
* JavaBeans PropertyChangeEvents and PropertyChangeListeners as an application
* event publisher-subcriber mechanism. Subclasses need to decide what
* constitutes "old" and "new" objects for them and are encouraged to provide
* getters for these values that do not require clients to cast the return
* values.
*
* This class implements Serializable to allow it to be published over a network
* in serialized form.
*/
public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
@ -36,17 +42,22 @@ public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
/**
* Events have a source field set to local or remote to allow event
* subscribers to filter events by source type.
* subscribers to filter events by source type. For a multi-user case, a
* local event has happened on this Autopsy node, and a remote event has
* happened on another Autopsy node.
*
* Events are local by default and are changed to remote events by the event
* publishers on other Autopsy nodes upon event receipt.
*/
public enum SourceType {
LOCAL,
REMOTE
};
/**
* Constructs an event that can be published to registered subscribers on
* both this Autopsy node and other Autopsy nodes.
* Constructs the base class part of an application event that can be
* published to registered subscribers on both this Autopsy node and other
* Autopsy nodes.
*
* @param eventName The event name.
* @param oldValue The "old" value to associate with the event. May be
@ -60,7 +71,7 @@ public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
}
/**
* Gets the source type (local or remote).
* Gets the event source type (local or remote).
*
* @return SourceType The source type of the event, local or remote.
*/
@ -69,12 +80,9 @@ public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
}
/**
* Gets the source type (local or remote) as a string. This is for clients
* that do not have access to the AutopsyEvent type, and is necessary
* because the events package is not currently a public package within the
* Autopsy-Core NetBeans Module (NBM).
* Gets the event source type (local or remote) as a string.
*
* @return A string, either "LOCAL" or "REMOTE", as an Object.
* @return A string, either "LOCAL" or "REMOTE."
*/
@Override
public Object getSource() {
@ -82,10 +90,10 @@ public class AutopsyEvent extends PropertyChangeEvent implements Serializable {
}
/**
* Sets the source type (local or remote). This field is mutable in this way
* to allow an event to be published both locally and remotely without
* requiring the construction of two separate objects. It is for use by the
* event publishing classes within this package only.
* Sets the source type (local or remote). This field is mutable to allow an
* event to be published both locally and remotely without requiring the
* construction of two separate objects. It is for use by the event
* publishing classes within this package only.
*
* @param sourceType The source type of the event, local or remote.
*/