Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IUpdateManager |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.update; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jtheque.core.managers.module.beans.ModuleContainer; | |
20 | import org.jtheque.utils.bean.Version; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | /** | |
25 | * An update manager specification. | |
26 | * | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | public interface IUpdateManager { | |
30 | /** | |
31 | * Update JTheque. This method search on internet the datas of the version we want to download | |
32 | * and download all the files useful and update the local files. Last, we reboot the program. | |
33 | * | |
34 | * @param versionToDownload The version we want to download | |
35 | */ | |
36 | void update(Version versionToDownload); | |
37 | ||
38 | /** | |
39 | * Update the module. | |
40 | * | |
41 | * @param module The module to update. | |
42 | * @param version The current version. | |
43 | */ | |
44 | void update(ModuleContainer module, Version version); | |
45 | ||
46 | /** | |
47 | * Return the list of available versions on internet. | |
48 | * | |
49 | * @return The available versions | |
50 | */ | |
51 | Collection<Version> getKernelVersions(); | |
52 | ||
53 | /** | |
54 | * Verify if there is a new update available and if the user want to update the application. | |
55 | */ | |
56 | void verifyingUpdate(); | |
57 | ||
58 | /** | |
59 | * Indicate if the current version is the last version. | |
60 | * | |
61 | * @return true if we've the last version, else false | |
62 | */ | |
63 | boolean isCurrentVersionUpToDate(); | |
64 | ||
65 | /** | |
66 | * Test if a object is up to date or if there is a most recent version on update site. | |
67 | * | |
68 | * @param object The object to test. | |
69 | * @return true if the module is up to date else false. | |
70 | */ | |
71 | boolean isUpToDate(Object object); | |
72 | ||
73 | /** | |
74 | * Return all the versions of the object. | |
75 | * | |
76 | * @param object The object to get the versions for. | |
77 | * @return A List containing all the versions of the updatable. | |
78 | */ | |
79 | Collection<? extends Version> getVersions(Object object); | |
80 | ||
81 | /** | |
82 | * Install a module from a versions file. | |
83 | * | |
84 | * @param versionFileURL The URL to the version file. | |
85 | * @return The result of the installation. | |
86 | */ | |
87 | InstallationResult install(String versionFileURL); | |
88 | ||
89 | /** | |
90 | * Register a new updatable. | |
91 | * | |
92 | * @param updatable The updatable to register. | |
93 | */ | |
94 | void registerUpdatable(Updatable updatable); | |
95 | ||
96 | /** | |
97 | * Update the updatable with specific version. | |
98 | * | |
99 | * @param updatable The updatable to update. | |
100 | * @param versionToDownload The version to apply. | |
101 | */ | |
102 | void update(Updatable updatable, Version versionToDownload); | |
103 | ||
104 | /** | |
105 | * Return all the updatable. | |
106 | * | |
107 | * @return A List containing all the updatable. | |
108 | */ | |
109 | Collection<Updatable> getUpdatables(); | |
110 | ||
111 | /** | |
112 | * Add an updatable listener. | |
113 | * | |
114 | * @param listener The listener to add. | |
115 | */ | |
116 | void addUpdatableListener(UpdatableListener listener); | |
117 | ||
118 | /** | |
119 | * Remove an updatable listener. | |
120 | * | |
121 | * @param listener The updatable listener to remove. | |
122 | */ | |
123 | void removeUpdatableListener(UpdatableListener listener); | |
124 | ||
125 | /** | |
126 | * Update the module to the most recent available version. | |
127 | * | |
128 | * @param module The module to update. | |
129 | */ | |
130 | void updateToMostRecentVersion(ModuleContainer module); | |
131 | ||
132 | /** | |
133 | * Return the most recent version of the object. | |
134 | * | |
135 | * @param object The object. It can be the Core, a module or an updatable. | |
136 | * @return The most recent version of the object. | |
137 | */ | |
138 | Version getMostRecentVersion(Object object); | |
139 | } |