19 package org.sleuthkit.autopsy.ingest;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
26 import java.io.IOException;
27 import java.util.logging.FileHandler;
28 import java.util.logging.Level;
29 import java.util.logging.SimpleFormatter;
31 import org.openide.util.NbBundle;
33 import javax.swing.Timer;
34 import org.openide.util.Exceptions;
47 private static final java.util.logging.Logger
MONITOR_LOGGER = java.util.logging.
Logger.getLogger(
"monitor");
54 final int MAX_LOG_FILES = 3;
57 monitorLogHandler.setFormatter(
new SimpleFormatter());
62 }
catch (IOException ex) {
63 Exceptions.printStackTrace(ex);
64 }
catch (SecurityException ex) {
65 Exceptions.printStackTrace(ex);
74 monitor =
new MonitorAction();
75 timer =
new Timer(INITIAL_INTERVAL_MS, monitor);
94 return timer != null && timer.isRunning();
102 long getFreeSpace() {
105 }
catch (SecurityException e) {
106 logger.log(Level.WARNING,
"Error checking for free disk space on ingest data drive", e);
124 public void propertyChange(PropertyChangeEvent evt) {
125 String changed = evt.getPropertyName();
126 Object newValue = evt.getNewValue();
129 if (newValue != null) {
145 while ((tempF = curDir.getParentFile()) != null) {
149 logger.log(Level.INFO,
"Monitoring disk space of case root: " + curDir.getAbsolutePath());
165 final String diskPath = root.getAbsolutePath();
166 MONITOR_LOGGER.log(Level.SEVERE,
"Stopping ingest due to low disk space on disk {0}", diskPath);
167 logger.log(Level.SEVERE,
"Stopping ingest due to low disk space on disk {0}", diskPath);
170 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
171 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
182 final long freeSpace = root.getFreeSpace();
184 if (freeSpace == 0) {
186 final String monitoredPath = root.getAbsolutePath();
187 if (monitoredPath.startsWith(
"\\\\") || monitoredPath.startsWith(
"//")) {
206 }
catch (SecurityException e) {
207 logger.log(Level.WARNING,
"Unable to check for free disk space (permission issue)", e);
211 if (freeSpace == DISK_FREE_SPACE_UNKNOWN) {
static synchronized IngestManager getInstance()
String getCaseDirectory()
boolean isIngestRunning()
Logger(String name, String resourceBundleName)
static final long MIN_FREE_DISK_SPACE
static final int DISK_FREE_SPACE_UNKNOWN
void actionPerformed(ActionEvent e)
void postMessage(final IngestMessage message)
static final int INITIAL_INTERVAL_MS
static synchronized void addPropertyChangeListener(PropertyChangeListener listener)
synchronized void cancelAllIngestJobs()
static Case getCurrentCase()
static Logger getLogger(String name)
static final java.util.logging.Logger MONITOR_LOGGER
static synchronized IngestServices getInstance()