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 available 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.
 Collection<org.jtheque.utils.bean.Version> getKernelVersions()
          Return the list of available versions on internet.
 org.jtheque.utils.bean.Version getMostRecentVersion(Object object)
          Return the most recent version of the object.
 Collection<Updatable> getUpdatables()
          Return all the updatable.
 Collection<org.jtheque.utils.bean.Version> getVersions(Object object)
          Return all the versions of the object.
 void init()
          Init the manager.
 InstallationResult install(String versionFileURL)
          Install a module from a versions file.
 boolean isCurrentVersionUpToDate()
          Indicate if the current version is the last version.
 boolean isUpToDate(Object object)
          Test if a object is up to date or if there is a most recent version on update site.
 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
close, getErrorManager, getListeners, getLogger, getManager, getMessage, getMessage, getStates, preInit
 
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

init

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

Specified by:
init in interface IManager
Overrides:
init in class AbstractManager

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(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 Collection<org.jtheque.utils.bean.Version> getKernelVersions()
Description copied from interface: IUpdateManager
Return the list of available versions on internet.

Specified by:
getKernelVersions in interface IUpdateManager
Returns:
The available 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 current version is the last version.

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

isUpToDate

public boolean isUpToDate(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.

getMostRecentVersion

public org.jtheque.utils.bean.Version getMostRecentVersion(Object object)
Description copied from interface: IUpdateManager
Return the most recent version of the object.

Specified by:
getMostRecentVersion in interface IUpdateManager
Parameters:
object - The object. It can be the Core, a module or an updatable.
Returns:
The most recent version of the object.

getVersions

public Collection<org.jtheque.utils.bean.Version> getVersions(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 Collection<Updatable> getUpdatables()
Description copied from interface: IUpdateManager
Return all the updatable.

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

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 updatable 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 © 2010 JTheque. All Rights Reserved.