root / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.api / src / main / java / org / gvsig / installer / lib / api / InstallerManager.java @ 38578
History | View | Annotate | Download (12.9 KB)
1 | 32269 | jpiera | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | 33692 | cordinyana | *
|
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | */
|
||
22 | 32269 | jpiera | |
23 | /*
|
||
24 | 33692 | cordinyana | * AUTHORS (In addition to CIT):
|
25 | * 2010 {Prodevelop} {Task}
|
||
26 | */
|
||
27 | |||
28 | 32269 | jpiera | package org.gvsig.installer.lib.api; |
29 | |||
30 | 32562 | jpiera | import java.io.File; |
31 | 38578 | jjdelcerro | import java.io.IOException; |
32 | import java.io.InputStream; |
||
33 | 37489 | nfrancisco | import java.net.URL; |
34 | 33743 | cordinyana | import java.text.MessageFormat; |
35 | 37822 | nfrancisco | import java.util.List; |
36 | 32562 | jpiera | |
37 | 37169 | nfrancisco | import org.gvsig.installer.lib.api.creation.MakePackageService; |
38 | 32562 | jpiera | import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
39 | import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
||
40 | import org.gvsig.installer.lib.api.execution.InstallPackageService; |
||
41 | import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
||
42 | 38578 | jjdelcerro | import org.gvsig.tools.exception.BaseException; |
43 | 32400 | jpiera | import org.gvsig.tools.service.Manager; |
44 | 32269 | jpiera | |
45 | /**
|
||
46 | 32333 | jpiera | * <p>
|
47 | 33692 | cordinyana | * This manager is used to register and create the services that are used to
|
48 | * manage the creation and the execution of installers. An installer is a file
|
||
49 | * called <b>bundle</b> that is composed of a set <b>packages</b>.
|
||
50 | 32585 | jpiera | * </p>
|
51 | * <p>
|
||
52 | 33692 | cordinyana | * A package has some information that is defined by the {@link PackageInfo}
|
53 | * class and is composed of a set of attributes. One of these attributes, the
|
||
54 | * type, denotes if the package is a plugin, theme, translation, etc.
|
||
55 | * </p>
|
||
56 | 32585 | jpiera | * <p>
|
57 | 33692 | cordinyana | * In practice a bundle is just a compressed zip file that has a compressed zip
|
58 | * file for every package to install. The structure of a bundle file with two
|
||
59 | 32585 | jpiera | * packages of type plugin could be:
|
60 | * </p>
|
||
61 | 33692 | cordinyana | *
|
62 | 32585 | jpiera | * <pre>
|
63 | * - bundle (compressed file)
|
||
64 | * - org.gvsig.plugin1-1_0_0-23 (compressed file)
|
||
65 | * - org.gvsig.plugin1
|
||
66 | * - package.info
|
||
67 | * - org.gvsig.plugin2-2_0_1-35 (compressed file)
|
||
68 | * - org.gvsig.plugin1
|
||
69 | 33692 | cordinyana | * - package.info
|
70 | 32585 | jpiera | * </pre>
|
71 | * <p>
|
||
72 | 32597 | jpiera | * <b>bundle</b> is the compressed file that contains a zip entry for every
|
73 | 32585 | jpiera | * package to install. The name of the zip entry follows next pattern:
|
74 | * </p>
|
||
75 | 33692 | cordinyana | *
|
76 | 32585 | jpiera | * <pre>
|
77 | 33692 | cordinyana | * [package code]-[version]-[build]
|
78 | 32585 | jpiera | * </pre>
|
79 | * <p>
|
||
80 | 33692 | cordinyana | * Every zip entry contains a main folder inside that contains all the package
|
81 | * files that are used in the installation process. Depending of the type of
|
||
82 | * packages, the information inside this folder can be different, but all the
|
||
83 | * types of packages have to have the <b>package.info</b>file that has all the
|
||
84 | * package information. To see the <b>package.info</b> description see
|
||
85 | * {@link PackageInfo}.
|
||
86 | * <p>
|
||
87 | 32585 | jpiera | * </p>
|
88 | 33692 | cordinyana | * The services that offers this managers are basically two: the creation of
|
89 | * bundles for just one package of plugin type and a service for the
|
||
90 | 37599 | nfrancisco | * installation of packages from a bundle. </p>
|
91 | 32333 | jpiera | *
|
92 | 32269 | jpiera | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
93 | */
|
||
94 | 32400 | jpiera | public interface InstallerManager extends Manager { |
95 | 33686 | cordinyana | |
96 | 37599 | nfrancisco | /**
|
97 | * Package state default values.
|
||
98 | */
|
||
99 | public static interface STATE { |
||
100 | 33692 | cordinyana | |
101 | 37599 | nfrancisco | static final String DEVEL = "devel"; |
102 | static final String TESTING = "testing"; |
||
103 | static final String PILOT = "pilot"; |
||
104 | static final String PROTOTYPE = "prototype"; |
||
105 | static final String ALPHA = "alpha"; |
||
106 | static final String BETA = "beta"; |
||
107 | static final String RC = "RC"; |
||
108 | static final String FINAL = "final"; |
||
109 | } |
||
110 | 33686 | cordinyana | |
111 | 37599 | nfrancisco | /**
|
112 | * Supported operating system default values.
|
||
113 | */
|
||
114 | public static interface OS { |
||
115 | 33692 | cordinyana | |
116 | 37599 | nfrancisco | static final String ALL = "all"; |
117 | static final String LINUX = "lin"; |
||
118 | static final String WINDOWS = "win"; |
||
119 | static final String OSX_10_4 = "osx_10_4"; |
||
120 | static final String OSX_10_5 = "osx_10_5"; |
||
121 | static final String OSX_10_6 = "osx_10_6"; |
||
122 | } |
||
123 | 33686 | cordinyana | |
124 | 37599 | nfrancisco | /**
|
125 | * Supported architecture default values.
|
||
126 | */
|
||
127 | public static interface ARCH { |
||
128 | 33692 | cordinyana | |
129 | 37599 | nfrancisco | static final String ALL = "all"; |
130 | static final String X86 = "x86"; |
||
131 | static final String X86_64 = "x86_64"; |
||
132 | } |
||
133 | 33686 | cordinyana | |
134 | 37599 | nfrancisco | /**
|
135 | * Supported Java virtual machine version default values.
|
||
136 | */
|
||
137 | public static interface JVM { |
||
138 | 33692 | cordinyana | |
139 | 37599 | nfrancisco | static final String J1_5 = "j1_5"; |
140 | static final String J1_6 = "j1_6"; |
||
141 | } |
||
142 | 33686 | cordinyana | |
143 | 37599 | nfrancisco | /**
|
144 | * Fields into the bundle file name message format.
|
||
145 | *
|
||
146 | * @see InstallerManager#getPackageSetNameFormat()
|
||
147 | * @see InstallerManager#setPackageSetNameFormat(String)
|
||
148 | */
|
||
149 | public static interface PACKAGE_FILE_NAME_FIELDS { |
||
150 | 33743 | cordinyana | |
151 | 37599 | nfrancisco | static final int GVSIG_VERSION = 0; |
152 | static final int NAME = 1; |
||
153 | static final int VERSION = 2; |
||
154 | static final int BUILD = 3; |
||
155 | static final int STATE = 4; |
||
156 | static final int OS = 5; |
||
157 | static final int ARCH = 6; |
||
158 | static final int JVM = 7; |
||
159 | } |
||
160 | 33743 | cordinyana | |
161 | 37599 | nfrancisco | /**
|
162 | * It registers a class that implements the service for the creation of
|
||
163 | * bundle that contains inside a package of type plugin. The registered
|
||
164 | * class have to implement the {@link MakePluginPackageService} interface.
|
||
165 | *
|
||
166 | * @param clazz
|
||
167 | * class that implements the {@link MakePluginPackageService}
|
||
168 | * interface.
|
||
169 | */
|
||
170 | public void registerMakePluginPackageService( |
||
171 | Class<? extends MakePluginPackageService> clazz); |
||
172 | 33692 | cordinyana | |
173 | 37822 | nfrancisco | // /**
|
174 | // * It creates and returns an object that is used to create a bundle that
|
||
175 | // * contains inside a package of type plugin. All the parameters are set
|
||
176 | // * using the {@link MakePluginPackageService} interface. *
|
||
177 | // *
|
||
178 | // * @return an object that is used to create a plugin installer
|
||
179 | // * @throws MakePluginPackageServiceException
|
||
180 | // * when there is a problem creating the service
|
||
181 | // */
|
||
182 | // public MakePluginPackageService getMakePluginPackageService(
|
||
183 | // File pluginsDirectory) throws MakePluginPackageServiceException;
|
||
184 | |||
185 | 37599 | nfrancisco | /**
|
186 | * It creates and returns an object that is used to create a bundle that
|
||
187 | * contains inside a package of type plugin. All the parameters are set
|
||
188 | * using the {@link MakePluginPackageService} interface. *
|
||
189 | *
|
||
190 | * @return an object that is used to create a plugin installer
|
||
191 | * @throws MakePluginPackageServiceException
|
||
192 | 37822 | nfrancisco | * @throws MakePluginPackageServiceException
|
193 | 37599 | nfrancisco | * when there is a problem creating the service
|
194 | */
|
||
195 | 37822 | nfrancisco | public MakePluginPackageService getMakePluginPackageService()
|
196 | throws MakePluginPackageServiceException;
|
||
197 | 33692 | cordinyana | |
198 | 37599 | nfrancisco | /**
|
199 | * Returns a list of package infos for the already installed plugins.
|
||
200 | *
|
||
201 | * @param pluginsDirectory
|
||
202 | * where to look for the installed plugins
|
||
203 | * @return the list of package infos for the already installed plugins
|
||
204 | * @throws MakePluginPackageServiceException
|
||
205 | * if there is an error loading the information of the installed
|
||
206 | * plugins
|
||
207 | */
|
||
208 | public PackageInfo[] getInstalledPackages(File pluginsDirectory) |
||
209 | throws MakePluginPackageServiceException;
|
||
210 | 33743 | cordinyana | |
211 | 37599 | nfrancisco | /**
|
212 | 37822 | nfrancisco | * Returns a list of package infos for the already installed plugins.
|
213 | *
|
||
214 | * @return the list of package infos for the already installed plugins
|
||
215 | * @throws MakePluginPackageServiceException
|
||
216 | * if there is an error loading the information of the installed
|
||
217 | * plugins
|
||
218 | */
|
||
219 | public PackageInfo[] getInstalledPackages() |
||
220 | throws MakePluginPackageServiceException;
|
||
221 | |||
222 | /**
|
||
223 | 37599 | nfrancisco | * Returns the package bundle file name format.
|
224 | * <p>
|
||
225 | * The string has to use a suitable {@link MessageFormat} format, and the
|
||
226 | * available field numbers are the ones defined in the
|
||
227 | * BUNDLE_FILE_NAME_FIELDS interface.
|
||
228 | * </p>
|
||
229 | *
|
||
230 | * @return the package bundle file name format.
|
||
231 | */
|
||
232 | public String getPackageSetNameFormat(); |
||
233 | 33686 | cordinyana | |
234 | 37599 | nfrancisco | /**
|
235 | * Sets the package bundle file name format.
|
||
236 | *
|
||
237 | * @see InstallerManager#getPackageSetNameFormat()
|
||
238 | * @param packageBundleNameFormat
|
||
239 | * the package bundle file name format.
|
||
240 | */
|
||
241 | public void setPackageSetNameFormat(String packageBundleNameFormat); |
||
242 | 33686 | cordinyana | |
243 | 37599 | nfrancisco | /**
|
244 | * Returns the name of the package set file for a given package info.
|
||
245 | *
|
||
246 | * @param info
|
||
247 | * of the plugin
|
||
248 | * @return the name of the package set file
|
||
249 | */
|
||
250 | public String getPackageSetFileName(PackageInfo info); |
||
251 | 33686 | cordinyana | |
252 | 37599 | nfrancisco | /**
|
253 | * Returns the name of the package file for a given package info.
|
||
254 | *
|
||
255 | * @param info
|
||
256 | * of the plugin
|
||
257 | * @return the name of the package file
|
||
258 | */
|
||
259 | public String getPackageFileName(PackageInfo info); |
||
260 | 34005 | cordinyana | |
261 | 37599 | nfrancisco | /**
|
262 | * Returns the name of the package index file for a given package info.
|
||
263 | *
|
||
264 | * @param info
|
||
265 | * of the plugin
|
||
266 | * @return the name of the package index file
|
||
267 | */
|
||
268 | public String getPackageIndexFileName(PackageInfo info); |
||
269 | 34444 | cordinyana | |
270 | 37599 | nfrancisco | /**
|
271 | * It registers a class that implements the service for the installation of
|
||
272 | * a package that is inside a bundle. This class has to implement the
|
||
273 | * {@link InstallPackageService} interface.
|
||
274 | *
|
||
275 | * @param clazz
|
||
276 | * class that implements the {@link InstallPackageService}
|
||
277 | * interface.
|
||
278 | */
|
||
279 | public void registerInstallPackageService( |
||
280 | Class<? extends InstallPackageService> clazz); |
||
281 | 33692 | cordinyana | |
282 | 37599 | nfrancisco | /**
|
283 | * It creates and returns an object that is used to install a package in
|
||
284 | * gvSIG. All the parameters are set using the {@link InstallPackageService}
|
||
285 | * interface.
|
||
286 | *
|
||
287 | * @return an object that is used to install the package.
|
||
288 | * @throws InstallPackageServiceException
|
||
289 | * when there is a problem creating the service.
|
||
290 | */
|
||
291 | public InstallPackageService getInstallPackageService()
|
||
292 | throws InstallPackageServiceException;
|
||
293 | 34005 | cordinyana | |
294 | 37599 | nfrancisco | /**
|
295 | * Returns the default extensions of the package files.
|
||
296 | *
|
||
297 | * @return the default extensions of the package files
|
||
298 | */
|
||
299 | public String getDefaultPackageFileExtension(); |
||
300 | 34005 | cordinyana | |
301 | 37599 | nfrancisco | /**
|
302 | * Returns the default extensions of the package set files.
|
||
303 | *
|
||
304 | * @return the default extensions of the package set files
|
||
305 | */
|
||
306 | public String getDefaultPackageSetFileExtension(); |
||
307 | |||
308 | /**
|
||
309 | * Returns the default extensions of the index set files.
|
||
310 | *
|
||
311 | * @return the default extensions of the index set files
|
||
312 | */
|
||
313 | public String getDefaultIndexSetFileExtension(); |
||
314 | |||
315 | /**
|
||
316 | * Return the OS code of the system
|
||
317 | *
|
||
318 | * @return os code of the system
|
||
319 | */
|
||
320 | 35937 | jjdelcerro | public String getOperatingSystem(); |
321 | 37599 | nfrancisco | |
322 | 35979 | jjdelcerro | /**
|
323 | 37599 | nfrancisco | * Returns the Architecture code of the system
|
324 | *
|
||
325 | * @return architecture code of the system
|
||
326 | */
|
||
327 | public String getArchitecture(); |
||
328 | |||
329 | /**
|
||
330 | 35979 | jjdelcerro | * Create a empty dependency object.
|
331 | *
|
||
332 | * @return the dependency
|
||
333 | */
|
||
334 | public Dependency createDependency();
|
||
335 | 37599 | nfrancisco | |
336 | 35979 | jjdelcerro | /**
|
337 | 37599 | nfrancisco | * Create a dependency instance with the data of the package.
|
338 | 35979 | jjdelcerro | *
|
339 | * @param packageInfo
|
||
340 | * @return a dependency of the package
|
||
341 | */
|
||
342 | public Dependency createDependency(PackageInfo packageInfo);
|
||
343 | 37599 | nfrancisco | |
344 | 35979 | jjdelcerro | /**
|
345 | * Create a dependencies calculator.
|
||
346 | *
|
||
347 | * @return the dependencias calculator
|
||
348 | */
|
||
349 | 37599 | nfrancisco | public DependenciesCalculator createDependenciesCalculator(
|
350 | InstallPackageService installService); |
||
351 | |||
352 | 35979 | jjdelcerro | /**
|
353 | * Create a version instance
|
||
354 | *
|
||
355 | * @return the version
|
||
356 | */
|
||
357 | public Version createVersion();
|
||
358 | 37599 | nfrancisco | |
359 | 37169 | nfrancisco | public PackageInfo createPackageInfo();
|
360 | 38578 | jjdelcerro | |
361 | /**
|
||
362 | * Create a PackageInfo and load contents from the specified InputStream using the
|
||
363 | * default reader.
|
||
364 | *
|
||
365 | * @param packegeinfo as URL
|
||
366 | * @return the created packageInfo
|
||
367 | * @throws IOException
|
||
368 | * @throws BaseException
|
||
369 | */
|
||
370 | public PackageInfo createPackageInfo(InputStream packegeinfo) throws BaseException; |
||
371 | 37169 | nfrancisco | |
372 | 37599 | nfrancisco | public PackageInfoWriter getDefaultPackageInfoWriter();
|
373 | |||
374 | public PackageInfoReader getDefaultPackageInfoReader();
|
||
375 | |||
376 | public MakePackageService createMakePackage(File packageFolder, |
||
377 | PackageInfo packageInfo); |
||
378 | |||
379 | public void setDownloadBaseURL(URL url); |
||
380 | |||
381 | public URL getDownloadBaseURL(); |
||
382 | |||
383 | public void setVersion(String version); |
||
384 | |||
385 | public String getVersion(); |
||
386 | |||
387 | 37822 | nfrancisco | /**
|
388 | * Gets a List of all the folders where there might be addons folders
|
||
389 | * (addons repositories).
|
||
390 | *
|
||
391 | * @return list of repositories paths
|
||
392 | */
|
||
393 | 37829 | nfrancisco | public List<File> getLocalAddonRepositories(); |
394 | 37822 | nfrancisco | |
395 | /**
|
||
396 | * Adds an addon repository path to the manager list.
|
||
397 | *
|
||
398 | * @param path
|
||
399 | * of the repository
|
||
400 | */
|
||
401 | 37829 | nfrancisco | public void addLocalAddonRepository(File path); |
402 | 37822 | nfrancisco | |
403 | /**
|
||
404 | * Gets a List of all the addon folders. An addon folder is a folder inside
|
||
405 | * any addon repository with a package.info file inside. (addons
|
||
406 | * repositories).
|
||
407 | *
|
||
408 | * @return list of addon paths folders.
|
||
409 | */
|
||
410 | public List<File> getAddonFolders(); |
||
411 | |||
412 | /**
|
||
413 | * Gets the folder of the addon with the code provided, or null if not
|
||
414 | * found.
|
||
415 | *
|
||
416 | * @param code
|
||
417 | * of the addon
|
||
418 | *
|
||
419 | * @return File of the folder of the addon.
|
||
420 | */
|
||
421 | public File getAddonFolder(String code); |
||
422 | |||
423 | 37831 | nfrancisco | /**
|
424 | * The local addons folder where normally all addons are installed.
|
||
425 | *
|
||
426 | * @param defaultAddonsRepository
|
||
427 | */
|
||
428 | 37829 | nfrancisco | public void setDefaultLocalAddonRepository(File defaultAddonsRepository); |
429 | 37822 | nfrancisco | |
430 | 37831 | nfrancisco | /**
|
431 | * The local addons folder where normally all addons are installed.
|
||
432 | *
|
||
433 | * @return default addons repository folder.
|
||
434 | */
|
||
435 | 37829 | nfrancisco | public File getDefaultLocalAddonRepository(); |
436 | 37831 | nfrancisco | |
437 | 37857 | jjdelcerro | public List<byte[]> getPublicKeys(); |
438 | 37822 | nfrancisco | |
439 | 37831 | nfrancisco | |
440 | 32269 | jpiera | } |