Autopsy  4.7.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommonFilesNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2018 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.commonfilesearch;
20 
21 import java.util.List;
22 import org.openide.nodes.ChildFactory;
23 import org.openide.nodes.Children;
24 import org.openide.nodes.Node;
25 import org.openide.util.NbBundle;
26 import org.openide.util.lookup.Lookups;
30 
35 final public class CommonFilesNode extends DisplayableItemNode {
36 
37 
38  CommonFilesNode(CommonFilesMetadata metadataList) {
39  super(Children.create(new Md5NodeFactory(metadataList), true), Lookups.singleton(CommonFilesNode.class));
40  }
41 
42  @NbBundle.Messages({
43  "CommonFilesNode.getName.text=Common Files"})
44  @Override
45  public String getName() {
46  return Bundle.CommonFilesNode_getName_text();
47  }
48 
49  @Override
50  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
51  return visitor.visit(this);
52  }
53 
54  @Override
55  public boolean isLeafTypeNode() {
56  return false;
57  }
58 
59  @Override
60  public String getItemType() {
61  return getClass().getName();
62  }
63 
68  static class Md5NodeFactory extends ChildFactory<String> {
69 
74  private CommonFilesMetadata metadata;
75 
76  Md5NodeFactory(CommonFilesMetadata metadata) {
77  this.metadata = metadata;
78  }
79 
80  protected void removeNotify() {
81  metadata = null;
82  }
83 
84  @Override
85  protected Node createNodeForKey(String md5){
86  Md5Metadata metadata = this.metadata.getMetadataForMd5(md5);
87  return new Md5Node(metadata);
88  }
89 
90  @Override
91  protected boolean createKeys(List<String> list) {
92  list.addAll(this.metadata.getMetadata().keySet());
93  return true;
94  }
95  }
96 }

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