// EVENT LISTENER MANAGEMENT
//
+ /**
+ * Adds an update listener to the list of registered listeners.
+ *
+ * @param updateListener
+ * The update listener to add
+ */
public void addUpdateListener(UpdateListener updateListener) {
updateListeners.add(updateListener);
}
+ /**
+ * Removes the given listener from the list of registered listeners.
+ *
+ * @param updateListener
+ * The update listener to remove
+ */
public void removeUpdateListener(UpdateListener updateListener) {
updateListeners.remove(updateListener);
}
+ /**
+ * Notifies all listeners that a version was found.
+ *
+ * @param foundVersion
+ * The version that was found
+ * @param versionTimestamp
+ * The timestamp of the version
+ */
protected void fireUpdateFound(Version foundVersion, long versionTimestamp) {
for (UpdateListener updateListener : updateListeners) {
updateListener.foundUpdateData(foundVersion, versionTimestamp);
// ACTIONS
//
+ /**
+ * Starts the update checker.
+ */
public void start() {
new Thread(this).start();
}
+ /**
+ * Stops the update checker.
+ */
public void stop() {
synchronized (syncObject) {
shouldStop = true;
// PRIVATE METHODS
//
+ /**
+ * Returns whether the update checker should stop.
+ *
+ * @return <code>true</code> if the update checker should stop,
+ * <code>false</code> otherwise
+ */
private boolean shouldStop() {
synchronized (syncObject) {
return shouldStop;
}
}
+ /**
+ * Creates the URI of the update file for the given edition.
+ *
+ * @param edition
+ * The edition number
+ * @return The URI for the update file for the given edition
+ */
private String constructUpdateKey(int edition) {
return UPDATE_KEY + "/jSite/" + edition + "/jSite.properties";
}
// INTERFACE Runnable
//
+ /**
+ * {@inheritDoc}
+ */
public void run() {
Connection connection = freenetInterface.getConnection("jSite-" + ++counter + "-UpdateChecker");
try {
}
}
}
+
}