7747 OS acct instance events

This commit is contained in:
Richard Cordovano 2021-06-22 12:48:06 -04:00
parent bb26b908b4
commit 938157c055
2 changed files with 20 additions and 14 deletions

View File

@ -18,7 +18,6 @@
*/ */
package org.sleuthkit.autopsy.casemodule.events; package org.sleuthkit.autopsy.casemodule.events;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.sleuthkit.autopsy.casemodule.Case.Events.OS_ACCT_INSTANCES_ADDED; import static org.sleuthkit.autopsy.casemodule.Case.Events.OS_ACCT_INSTANCES_ADDED;
import org.sleuthkit.datamodel.OsAccountInstance; import org.sleuthkit.datamodel.OsAccountInstance;
@ -26,16 +25,16 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
* An application event published when OS accounts are added to the Sleuth Kit * An application event published when OS account instances are added to the
* data model for a case. * Sleuth Kit data model for a case.
*/ */
public final class OsAcctInstancesAddedEvent extends TskDataModelChangedEvent<OsAccountInstance, OsAccountInstance> { public final class OsAcctInstancesAddedEvent extends TskDataModelChangedEvent<OsAccountInstance, OsAccountInstance> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* Constructs an application event published when OS account instances are added to * Constructs an application event published when OS account instances are
* the Sleuth Kit data model for a case. * added to the Sleuth Kit data model for a case.
* *
* @param osAcctInstances The OS account instances that were added. * @param osAcctInstances The OS account instances that were added.
*/ */
@ -44,9 +43,9 @@ public final class OsAcctInstancesAddedEvent extends TskDataModelChangedEvent<Os
} }
/** /**
* Gets the OS accounts that have been added or updated. * Gets the OS account instances that have been added.
* *
* @return The OS accounts. * @return The OS account instances.
*/ */
public List<OsAccountInstance> getOsAccountInstances() { public List<OsAccountInstance> getOsAccountInstances() {
return getNewValue(); return getNewValue();
@ -54,11 +53,7 @@ public final class OsAcctInstancesAddedEvent extends TskDataModelChangedEvent<Os
@Override @Override
protected List<OsAccountInstance> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException { protected List<OsAccountInstance> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
List<OsAccountInstance> osAccountInstances = new ArrayList<>(); return caseDb.getOsAccountManager().getOsAccountInstances(ids);
for (Long id : ids) {
//RJCTODO
}
return osAccountInstances;
} }
} }

View File

@ -37,6 +37,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent; import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent; import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent;
import org.sleuthkit.autopsy.casemodule.events.DataSourceNameChangedEvent; import org.sleuthkit.autopsy.casemodule.events.DataSourceNameChangedEvent;
import org.sleuthkit.autopsy.casemodule.events.OsAcctInstancesAddedEvent;
import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
@ -56,6 +57,7 @@ import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.datamodel.Tag; import org.sleuthkit.datamodel.Tag;
import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.datamodel.OsAccountInstance;
/** /**
* Listen for case events and update entries in the Central Repository database * Listen for case events and update entries in the Central Repository database
@ -75,7 +77,8 @@ public final class CaseEventListener implements PropertyChangeListener {
Case.Events.DATA_SOURCE_ADDED, Case.Events.DATA_SOURCE_ADDED,
Case.Events.TAG_DEFINITION_CHANGED, Case.Events.TAG_DEFINITION_CHANGED,
Case.Events.CURRENT_CASE, Case.Events.CURRENT_CASE,
Case.Events.DATA_SOURCE_NAME_CHANGED); Case.Events.DATA_SOURCE_NAME_CHANGED,
Case.Events.OS_ACCT_INSTANCES_ADDED);
public CaseEventListener() { public CaseEventListener() {
jobProcessingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(CASE_EVENT_THREAD_NAME).build()); jobProcessingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(CASE_EVENT_THREAD_NAME).build());
@ -130,6 +133,14 @@ public final class CaseEventListener implements PropertyChangeListener {
jobProcessingExecutor.submit(new DataSourceNameChangedTask(dbManager, evt)); jobProcessingExecutor.submit(new DataSourceNameChangedTask(dbManager, evt));
} }
break; break;
case OS_ACCT_INSTANCES_ADDED: {
// STUB, TO BE REPLACED
List<OsAccountInstance> osAcctInstances = ((OsAcctInstancesAddedEvent) evt).getOsAccountInstances();
for (OsAccountInstance instance : osAcctInstances) {
LOGGER.log(Level.INFO, String.format("Received OS account instance added message (instance ID = %d)", instance.getInstanceId()));
}
}
break;
} }
} }