Gridarta Editor
net.sf.gridarta.updater.Updater Class Reference

This class handles updating the map editor. More...

+ Inheritance diagram for net.sf.gridarta.updater.Updater:
+ Collaboration diagram for net.sf.gridarta.updater.Updater:

Classes

class  VersionInfo
 Class for holding version information and quickly comparing it. More...
 

Public Member Functions

void run ()
 
 Updater (@Nullable final Component parentComponent, @NotNull final Exiter exiter, @NotNull final String updateFileName)
 Create a new instance. More...
 

Static Public Attributes

static final String LAST_UPDATE_KEY = "UpdateTimestamp"
 Preferences key for last update. More...
 

Private Member Functions

boolean askIfUserWantsUpdate (@Nullable final VersionInfo active, @NotNull final VersionInfo update, @NotNull final String propUrl, @NotNull final String downloadUrl)
 Ask the user whether he wants to update. More...
 
void downloadAndInstallUpdate (@NotNull final String url)
 Download and install an update. More...
 
void noNewUpdate (@Nullable final VersionInfo active, @NotNull final VersionInfo update, @NotNull final String propUrl, @NotNull final String downloadUrl)
 Tell the user there is no update. More...
 
InputStream openStream (@NotNull final String url) throws IOException
 Opens an InputStream on a URL. More...
 

Private Attributes

final Exiter exiter
 The Exiter for terminating the application. More...
 
final Component parentComponent
 The parentComponent to show dialogs on. More...
 
final String updateFileName
 The file to update. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 Action Builder to create Actions. More...
 
static final int BUF_SIZE = 4096
 Buffer size. More...
 
static final Category LOG = Logger.getLogger(Updater.class)
 Logger. More...
 
static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class)
 Preferences. More...
 

Detailed Description

This class handles updating the map editor.

Author
Christian.Hujer the updater fails on windows, the user is notified of this but still it isn't nice. The updater should be a separate application.
Todo:
move the updater to JAPI

Definition at line 58 of file Updater.java.

Constructor & Destructor Documentation

◆ Updater()

net.sf.gridarta.updater.Updater.Updater ( @Nullable final Component  parentComponent,
@NotNull final Exiter  exiter,
@NotNull final String  updateFileName 
)

Create a new instance.

Parameters
parentComponentthe parent component to show dialogs on
exiterthe exiter for terminating the application
updateFileNamethe file to update

Definition at line 113 of file Updater.java.

References net.sf.gridarta.updater.Updater.exiter, net.sf.gridarta.updater.Updater.parentComponent, and net.sf.gridarta.updater.Updater.updateFileName.

Member Function Documentation

◆ askIfUserWantsUpdate()

boolean net.sf.gridarta.updater.Updater.askIfUserWantsUpdate ( @Nullable final VersionInfo  active,
@NotNull final VersionInfo  update,
@NotNull final String  propUrl,
@NotNull final String  downloadUrl 
)
private

Ask the user whether he wants to update.

Parameters
activeVersionInfo of currently installed version
updateVersionInfo of available update version
propUrlURL where properties were downloaded from
downloadUrlURL where the update would be downloaded from
Returns
true
if the user chose that he wants to update, otherwise
false

Definition at line 173 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.run().

+ Here is the caller graph for this function:

◆ downloadAndInstallUpdate()

void net.sf.gridarta.updater.Updater.downloadAndInstallUpdate ( @NotNull final String  url)
private

Download and install an update.

Parameters
urlURL to get update from

Definition at line 192 of file Updater.java.

References net.sf.gridarta.updater.Updater.BUF_SIZE, net.sf.gridarta.utils.Exiter.doExit(), and net.sf.gridarta.updater.Updater.openStream().

Referenced by net.sf.gridarta.updater.Updater.run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noNewUpdate()

void net.sf.gridarta.updater.Updater.noNewUpdate ( @Nullable final VersionInfo  active,
@NotNull final VersionInfo  update,
@NotNull final String  propUrl,
@NotNull final String  downloadUrl 
)
private

Tell the user there is no update.

Parameters
activeVersionInfo of currently installed version
updateVersionInfo of available update version
propUrlURL where properties were downloaded from
downloadUrlURL where the update would be downloaded from

Definition at line 184 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.run().

+ Here is the caller graph for this function:

◆ openStream()

InputStream net.sf.gridarta.updater.Updater.openStream ( @NotNull final String  url) throws IOException
private

Opens an InputStream on a URL.

Parameters
urlthe URL to open InputStream on
Returns
the InputStream for URL
Exceptions
IOExceptionin case of I/O problems

Definition at line 235 of file Updater.java.

References net.sf.gridarta.gui.dialog.prefs.NetPreferences.getProxy(), and net.sf.gridarta.utils.ActionBuilderUtils.getString().

Referenced by net.sf.gridarta.updater.Updater.downloadAndInstallUpdate(), and net.sf.gridarta.updater.Updater.run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.updater.Updater.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

Action Builder to create Actions.

Definition at line 64 of file Updater.java.

◆ BUF_SIZE

final int net.sf.gridarta.updater.Updater.BUF_SIZE = 4096
staticprivate

Buffer size.

Definition at line 105 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.downloadAndInstallUpdate().

◆ exiter

final Exiter net.sf.gridarta.updater.Updater.exiter
private

The Exiter for terminating the application.

Definition at line 94 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.Updater().

◆ LAST_UPDATE_KEY

final String net.sf.gridarta.updater.Updater.LAST_UPDATE_KEY = "UpdateTimestamp"
static

Preferences key for last update.

Definition at line 82 of file Updater.java.

Referenced by net.sf.gridarta.updater.UpdaterManager.startup().

◆ LOG

final Category net.sf.gridarta.updater.Updater.LOG = Logger.getLogger(Updater.class)
staticprivate

Logger.

Definition at line 70 of file Updater.java.

◆ parentComponent

final Component net.sf.gridarta.updater.Updater.parentComponent
private

The parentComponent to show dialogs on.

Definition at line 88 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.Updater().

◆ PREFERENCES

final Preferences net.sf.gridarta.updater.Updater.PREFERENCES = Preferences.userNodeForPackage(MainControl.class)
staticprivate

Preferences.

Definition at line 76 of file Updater.java.

◆ updateFileName

final String net.sf.gridarta.updater.Updater.updateFileName
private

The file to update.

Definition at line 100 of file Updater.java.

Referenced by net.sf.gridarta.updater.Updater.Updater().


The documentation for this class was generated from the following file: