Methods Summary |
---|
private void | downloadLatestVersion()
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, "Requesting latest SWT version "
+ "and url from version check client."));
Map reply = VersionCheckClient.getSingleton().getVersionCheckInfo(VersionCheckClient.REASON_CHECK_SWT);
String msg = "SWT version check received:";
byte[] version_bytes = (byte[])reply.get( "swt_version" );
if( version_bytes != null ) {
latestVersion = Integer.parseInt( new String( version_bytes ) );
msg += " version=" + latestVersion;
}
byte[] url_bytes = (byte[])reply.get( "swt_url" );
if( url_bytes != null ) {
mirrors = new String[] { new String( url_bytes ) };
msg += " url=" + mirrors[0];
}
byte[] info_bytes = (byte[])reply.get( "swt_info_url" );
if ( info_bytes != null ){
byte[] sig = (byte[])reply.get( "swt_info_sig" );
if ( sig == null ){
Logger.log( new LogEvent( LogIDs.LOGGER, "swt info signature check failed - missing signature" ));
}else{
try{
infoURL = new String( info_bytes );
try{
AEVerifier.verifyData( infoURL, sig );
}catch( Throwable e ){
Logger.log( new LogEvent( LogIDs.LOGGER, "swt info signature check failed", e ));
infoURL = null;
}
}catch ( Exception e ){
Logger.log(new LogEvent(LOGID, "swt info_url", e));
}
}
}
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, msg));
|
public int | getCurrentVersion()
return currentVersion;
|
public java.lang.String | getInfoURL()
return infoURL;
|
public int | getLatestVersion()
return latestVersion;
|
public java.lang.String[] | getMirrors()
return mirrors;
|
public java.lang.String | getPlatform()
return platform;
|
public boolean | needsUpdate()
try {
downloadLatestVersion();
String msg = "SWT: current version = " + currentVersion + ", latest version = " + latestVersion;
checker.reportProgress( msg );
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, msg));
return latestVersion > currentVersion;
} catch(Exception e) {
e.printStackTrace();
return false;
}
|