コード例 #1
0
 /** @return */
 @JavaScriptMethod
 public String applyUpdates() {
   try {
     libraryManager.triggerReload();
     return "Update of the Sauce Connect library was successful";
   } catch (Exception e) {
     logger.log(Level.WARNING, "Error Reloading plugin", e);
   }
   return "Failed to apply updates, please see application logs";
 }
コード例 #2
0
 /** @return */
 @JavaScriptMethod
 public String checkForUpdates() {
   try {
     boolean updateAvailable = libraryManager.checkForLaterVersion();
     return updateAvailable
         ? "<div>Updates to Sauce Connect are available</div>"
             + "<a href=\"#\" onclick=\"var progress = document.getElementById('progress');"
             + "progress.style.display = 'block';"
             + "plugin.applyUpdates(function(t) {"
             + "document.getElementById('msg').innerHTML = t.responseObject();"
             + "var progress = document.getElementById('progress');"
             + "progress.style.display = 'none';"
             + "})\">Update Sauce Connect<\\a>"
         : "No update required, Sauce Connect is up to date";
   } catch (Exception e) {
     logger.log(Level.WARNING, "Error checking for later version", e);
   }
   return "Failed to connect to Sauce OnDemand";
 }