Autopsy  4.18.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GetRootDirectoryVisitor.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012 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.ingest;
20 
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import org.sleuthkit.datamodel.AbstractFile;
24 import org.sleuthkit.datamodel.BlackboardArtifact;
25 import org.sleuthkit.datamodel.DerivedFile;
26 import org.sleuthkit.datamodel.Directory;
27 import org.sleuthkit.datamodel.File;
28 import org.sleuthkit.datamodel.FileSystem;
29 import org.sleuthkit.datamodel.LayoutFile;
30 import org.sleuthkit.datamodel.LocalFile;
31 import org.sleuthkit.datamodel.LocalDirectory;
32 import org.sleuthkit.datamodel.OsAccount;
33 import org.sleuthkit.datamodel.SlackFile;
34 import org.sleuthkit.datamodel.UnsupportedContent;
35 import org.sleuthkit.datamodel.VirtualDirectory;
36 
41 final class GetRootDirectoryVisitor extends GetFilesContentVisitor {
42 
43  @Override
44  public Collection<AbstractFile> visit(VirtualDirectory ld) {
45  //case when we hit a layout directory or local file container, not under a real FS
46  //or when root virt dir is scheduled
47  Collection<AbstractFile> ret = new ArrayList<>();
48  ret.add(ld);
49  return ret;
50  }
51 
52  @Override
53  public Collection<AbstractFile> visit(LocalDirectory ld) {
54  //case when we hit a local directory
55  Collection<AbstractFile> ret = new ArrayList<>();
56  ret.add(ld);
57  return ret;
58  }
59 
60  @Override
61  public Collection<AbstractFile> visit(LayoutFile lf) {
62  //case when we hit a layout file, not under a real FS
63  Collection<AbstractFile> ret = new ArrayList<>();
64  ret.add(lf);
65  return ret;
66  }
67 
68  @Override
69  public Collection<AbstractFile> visit(Directory drctr) {
70  //we hit a real directory, a child of real FS
71  Collection<AbstractFile> ret = new ArrayList<>();
72  ret.add(drctr);
73  return ret;
74  }
75 
76  @Override
77  public Collection<AbstractFile> visit(FileSystem fs) {
78  return getAllFromChildren(fs);
79  }
80 
81  @Override
82  public Collection<AbstractFile> visit(File file) {
83  //can have derived files
84  return getAllFromChildren(file);
85  }
86 
87  @Override
88  public Collection<AbstractFile> visit(DerivedFile derivedFile) {
89  //can have derived files
90  //TODO test this and overall scheduler with derived files
91  return getAllFromChildren(derivedFile);
92  }
93 
94  @Override
95  public Collection<AbstractFile> visit(LocalFile localFile) {
96  //can have local files
97  //TODO test this and overall scheduler with local files
98  return getAllFromChildren(localFile);
99  }
100 
101  @Override
102  public Collection<AbstractFile> visit(SlackFile slackFile) {
103  //can have slack files
104  //TODO test this and overall scheduler with local files
105  return getAllFromChildren(slackFile);
106  }
107 
108  @Override
109  public Collection<AbstractFile> visit(BlackboardArtifact art) {
110  return getAllFromChildren(art);
111  }
112 
113  @Override
114  public Collection<AbstractFile> visit(OsAccount art) {
115  return getAllFromChildren(art);
116  }
117 
118  @Override
119  public Collection<AbstractFile> visit(UnsupportedContent uc) {
120  return getAllFromChildren(uc);
121  }
122 }

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