| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| IModuleManager |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.module; | |
| 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.core.managers.update.repository.ModuleDescription; | |
| 21 | import org.jtheque.core.managers.update.repository.Repository; | |
| 22 | ||
| 23 | import java.io.File; | |
| 24 | import java.util.Collection; | |
| 25 | ||
| 26 | /** | |
| 27 | * A module manager. It seems a manager who's responsible for loading and managing the different modules of the | |
| 28 | * application. | |
| 29 | * | |
| 30 | * @author Baptiste Wicht | |
| 31 | */ | |
| 32 | public interface IModuleManager { | |
| 33 | /** | |
| 34 | * Return all the modules. | |
| 35 | * | |
| 36 | * @return All the modules. | |
| 37 | */ | |
| 38 | Collection<ModuleContainer> getModules(); | |
| 39 | ||
| 40 | /** | |
| 41 | * Add a module listener. | |
| 42 | * | |
| 43 | * @param listener The listener to add. | |
| 44 | */ | |
| 45 | void addModuleListener(ModuleListener listener); | |
| 46 | ||
| 47 | /** | |
| 48 | * Remove a module listener. | |
| 49 | * | |
| 50 | * @param listener The listener to remove. | |
| 51 | */ | |
| 52 | void removeModuleListener(ModuleListener listener); | |
| 53 | ||
| 54 | /** | |
| 55 | * Return all the modules of the application repository. | |
| 56 | * | |
| 57 | * @return all the modules of the application repository. | |
| 58 | */ | |
| 59 | Collection<ModuleDescription> getModulesFromRepository(); | |
| 60 | ||
| 61 | /** | |
| 62 | * Return the repository of the application. | |
| 63 | * | |
| 64 | * @return The Repository. | |
| 65 | */ | |
| 66 | Repository getRepository(); | |
| 67 | ||
| 68 | /** | |
| 69 | * Test if the module is installed. | |
| 70 | * | |
| 71 | * @param module The module name. | |
| 72 | * @return true if the module is installed. | |
| 73 | */ | |
| 74 | boolean isInstalled(String module); | |
| 75 | ||
| 76 | /** | |
| 77 | * Return the module with the name. | |
| 78 | * | |
| 79 | * @param name The name of the module. | |
| 80 | * @return The module. | |
| 81 | */ | |
| 82 | ModuleContainer getModuleById(String name); | |
| 83 | ||
| 84 | /** | |
| 85 | * Install the module from the versions file. | |
| 86 | * | |
| 87 | * @param versionsFileURL The URL of the versions file. | |
| 88 | */ | |
| 89 | void install(String versionsFileURL); | |
| 90 | ||
| 91 | /** | |
| 92 | * Unplug the modules. | |
| 93 | */ | |
| 94 | void unplugModules(); | |
| 95 | ||
| 96 | /** | |
| 97 | * Enable a module. | |
| 98 | * | |
| 99 | * @param module The module to enable. | |
| 100 | */ | |
| 101 | void enableModule(ModuleContainer module); | |
| 102 | ||
| 103 | /** | |
| 104 | * Pre plug the modules. | |
| 105 | */ | |
| 106 | void prePlugModules(); | |
| 107 | ||
| 108 | /** | |
| 109 | * Plug the modules. | |
| 110 | */ | |
| 111 | void plugModules(); | |
| 112 | ||
| 113 | /** | |
| 114 | * Disable the module. | |
| 115 | * | |
| 116 | * @param module The module to disable. | |
| 117 | */ | |
| 118 | void disableModule(ModuleContainer module); | |
| 119 | ||
| 120 | /** | |
| 121 | * Install the module of the file. | |
| 122 | * | |
| 123 | * @param file The file of the module. | |
| 124 | * @return true if the module has been installed else false. | |
| 125 | */ | |
| 126 | boolean installModule(File file); | |
| 127 | ||
| 128 | /** | |
| 129 | * Uninstall the module. | |
| 130 | * | |
| 131 | * @param module The module to uninstall. | |
| 132 | */ | |
| 133 | void uninstallModule(ModuleContainer module); | |
| 134 | ||
| 135 | /** | |
| 136 | * Test if a module can ben launched. | |
| 137 | * | |
| 138 | * @param module The module to be launched. | |
| 139 | * @return The error message. If the error is empty, the module can be launched. | |
| 140 | */ | |
| 141 | String canModuleLaunched(ModuleContainer module); | |
| 142 | ||
| 143 | /** | |
| 144 | * Load the module. | |
| 145 | * | |
| 146 | * @param module The module to load. | |
| 147 | */ | |
| 148 | void loadModule(ModuleContainer module); | |
| 149 | ||
| 150 | /** | |
| 151 | * Indicate if the primary module is collection based. | |
| 152 | * | |
| 153 | * @return true if the primary module is collection based else false. | |
| 154 | */ | |
| 155 | boolean isCollectionModule(); | |
| 156 | ||
| 157 | /** | |
| 158 | * Plug the collection. | |
| 159 | * | |
| 160 | * @param collection The collection to use. | |
| 161 | * @param password The password of the collection. | |
| 162 | * @param create A boolean flag indicating if we must create the collection or not. | |
| 163 | * @return true if the process has been correctly made else false. | |
| 164 | */ | |
| 165 | boolean chooseCollection(String collection, String password, boolean create); | |
| 166 | ||
| 167 | /** | |
| 168 | * Plug the collection. | |
| 169 | */ | |
| 170 | void plugCollection(); | |
| 171 | } |