Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
ScheduledIngestPauseSettings.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014-2021 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 com.google.common.annotations.Beta;
22 import java.time.DayOfWeek;
23 import java.util.prefs.Preferences;
24 import org.openide.util.NbPreferences;
25 
34 @Beta
36 
37  /*
38  * These properties are stored in the core.properties file in the user's
39  * config\Preferences\org\sleuthkit\autopsy directory.
40  */
41  private static final Preferences preferences = NbPreferences.forModule(ScheduledIngestPauseSettings.class);
42  private static final String PAUSE_ENABLED_KEY = "IngestPauseEnabled";
43  private static final boolean DEFAULT_ENABLED_VALUE = false;
44  private static final String PAUSE_DAY_OF_WEEK_KEY = "IngestPauseDayOfWeek";
45  private static final String PAUSE_TIME_HOUR_KEY = "IngestPauseTimeHour";
46  private static final String PAUSE_TIME_MINUTES_KEY = "IngestPauseTimeMinutes";
47  private static final String PAUSE_DURATION_MINUTES_KEY = "IngestPauseDurationMinutes";
48  private static final int DEFAULT_TIME_VALUE = 0;
49  private static final int DEFAULT_PAUSE_DURATION_VALUE = 60;
50 
58  public static boolean getPauseEnabled() {
59  return preferences.getBoolean(PAUSE_ENABLED_KEY, DEFAULT_ENABLED_VALUE);
60  }
61 
69  public static void setPauseEnabled(boolean enabled) {
70  preferences.putBoolean(PAUSE_ENABLED_KEY, enabled);
71  }
72 
80  @Beta
81  public static DayOfWeek getPauseDayOfWeek() {
82  int dayOfWeek = preferences.getInt(PAUSE_DAY_OF_WEEK_KEY, DayOfWeek.SUNDAY.getValue());
83  return DayOfWeek.of(dayOfWeek);
84  }
85 
93  @Beta
94  public static void setPauseDayOfWeek(DayOfWeek dayOfWeek) {
95  preferences.putInt(PAUSE_DAY_OF_WEEK_KEY, dayOfWeek.getValue());
96  }
97 
106  @Beta
107  public static int getPauseStartTimeHour() {
108  return preferences.getInt(PAUSE_TIME_HOUR_KEY, DEFAULT_TIME_VALUE);
109  }
110 
119  @Beta
120  public static void setPauseStartTimeHour(int hour) {
121  if (hour < 0 || hour > 23) {
122  throw new IllegalArgumentException("hour must be 0-23");
123  }
124  preferences.putInt(PAUSE_TIME_HOUR_KEY, hour);
125  }
126 
135  @Beta
136  public static int getPauseStartTimeMinute() {
137  return preferences.getInt(PAUSE_TIME_MINUTES_KEY, DEFAULT_TIME_VALUE);
138  }
139 
148  @Beta
149  public static void setPauseStartTimeMinute(int timeInMinutes) {
150  if (timeInMinutes < 0 || timeInMinutes > 59) {
151  throw new IllegalArgumentException("timeInMinutes must be 0-59");
152  }
153  preferences.putInt(PAUSE_TIME_MINUTES_KEY, timeInMinutes);
154  }
155 
163  @Beta
164  public static int getPauseDurationMinutes() {
165  return preferences.getInt(PAUSE_DURATION_MINUTES_KEY, DEFAULT_PAUSE_DURATION_VALUE);
166  }
167 
175  @Beta
176  public static void setPauseDurationMinutes(int durationInMinutes) {
177  preferences.putInt(PAUSE_DURATION_MINUTES_KEY, durationInMinutes);
178  }
179 
183  @Beta
185  }
186 
187 }

Copyright © 2012-2022 Basis Technology. Generated on: Wed Oct 5 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.