Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CoordinationServiceUtils.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 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.casemodule.multiusercases;
20 
21 import java.nio.file.Path;
22 import java.nio.file.Paths;
24 
28 public final class CoordinationServiceUtils {
29 
30  private static final String CASE_AUTO_INGEST_LOG_NAME = "AUTO_INGEST_LOG.TXT"; //NON-NLS
31  private static final String RESOURCES_LOCK_SUFFIX = "_RESOURCES"; //NON-NLS
32 
41  public static String getCaseResourcesNodePath(Path caseDirectoryPath) {
42  return caseDirectoryPath + RESOURCES_LOCK_SUFFIX;
43  }
44 
54  public static String getCaseAutoIngestLogNodePath(Path caseDirectoryPath) {
55  return Paths.get(caseDirectoryPath.toString(), CASE_AUTO_INGEST_LOG_NAME).toString();
56  }
57 
67  public static String getCaseDirectoryNodePath(Path caseDirectoryPath) {
68  return caseDirectoryPath.toString();
69  }
70 
80  public static String getCaseNameNodePath(Path caseDirectoryPath) {
81  String caseName = caseDirectoryPath.getFileName().toString();
82  if (TimeStampUtils.endsWithTimeStamp(caseName)) {
83  caseName = TimeStampUtils.removeTimeStamp(caseName);
84  if (caseName.endsWith("_")) {
85  caseName = caseName.substring(0, caseName.length() - 1);
86  }
87  }
88  return caseName;
89  }
90 
99  public static boolean isCaseAutoIngestLogNodePath(String nodePath) {
100  return Paths.get(nodePath).getFileName().toString().equals(CASE_AUTO_INGEST_LOG_NAME);
101  }
102 
111  public static boolean isCaseResourcesNodePath(String nodePath) {
112  return Paths.get(nodePath).getFileName().toString().endsWith(RESOURCES_LOCK_SUFFIX);
113  }
114 
123  public static boolean isCaseNameNodePath(String nodePath) {
124  return !(nodePath.contains("\\") || nodePath.contains("//"));
125  }
126 
131  }
132 
133 }
static String removeTimeStamp(String inputString)
static boolean endsWithTimeStamp(String inputString)

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.