api changes

This commit is contained in:
Greg DiCristofaro 2021-04-05 09:39:55 -04:00
parent 0952403cf4
commit d5772c0725
11 changed files with 18 additions and 18 deletions

View File

@ -166,7 +166,7 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
if (specifyNewHostRadio.isSelected() && StringUtils.isNotEmpty(specifyNewHostTextField.getText())) { if (specifyNewHostRadio.isSelected() && StringUtils.isNotEmpty(specifyNewHostTextField.getText())) {
String newHostName = specifyNewHostTextField.getText(); String newHostName = specifyNewHostTextField.getText();
try { try {
return Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName); return Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().newHost(newHostName);
} catch (NoCurrentCaseException | TskCoreException ex) { } catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, String.format("Unable to create host '%s'.", newHostName), ex); logger.log(Level.WARNING, String.format("Unable to create host '%s'.", newHostName), ex);
return null; return null;
@ -186,7 +186,7 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
*/ */
private void loadHostData() { private void loadHostData() {
try { try {
Collection<Host> hosts = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getHosts(); Collection<Host> hosts = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getAllHosts();
sanitizedHostSet = HostNameValidator.getSanitizedHostNames(hosts); sanitizedHostSet = HostNameValidator.getSanitizedHostNames(hosts);
Vector<HostListItem> hostListItems = hosts.stream() Vector<HostListItem> hostListItems = hosts.stream()

View File

@ -76,7 +76,7 @@ public class HostsEvent extends TskDataModelChangeEvent<Host> {
continue; continue;
} }
Optional<Host> thisHostOpt = hostManager.getHost(id); Optional<Host> thisHostOpt = hostManager.getHostById(id);
thisHostOpt.ifPresent((h) -> toRet.add(h)); thisHostOpt.ifPresent((h) -> toRet.add(h));
} }
} }

View File

@ -390,7 +390,7 @@ public class OsAccountDataPanel extends JPanel {
account = osAccountManager.getOsAccountByObjectId(accountId); account = osAccountManager.getOsAccountByObjectId(accountId);
} }
OsAccountRealm realm = skCase.getOsAccountRealmManager().getRealmById(account.getRealmId()); OsAccountRealm realm = skCase.getOsAccountRealmManager().getRealmByRealmId(account.getRealmId());
List<Host> hosts = osAccountManager.getHosts(account); List<Host> hosts = osAccountManager.getHosts(account);
List<OsAccountAttribute> attributeList = account.getOsAccountAttributes(); List<OsAccountAttribute> attributeList = account.getOsAccountAttributes();

View File

@ -115,7 +115,7 @@ public final class AutopsyTreeChildFactory extends ChildFactory.Detachable<Objec
return true; return true;
} else { } else {
// otherwise, just show host level // otherwise, just show host level
tskCase.getHostManager().getHosts().stream() tskCase.getHostManager().getAllHosts().stream()
.map(HostGrouping::new) .map(HostGrouping::new)
.sorted() .sorted()
.forEach(list::add); .forEach(list::add);

View File

@ -85,7 +85,7 @@ public class DataSourcesByTypeNode extends DisplayableItemNode {
@Override @Override
protected boolean createKeys(List<HostDataSources> toPopulate) { protected boolean createKeys(List<HostDataSources> toPopulate) {
try { try {
Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getHosts().stream() Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getAllHosts().stream()
.map(HostDataSources::new) .map(HostDataSources::new)
.sorted() .sorted()
.forEach(toPopulate::add); .forEach(toPopulate::add);

View File

@ -146,7 +146,7 @@ public final class OsAccounts implements AutopsyVisitableItem {
if (filteringDSObjId == 0) { if (filteringDSObjId == 0) {
list.addAll(skCase.getOsAccountManager().getOsAccounts()); list.addAll(skCase.getOsAccountManager().getOsAccounts());
} else { } else {
Host host = skCase.getHostManager().getHost(skCase.getDataSource(filteringDSObjId)); Host host = skCase.getHostManager().getHostByDataSource(skCase.getDataSource(filteringDSObjId));
list.addAll(skCase.getOsAccountManager().getOsAccounts(host)); list.addAll(skCase.getOsAccountManager().getOsAccounts(host));
} }
} catch (TskCoreException | TskDataException ex) { } catch (TskCoreException | TskDataException ex) {

View File

@ -65,7 +65,7 @@ public class AssociateNewPersonAction extends AbstractAction {
try { try {
newPersonName = getAddDialogName(); newPersonName = getAddDialogName();
if (StringUtils.isNotBlank(newPersonName)) { if (StringUtils.isNotBlank(newPersonName)) {
Person person = Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().createPerson(newPersonName); Person person = Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().newPerson(newPersonName);
Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().setPerson(host, person); Case.getCurrentCaseThrows().getSleuthkitCase().getPersonManager().setPerson(host, person);
} }
} catch (NoCurrentCaseException | TskCoreException ex) { } catch (NoCurrentCaseException | TskCoreException ex) {

View File

@ -166,7 +166,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
if (newHostName != null) { if (newHostName != null) {
Long selectedId = null; Long selectedId = null;
try { try {
Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName); Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().newHost(newHostName);
selectedId = newHost == null ? null : newHost.getHostId(); selectedId = newHost == null ? null : newHost.getHostId();
} catch (NoCurrentCaseException | TskCoreException e) { } catch (NoCurrentCaseException | TskCoreException e) {
logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), e); logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), e);
@ -322,7 +322,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
Map<Host, List<DataSource>> hostMapping = new HashMap<>(); Map<Host, List<DataSource>> hostMapping = new HashMap<>();
try { try {
SleuthkitCase curCase = Case.getCurrentCaseThrows().getSleuthkitCase(); SleuthkitCase curCase = Case.getCurrentCaseThrows().getSleuthkitCase();
List<Host> hosts = curCase.getHostManager().getHosts(); List<Host> hosts = curCase.getHostManager().getAllHosts();
List<DataSource> dataSources = curCase.getDataSources(); List<DataSource> dataSources = curCase.getDataSources();
if (dataSources != null) { if (dataSources != null) {

View File

@ -67,7 +67,7 @@ public class MergeHostMenuAction extends AbstractAction implements Presenter.Pop
// Get a list of all other hosts // Get a list of all other hosts
List<Host> otherHosts = Collections.emptyList(); List<Host> otherHosts = Collections.emptyList();
try { try {
otherHosts = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getHosts(); otherHosts = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().getAllHosts();
otherHosts.remove(sourceHost); otherHosts.remove(sourceHost);
} catch (NoCurrentCaseException | TskCoreException ex) { } catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, "Error getting hosts for case.", ex); logger.log(Level.WARNING, "Error getting hosts for case.", ex);

View File

@ -1085,7 +1085,7 @@ public class PortableCaseReportModule implements ReportModule {
Host newHost = null; Host newHost = null;
if (content instanceof DataSource) { if (content instanceof DataSource) {
Host oldHost = ((DataSource)content).getHost(); Host oldHost = ((DataSource)content).getHost();
newHost = portableSkCase.getHostManager().createHost(oldHost.getName()); newHost = portableSkCase.getHostManager().newHost(oldHost.getName());
} }
CaseDbTransaction trans = portableSkCase.beginTransaction(); CaseDbTransaction trans = portableSkCase.beginTransaction();

View File

@ -1079,7 +1079,7 @@ class ExtractRegistry extends Extract {
// New OsAccount Code // New OsAccount Code
OsAccountManager accountMgr = tskCase.getOsAccountManager(); OsAccountManager accountMgr = tskCase.getOsAccountManager();
HostManager hostMrg = tskCase.getHostManager(); HostManager hostMrg = tskCase.getHostManager();
Host host = hostMrg.getHost((DataSource)dataSource); Host host = hostMrg.getHostByDataSource((DataSource)dataSource);
List<OsAccount> existingAccounts = accountMgr.getOsAccounts(host); List<OsAccount> existingAccounts = accountMgr.getOsAccounts(host);
for(OsAccount osAccount: existingAccounts) { for(OsAccount osAccount: existingAccounts) {
@ -1097,8 +1097,8 @@ class ExtractRegistry extends Extract {
//add remaining userinfos as accounts; //add remaining userinfos as accounts;
for (Map<String, String> userInfo : userInfoMap.values()) { for (Map<String, String> userInfo : userInfoMap.values()) {
OsAccount osAccount = accountMgr.createWindowsOsAccount(userInfo.get(SID_KEY), null, null, host, OsAccountRealm.RealmScope.UNKNOWN); OsAccount osAccount = accountMgr.newWindowsOsAccount(userInfo.get(SID_KEY), null, null, host, OsAccountRealm.RealmScope.UNKNOWN);
accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); accountMgr.newOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED);
updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile); updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile);
} }
@ -1967,13 +1967,13 @@ class ExtractRegistry extends Extract {
private void createOrUpdateOsAccount(AbstractFile file, String sid, String userName, String homeDir) throws TskCoreException, TskDataException, NotUserSIDException { private void createOrUpdateOsAccount(AbstractFile file, String sid, String userName, String homeDir) throws TskCoreException, TskDataException, NotUserSIDException {
OsAccountManager accountMgr = tskCase.getOsAccountManager(); OsAccountManager accountMgr = tskCase.getOsAccountManager();
HostManager hostMrg = tskCase.getHostManager(); HostManager hostMrg = tskCase.getHostManager();
Host host = hostMrg.getHost((DataSource)dataSource); Host host = hostMrg.getHostByDataSource((DataSource)dataSource);
Optional<OsAccount> optional = accountMgr.getWindowsOsAccount(sid, null, null, host); Optional<OsAccount> optional = accountMgr.getWindowsOsAccount(sid, null, null, host);
OsAccount osAccount; OsAccount osAccount;
if (!optional.isPresent()) { if (!optional.isPresent()) {
osAccount = accountMgr.createWindowsOsAccount(sid, userName != null && userName.isEmpty() ? null : userName, null, host, OsAccountRealm.RealmScope.UNKNOWN); osAccount = accountMgr.newWindowsOsAccount(sid, userName != null && userName.isEmpty() ? null : userName, null, host, OsAccountRealm.RealmScope.UNKNOWN);
accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); accountMgr.newOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED);
} else { } else {
osAccount = optional.get(); osAccount = optional.get();
if (userName != null && !userName.isEmpty()) { if (userName != null && !userName.isEmpty()) {