From 892570d96cdfaf4779c1e92c89d76dabf78be361 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 01 Jul 2011 17:47:28 -0400
Subject: [PATCH] Documentation. Adding JavaDoc comments. Adjustments to method names.
---
src/com/gitblit/FileSettings.java | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/com/gitblit/FileSettings.java b/src/com/gitblit/FileSettings.java
index 1e65422..56aac8b 100644
--- a/src/com/gitblit/FileSettings.java
+++ b/src/com/gitblit/FileSettings.java
@@ -21,7 +21,10 @@
import java.util.Properties;
/**
- * Reads GitBlit settings file.
+ * Dynamically loads and reloads a properties file by keeping track of the last
+ * modification date.
+ *
+ * @author James Moger
*
*/
public class FileSettings extends IStoredSettings {
@@ -30,16 +33,20 @@
private final Properties properties = new Properties();
- private volatile long lastread;
+ private volatile long lastModified;
public FileSettings(String file) {
super(FileSettings.class);
this.propertiesFile = new File(file);
}
+ /**
+ * Returns a properties object which contains the most recent contents of
+ * the properties file.
+ */
@Override
protected synchronized Properties read() {
- if (propertiesFile.exists() && (propertiesFile.lastModified() > lastread)) {
+ if (propertiesFile.exists() && (propertiesFile.lastModified() > lastModified)) {
FileInputStream is = null;
try {
Properties props = new Properties();
@@ -49,7 +56,7 @@
// load properties after we have successfully read file
properties.clear();
properties.putAll(props);
- lastread = propertiesFile.lastModified();
+ lastModified = propertiesFile.lastModified();
} catch (FileNotFoundException f) {
// IGNORE - won't happen because file.exists() check above
} catch (Throwable t) {
@@ -67,8 +74,11 @@
return properties;
}
- protected long lastRead() {
- return lastread;
+ /**
+ * @return the last modification date of the properties file
+ */
+ protected long lastModified() {
+ return lastModified;
}
@Override
--
Gitblit v1.9.1