Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TypesSummary.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 - 2020 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.autopsy.datasourcesummary.datamodel;
20 
22 import java.sql.SQLException;
23 import java.util.Arrays;
24 import java.util.HashSet;
25 import java.util.Set;
29 import org.sleuthkit.datamodel.AbstractFile;
30 import org.sleuthkit.datamodel.DataSource;
31 import org.sleuthkit.datamodel.TskCoreException;
32 import org.sleuthkit.datamodel.TskData;
33 
37 public class TypesSummary implements DefaultUpdateGovernor {
38 
39  private static final Set<IngestManager.IngestJobEvent> INGEST_JOB_EVENTS = new HashSet<>(
41 
43 
47  public TypesSummary() {
49  }
50 
57  this.provider = provider;
58  }
59 
60  @Override
61  public boolean isRefreshRequired(ModuleContentEvent evt) {
62  return true;
63  }
64 
65  @Override
66  public boolean isRefreshRequired(AbstractFile file) {
67  return true;
68  }
69 
70  @Override
72  return (evt != null && INGEST_JOB_EVENTS.contains(evt));
73  }
74 
75  @Override
77  return INGEST_JOB_EVENTS;
78  }
79 
91  public Long getCountOfFiles(DataSource currentDataSource)
92  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
93  return DataSourceInfoUtilities.getCountOfRegularFiles(
94  provider.get(),
95  currentDataSource,
96  null
97  );
98  }
99 
111  public Long getCountOfAllocatedFiles(DataSource currentDataSource)
112  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
113 
114  return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
115  DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.ALLOC));
116  }
117 
129  public Long getCountOfUnallocatedFiles(DataSource currentDataSource)
130  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
131 
132  return DataSourceInfoUtilities.getCountOfRegNonSlackFiles(provider.get(), currentDataSource,
133  DataSourceInfoUtilities.getMetaFlagsContainsStatement(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC));
134  }
135 
147  public Long getCountOfDirectories(DataSource currentDataSource)
148  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
149 
150  return DataSourceInfoUtilities.getCountOfTskFiles(provider.get(), currentDataSource,
151  "meta_type=" + TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()
152  + " AND type<>" + TskData.TSK_DB_FILES_TYPE_ENUM.VIRTUAL_DIR.getFileType());
153  }
154 
166  public Long getCountOfSlackFiles(DataSource currentDataSource)
167  throws SleuthkitCaseProvider.SleuthkitCaseProviderException, TskCoreException, SQLException {
168 
169  return DataSourceInfoUtilities.getCountOfRegularFiles(provider.get(), currentDataSource,
170  "type=" + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.getFileType());
171  }
172 }
boolean isRefreshRequired(IngestManager.IngestJobEvent evt)
Set< IngestManager.IngestJobEvent > getIngestJobEventUpdates()
static final Set< IngestManager.IngestJobEvent > INGEST_JOB_EVENTS

Copyright © 2012-2021 Basis Technology. Generated on: Fri Aug 6 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.