Autopsy  4.6.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.SlackFile;
33 import org.sleuthkit.datamodel.VirtualDirectory;
34 
39 final class GetRootDirectoryVisitor extends GetFilesContentVisitor {
40 
41  @Override
42  public Collection<AbstractFile> visit(VirtualDirectory ld) {
43  //case when we hit a layout directory or local file container, not under a real FS
44  //or when root virt dir is scheduled
45  Collection<AbstractFile> ret = new ArrayList<>();
46  ret.add(ld);
47  return ret;
48  }
49 
50  @Override
51  public Collection<AbstractFile> visit(LocalDirectory ld) {
52  //case when we hit a local directory
53  Collection<AbstractFile> ret = new ArrayList<>();
54  ret.add(ld);
55  return ret;
56  }
57 
58  @Override
59  public Collection<AbstractFile> visit(LayoutFile lf) {
60  //case when we hit a layout file, not under a real FS
61  Collection<AbstractFile> ret = new ArrayList<>();
62  ret.add(lf);
63  return ret;
64  }
65 
66  @Override
67  public Collection<AbstractFile> visit(Directory drctr) {
68  //we hit a real directory, a child of real FS
69  Collection<AbstractFile> ret = new ArrayList<>();
70  ret.add(drctr);
71  return ret;
72  }
73 
74  @Override
75  public Collection<AbstractFile> visit(FileSystem fs) {
76  return getAllFromChildren(fs);
77  }
78 
79  @Override
80  public Collection<AbstractFile> visit(File file) {
81  //can have derived files
82  return getAllFromChildren(file);
83  }
84 
85  @Override
86  public Collection<AbstractFile> visit(DerivedFile derivedFile) {
87  //can have derived files
88  //TODO test this and overall scheduler with derived files
89  return getAllFromChildren(derivedFile);
90  }
91 
92  @Override
93  public Collection<AbstractFile> visit(LocalFile localFile) {
94  //can have local files
95  //TODO test this and overall scheduler with local files
96  return getAllFromChildren(localFile);
97  }
98 
99  @Override
100  public Collection<AbstractFile> visit(SlackFile slackFile) {
101  //can have slack files
102  //TODO test this and overall scheduler with local files
103  return getAllFromChildren(slackFile);
104  }
105 
106  @Override
107  public Collection<AbstractFile> visit(BlackboardArtifact art) {
108  return getAllFromChildren(art);
109  }
110 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.