org.jtheque.core.managers.update
Class UpdateManager

java.lang.Object
  extended by org.jtheque.core.managers.AbstractManager
      extended by org.jtheque.core.managers.update.UpdateManager
All Implemented Interfaces:
IManager, IUpdateManager

public final class UpdateManager
extends AbstractManager
implements IUpdateManager

Manage the update of the application. This class can go on internet to verify if a more recent version of JTheque is avaible and download one new version if there is one.

Author:
Baptiste Wicht

Constructor Summary
UpdateManager()
          Private constructor, the instance of the class is accessible by getInstance() method.
 
Method Summary
 void addUpdatableListener(UpdatableListener listener)
          Add an updatable listener.
 void close()
          Close the manager.
 void displayVersionWhenLoaded(java.lang.Object object, javax.swing.JLabel label)
          Display the version of the object when we've loaded the version's file.
 java.util.List<org.jtheque.utils.bean.Version> getKernelVersions()
          Return the list of availables versions on internet.
 java.util.List<Updatable> getUpdatables()
          Return all the updatables.
 java.util.List<org.jtheque.utils.bean.Version> getVersions(java.lang.Object object)
          Return all the versions of the object.
 void init()
          Init the manager.
 InstallationResult install(java.lang.String versionFileURL)
          Install a module from a versions file.
 boolean isCurrentVersionUpToDate()
          Indicate if the currrent version is the last version.
 boolean isUpToDate(java.lang.Object object)
          Test if a object is up to date or if there is a most recent version on update site.
 void preInit()
          Pre-init the manager.
 void registerUpdatable(Updatable updatable)
          Register a new updatable.
 void removeUpdatableListener(UpdatableListener listener)
          Remove an updatable listener.
 void setVersionsLoader(IVersionsLoader versionsLoader)
          Set the versions loader.
 void update(ModuleContainer module, org.jtheque.utils.bean.Version version)
          Update the module.
 void update(Updatable updatable, org.jtheque.utils.bean.Version versionToDownload)
          Update the updatable with specific version.
 void update(org.jtheque.utils.bean.Version versionToDownload)
          Update JTheque.
 void updateToMostRecentVersion(ModuleContainer module)
          Update the module to the most recent available version.
 void verifyingUpdate()
          Verify if there is a new update available and if the user want to update the application.
 
Methods inherited from class org.jtheque.core.managers.AbstractManager
getErrors, getListeners, getLogger, getMessage, getMessage, getStates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateManager

public UpdateManager()
Private constructor, the instance of the class is accessible by getInstance() method.

Method Detail

preInit

public void preInit()
Description copied from interface: IManager
Pre-init the manager. This operation is called before modules preplug.

Specified by:
preInit in interface IManager

close

public void close()
Description copied from interface: IManager
Close the manager.

Specified by:
close in interface IManager

init

public void init()
Description copied from interface: IManager
Init the manager. This operation is called after modules preplug but before module plug.

Specified by:
init in interface IManager

update

public void update(Updatable updatable,
                   org.jtheque.utils.bean.Version versionToDownload)
Description copied from interface: IUpdateManager
Update the updatable with specific version.

Specified by:
update in interface IUpdateManager
Parameters:
updatable - The updatable to update.
versionToDownload - The version to apply.

update

public void update(org.jtheque.utils.bean.Version versionToDownload)
Description copied from interface: IUpdateManager
Update JTheque. This method search on internet the datas of the version we want to download and download all the files useful and update the local files. Last, we reboot the program.

Specified by:
update in interface IUpdateManager
Parameters:
versionToDownload - The version we want to download

install

public InstallationResult install(java.lang.String versionFileURL)
Description copied from interface: IUpdateManager
Install a module from a versions file.

Specified by:
install in interface IUpdateManager
Parameters:
versionFileURL - The URL to the version file.
Returns:
The result of the installation.

update

public void update(ModuleContainer module,
                   org.jtheque.utils.bean.Version version)
Description copied from interface: IUpdateManager
Update the module.

Specified by:
update in interface IUpdateManager
Parameters:
module - The module to update.
version - The current version.

getKernelVersions

public java.util.List<org.jtheque.utils.bean.Version> getKernelVersions()
Description copied from interface: IUpdateManager
Return the list of availables versions on internet.

Specified by:
getKernelVersions in interface IUpdateManager
Returns:
The availables versions

verifyingUpdate

public void verifyingUpdate()
Description copied from interface: IUpdateManager
Verify if there is a new update available and if the user want to update the application.

Specified by:
verifyingUpdate in interface IUpdateManager

isCurrentVersionUpToDate

public boolean isCurrentVersionUpToDate()
Description copied from interface: IUpdateManager
Indicate if the currrent version is the last version.

Specified by:
isCurrentVersionUpToDate in interface IUpdateManager
Returns:
true if we've the last version, else false

displayVersionWhenLoaded

public void displayVersionWhenLoaded(java.lang.Object object,
                                     javax.swing.JLabel label)
Description copied from interface: IUpdateManager
Display the version of the object when we've loaded the version's file.

Specified by:
displayVersionWhenLoaded in interface IUpdateManager
Parameters:
object - The object to get the versions.
label - The label to display the version to.

isUpToDate

public boolean isUpToDate(java.lang.Object object)
Description copied from interface: IUpdateManager
Test if a object is up to date or if there is a most recent version on update site.

Specified by:
isUpToDate in interface IUpdateManager
Parameters:
object - The object to test.
Returns:
true if the module is up to date else false.

updateToMostRecentVersion

public void updateToMostRecentVersion(ModuleContainer module)
Description copied from interface: IUpdateManager
Update the module to the most recent available version.

Specified by:
updateToMostRecentVersion in interface IUpdateManager
Parameters:
module - The module to update.

getVersions

public java.util.List<org.jtheque.utils.bean.Version> getVersions(java.lang.Object object)
Description copied from interface: IUpdateManager
Return all the versions of the object.

Specified by:
getVersions in interface IUpdateManager
Parameters:
object - The object to get the versions for.
Returns:
A List containing all the versions of the updatable.

registerUpdatable

public void registerUpdatable(Updatable updatable)
Description copied from interface: IUpdateManager
Register a new updatable.

Specified by:
registerUpdatable in interface IUpdateManager
Parameters:
updatable - The updatable to register.

getUpdatables

public java.util.List<Updatable> getUpdatables()
Description copied from interface: IUpdateManager
Return all the updatables.

Specified by:
getUpdatables in interface IUpdateManager
Returns:
A List containing all the updatables

addUpdatableListener

public void addUpdatableListener(UpdatableListener listener)
Description copied from interface: IUpdateManager
Add an updatable listener.

Specified by:
addUpdatableListener in interface IUpdateManager
Parameters:
listener - The listener to add.

removeUpdatableListener

public void removeUpdatableListener(UpdatableListener listener)
Description copied from interface: IUpdateManager
Remove an updatable listener.

Specified by:
removeUpdatableListener in interface IUpdateManager
Parameters:
listener - The updatatable listener to remove.

setVersionsLoader

public void setVersionsLoader(IVersionsLoader versionsLoader)
Set the versions loader. This is not for use, this is only for Spring injection.

Parameters:
versionsLoader - The versions loader implementation.


Copyright © 2009 JTheque. All Rights Reserved.