* {@inheritDoc}
*/
@Override
- public void updateFound(Version version, long releaseTime) {
- coreListenerManager.fireUpdateFound(version, releaseTime);
+ public void updateFound(Version version, long releaseTime, long latestEdition) {
+ coreListenerManager.fireUpdateFound(version, releaseTime, latestEdition);
}
}
* The version that was found
* @param releaseTime
* The release time of the new version
+ * @param latestEdition
+ * The latest edition of the Sone homepage
*/
- public void updateFound(Version version, long releaseTime);
+ public void updateFound(Version version, long releaseTime, long latestEdition);
}
/**
* Notifies all listeners that a new version was found.
*
- * @see CoreListener#updateFound(Version, long)
+ * @see CoreListener#updateFound(Version, long, long)
* @param version
* The new version
* @param releaseTime
* The release time of the new version
+ * @param latestEdition
+ * The latest edition of the Sone homepage
*/
- void fireUpdateFound(Version version, long releaseTime) {
+ void fireUpdateFound(Version version, long releaseTime, long latestEdition) {
for (CoreListener coreListener : getListeners()) {
- coreListener.updateFound(version, releaseTime);
+ coreListener.updateFound(version, releaseTime, latestEdition);
}
}
/** The current URI of the homepage. */
private FreenetURI currentUri;
+ /** The latest known edition. */
+ private long latestEdition;
+
/** The current latest known version. */
private Version currentLatestVersion = SonePlugin.VERSION;
return latestVersionDate;
}
+ /**
+ * Returns the latest known edition of the Sone homepage.
+ *
+ * @return The latest edition of the Sone homepage
+ */
+ public long getLatestEdition() {
+ return latestEdition;
+ }
+
//
// ACTIONS
//
}
Bucket resultBucket = uriResult.getRight().asBucket();
try {
- parseProperties(resultBucket.getInputStream());
+ parseProperties(resultBucket.getInputStream(), edition);
+ latestEdition = edition;
} catch (IOException ioe1) {
logger.log(Level.WARNING, "Could not parse sone.properties of " + uri, ioe1);
} finally {
* Parses the properties of the latest version and fires events, if
* necessary.
*
- * @see UpdateListener#updateFound(Version, long)
- * @see UpdateListenerManager#fireUpdateFound(Version, long)
+ * @see UpdateListener#updateFound(Version, long, long)
+ * @see UpdateListenerManager#fireUpdateFound(Version, long, long)
* @param propertiesInputStream
* The input stream to parse
+ * @param edition
+ * The latest edition of the Sone homepage
* @throws IOException
* if an I/O error occured
*/
- private void parseProperties(InputStream propertiesInputStream) throws IOException {
+ private void parseProperties(InputStream propertiesInputStream, long edition) throws IOException {
Properties properties = new Properties();
InputStreamReader inputStreamReader = null;
try {
currentLatestVersion = version;
latestVersionDate = releaseTime;
logger.log(Level.INFO, "Found new version: %s (%tc)", new Object[] { version, new Date(releaseTime) });
- updateListenerManager.fireUpdateFound(version, releaseTime);
+ updateListenerManager.fireUpdateFound(version, releaseTime, edition);
}
}
* The version that was found
* @param releaseTime
* The release time of the version
+ * @param latestEdition
+ * The latest edition of the Sone homepage
*/
- public void updateFound(Version version, long releaseTime);
+ public void updateFound(Version version, long releaseTime, long latestEdition);
}
* The new version
* @param releaseTime
* The release time of the new version
+ * @param latestEdition
+ * The latest edition of the Sone homepage
*/
- void fireUpdateFound(Version version, long releaseTime) {
+ void fireUpdateFound(Version version, long releaseTime, long latestEdition) {
for (UpdateListener updateListener : getListeners()) {
- updateListener.updateFound(version, releaseTime);
+ updateListener.updateFound(version, releaseTime, latestEdition);
}
}
templateContext.set("request", request);
templateContext.set("currentVersion", SonePlugin.VERSION);
templateContext.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion());
+ templateContext.set("latestEdition", webInterface.getCore().getUpdateChecker().getLatestEdition());
templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion());
templateContext.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate());
}
* {@inheritDoc}
*/
@Override
- public void updateFound(Version version, long releaseTime) {
+ public void updateFound(Version version, long releaseTime, long latestEdition) {
newVersionNotification.getTemplateContext().set("version", version);
newVersionNotification.getTemplateContext().set("releaseTime", releaseTime);
notificationManager.addNotification(newVersionNotification);