Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
RejTreeValueNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Copyright 2013 Willi Ballenthin
8  * Contact: willi.ballenthin <at> gmail <dot> com
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 package org.sleuthkit.autopsy.rejview;
23 
24 import com.williballenthin.rejistry.RegistryValue;
25 
26 import java.io.UnsupportedEncodingException;
27 import java.util.LinkedList;
28 import java.util.List;
29 import org.openide.util.NbBundle.Messages;
30 import java.util.logging.Level;
32 
33 @Messages({"RejTreeValueNode.defaultValueName.text=(Default)"})
37 public final class RejTreeValueNode implements RejTreeNode {
38 
39  private static final Logger logger = Logger.getLogger(RejTreeValueNode.class.getName());
40  static final String DEFAULT_VALUE_NAME = Bundle.RejTreeValueNode_defaultValueName_text();
41  private final RegistryValue value;
42 
43  public RejTreeValueNode(RegistryValue value) {
44  this.value = value;
45  }
46 
47  @Messages({"RejTreeValueNode.failureValueName.text=PARSE FAILED"})
48  @Override
49  public String toString() {
50  try {
51  String valueName = this.value.getName();
52  if (valueName.isEmpty()) {
53  return DEFAULT_VALUE_NAME;
54  }
55  return valueName;
56  } catch (UnsupportedEncodingException ex) {
57  logger.log(Level.WARNING, "Failed to parse _value name", ex);
58  return Bundle.RejTreeValueNode_failureValueName_text();
59  }
60  }
61 
62  @Override
63  public boolean hasChildren() {
64  return false;
65  }
66 
67  @Override
68  public List<RejTreeNode> getChildren() {
69  return new LinkedList<>();
70  }
71 
75  RegistryValue getValue() {
76  return this.value;
77  }
78 
79  @Override
81  return new RejTreeValueView(this);
82  }
83 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.