svn-gvsig-desktop / 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 @ 37529
History | View | Annotate | Download (10.8 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 | 37489 | nfrancisco | import java.net.URL; |
32 | 33743 | cordinyana | import java.text.MessageFormat; |
33 | 32562 | jpiera | |
34 | 37169 | nfrancisco | import org.gvsig.installer.lib.api.creation.MakePackageService; |
35 | 32562 | jpiera | import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
36 | import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
||
37 | import org.gvsig.installer.lib.api.execution.InstallPackageService; |
||
38 | import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
||
39 | 32400 | jpiera | import org.gvsig.tools.service.Manager; |
40 | 32269 | jpiera | |
41 | /**
|
||
42 | 32333 | jpiera | * <p>
|
43 | 33692 | cordinyana | * This manager is used to register and create the services that are used to
|
44 | * manage the creation and the execution of installers. An installer is a file
|
||
45 | * called <b>bundle</b> that is composed of a set <b>packages</b>.
|
||
46 | 32585 | jpiera | * </p>
|
47 | * <p>
|
||
48 | 33692 | cordinyana | * A package has some information that is defined by the {@link PackageInfo}
|
49 | * class and is composed of a set of attributes. One of these attributes, the
|
||
50 | * type, denotes if the package is a plugin, theme, translation, etc.
|
||
51 | * </p>
|
||
52 | 32585 | jpiera | * <p>
|
53 | 33692 | cordinyana | * In practice a bundle is just a compressed zip file that has a compressed zip
|
54 | * file for every package to install. The structure of a bundle file with two
|
||
55 | 32585 | jpiera | * packages of type plugin could be:
|
56 | * </p>
|
||
57 | 33692 | cordinyana | *
|
58 | 32585 | jpiera | * <pre>
|
59 | * - bundle (compressed file)
|
||
60 | * - org.gvsig.plugin1-1_0_0-23 (compressed file)
|
||
61 | * - org.gvsig.plugin1
|
||
62 | * - package.info
|
||
63 | * - org.gvsig.plugin2-2_0_1-35 (compressed file)
|
||
64 | * - org.gvsig.plugin1
|
||
65 | 33692 | cordinyana | * - package.info
|
66 | 32585 | jpiera | * </pre>
|
67 | * <p>
|
||
68 | 32597 | jpiera | * <b>bundle</b> is the compressed file that contains a zip entry for every
|
69 | 32585 | jpiera | * package to install. The name of the zip entry follows next pattern:
|
70 | * </p>
|
||
71 | 33692 | cordinyana | *
|
72 | 32585 | jpiera | * <pre>
|
73 | 33692 | cordinyana | * [package code]-[version]-[build]
|
74 | 32585 | jpiera | * </pre>
|
75 | * <p>
|
||
76 | 33692 | cordinyana | * Every zip entry contains a main folder inside that contains all the package
|
77 | * files that are used in the installation process. Depending of the type of
|
||
78 | * packages, the information inside this folder can be different, but all the
|
||
79 | * types of packages have to have the <b>package.info</b>file that has all the
|
||
80 | * package information. To see the <b>package.info</b> description see
|
||
81 | * {@link PackageInfo}.
|
||
82 | * <p>
|
||
83 | 32585 | jpiera | * </p>
|
84 | 33692 | cordinyana | * The services that offers this managers are basically two: the creation of
|
85 | * bundles for just one package of plugin type and a service for the
|
||
86 | 32597 | jpiera | * installation of packages from a bundle.
|
87 | 32333 | jpiera | * </p>
|
88 | *
|
||
89 | 32269 | jpiera | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
90 | */
|
||
91 | 32400 | jpiera | public interface InstallerManager extends Manager { |
92 | 33686 | cordinyana | |
93 | 33743 | cordinyana | /**
|
94 | * Package state default values.
|
||
95 | */
|
||
96 | 33686 | cordinyana | public static interface STATE { |
97 | 33692 | cordinyana | |
98 | 33743 | cordinyana | static final String DEVEL = "devel"; |
99 | static final String TESTING = "testing"; |
||
100 | static final String PILOT = "pilot"; |
||
101 | static final String PROTOTYPE = "prototype"; |
||
102 | static final String ALPHA = "alpha"; |
||
103 | static final String BETA = "beta"; |
||
104 | static final String RC = "RC"; |
||
105 | static final String FINAL = "final"; |
||
106 | 33686 | cordinyana | } |
107 | |||
108 | 33743 | cordinyana | /**
|
109 | * Supported operating system default values.
|
||
110 | */
|
||
111 | 33686 | cordinyana | public static interface OS { |
112 | 33692 | cordinyana | |
113 | 33743 | cordinyana | static final String ALL = "all"; |
114 | static final String LINUX = "lin"; |
||
115 | static final String WINDOWS = "win"; |
||
116 | static final String OSX_10_4 = "osx_10_4"; |
||
117 | static final String OSX_10_5 = "osx_10_5"; |
||
118 | static final String OSX_10_6 = "osx_10_6"; |
||
119 | 33686 | cordinyana | } |
120 | |||
121 | 33743 | cordinyana | /**
|
122 | * Supported architecture default values.
|
||
123 | */
|
||
124 | 33686 | cordinyana | public static interface ARCH { |
125 | 33692 | cordinyana | |
126 | 33743 | cordinyana | static final String ALL = "all"; |
127 | static final String X86 = "x86"; |
||
128 | static final String X86_64 = "x86_64"; |
||
129 | 33686 | cordinyana | } |
130 | |||
131 | 33743 | cordinyana | /**
|
132 | * Supported Java virtual machine version default values.
|
||
133 | */
|
||
134 | 33686 | cordinyana | public static interface JVM { |
135 | 33692 | cordinyana | |
136 | 33743 | cordinyana | static final String J1_5 = "j1_5"; |
137 | static final String J1_6 = "j1_6"; |
||
138 | 33686 | cordinyana | } |
139 | |||
140 | /**
|
||
141 | 33743 | cordinyana | * Fields into the bundle file name message format.
|
142 | *
|
||
143 | 34005 | cordinyana | * @see InstallerManager#getPackageSetNameFormat()
|
144 | * @see InstallerManager#setPackageSetNameFormat(String)
|
||
145 | 33743 | cordinyana | */
|
146 | 34005 | cordinyana | public static interface PACKAGE_FILE_NAME_FIELDS { |
147 | 33743 | cordinyana | |
148 | static final int GVSIG_VERSION = 0; |
||
149 | static final int NAME = 1; |
||
150 | static final int VERSION = 2; |
||
151 | static final int BUILD = 3; |
||
152 | static final int STATE = 4; |
||
153 | static final int OS = 5; |
||
154 | static final int ARCH = 6; |
||
155 | static final int JVM = 7; |
||
156 | } |
||
157 | |||
158 | /**
|
||
159 | 33692 | cordinyana | * It registers a class that implements the service for the creation of
|
160 | * bundle that contains inside a package of type plugin. The registered
|
||
161 | * class
|
||
162 | * have to implement the {@link MakePluginPackageService} interface.
|
||
163 | *
|
||
164 | * @param clazz
|
||
165 | * class that implements the {@link MakePluginPackageService}
|
||
166 | * interface.
|
||
167 | */
|
||
168 | 33686 | cordinyana | public void registerMakePluginPackageService( |
169 | Class<? extends MakePluginPackageService> clazz); |
||
170 | 33692 | cordinyana | |
171 | /**
|
||
172 | * It creates and returns an object that is used to create a bundle
|
||
173 | * that contains inside a package of type plugin. All the parameters
|
||
174 | * are set using the {@link MakePluginPackageService} interface. *
|
||
175 | *
|
||
176 | * @return
|
||
177 | * an object that is used to create a plugin installer
|
||
178 | * @throws MakePluginPackageServiceException
|
||
179 | * when there is a problem creating the service
|
||
180 | */
|
||
181 | public MakePluginPackageService getMakePluginPackageService(
|
||
182 | File pluginsDirectory) throws MakePluginPackageServiceException; |
||
183 | |||
184 | 33743 | cordinyana | /**
|
185 | * Returns a list of package infos for the already installed plugins.
|
||
186 | *
|
||
187 | * @param pluginsDirectory
|
||
188 | * where to look for the installed plugins
|
||
189 | * @return the list of package infos for the already installed plugins
|
||
190 | * @throws MakePluginPackageServiceException
|
||
191 | * if there is an error loading
|
||
192 | * the information of the installed plugins
|
||
193 | */
|
||
194 | public PackageInfo[] getInstalledPackages(File pluginsDirectory) |
||
195 | throws MakePluginPackageServiceException;
|
||
196 | |||
197 | /**
|
||
198 | * Returns the package bundle file name format.
|
||
199 | * <p>
|
||
200 | * The string has to use a suitable {@link MessageFormat} format, and the
|
||
201 | * available field numbers are the ones defined in the
|
||
202 | * BUNDLE_FILE_NAME_FIELDS interface.
|
||
203 | * </p>
|
||
204 | *
|
||
205 | * @return the package bundle file name format.
|
||
206 | */
|
||
207 | 34005 | cordinyana | public String getPackageSetNameFormat(); |
208 | 33686 | cordinyana | |
209 | 33743 | cordinyana | /**
|
210 | * Sets the package bundle file name format.
|
||
211 | *
|
||
212 | 34005 | cordinyana | * @see InstallerManager#getPackageSetNameFormat()
|
213 | 33743 | cordinyana | * @param packageBundleNameFormat
|
214 | * the package bundle file name format.
|
||
215 | */
|
||
216 | 34005 | cordinyana | public void setPackageSetNameFormat(String packageBundleNameFormat); |
217 | 33686 | cordinyana | |
218 | 33743 | cordinyana | /**
|
219 | 34005 | cordinyana | * Returns the name of the package set file for a given package info.
|
220 | 33743 | cordinyana | *
|
221 | * @param info
|
||
222 | * of the plugin
|
||
223 | 34005 | cordinyana | * @return the name of the package set file
|
224 | 33743 | cordinyana | */
|
225 | 34005 | cordinyana | public String getPackageSetFileName(PackageInfo info); |
226 | 33686 | cordinyana | |
227 | 33692 | cordinyana | /**
|
228 | 34005 | cordinyana | * Returns the name of the package file for a given package info.
|
229 | *
|
||
230 | * @param info
|
||
231 | * of the plugin
|
||
232 | * @return the name of the package file
|
||
233 | */
|
||
234 | public String getPackageFileName(PackageInfo info); |
||
235 | |||
236 | /**
|
||
237 | 34444 | cordinyana | * Returns the name of the package index file for a given package info.
|
238 | *
|
||
239 | * @param info
|
||
240 | * of the plugin
|
||
241 | * @return the name of the package index file
|
||
242 | */
|
||
243 | public String getPackageIndexFileName(PackageInfo info); |
||
244 | |||
245 | /**
|
||
246 | 33692 | cordinyana | * It registers a class that implements the service for the installation
|
247 | * of a package that is inside a bundle. This class has to implement
|
||
248 | * the {@link InstallPackageService} interface.
|
||
249 | *
|
||
250 | * @param clazz
|
||
251 | * class that implements the {@link InstallPackageService}
|
||
252 | * interface.
|
||
253 | */
|
||
254 | 33686 | cordinyana | public void registerInstallPackageService( |
255 | Class<? extends InstallPackageService> clazz); |
||
256 | 33692 | cordinyana | |
257 | /**
|
||
258 | * It creates and returns an object that is used to install a package
|
||
259 | * in gvSIG. All the parameters are set using the
|
||
260 | * {@link InstallPackageService} interface.
|
||
261 | *
|
||
262 | * @return
|
||
263 | * an object that is used to install the package.
|
||
264 | * @throws InstallPackageServiceException
|
||
265 | * when there is a problem creating the service.
|
||
266 | */
|
||
267 | public InstallPackageService getInstallPackageService()
|
||
268 | throws InstallPackageServiceException;
|
||
269 | 34005 | cordinyana | |
270 | /**
|
||
271 | * Returns the default extensions of the package files.
|
||
272 | *
|
||
273 | * @return the default extensions of the package files
|
||
274 | */
|
||
275 | public String getDefaultPackageFileExtension(); |
||
276 | |||
277 | /**
|
||
278 | * Returns the default extensions of the package set files.
|
||
279 | *
|
||
280 | * @return the default extensions of the package set files
|
||
281 | */
|
||
282 | public String getDefaultPackageSetFileExtension(); |
||
283 | 35937 | jjdelcerro | |
284 | /**
|
||
285 | * Return the OS code of the system
|
||
286 | *
|
||
287 | * @return os code of the system
|
||
288 | */
|
||
289 | public String getOperatingSystem(); |
||
290 | 35979 | jjdelcerro | |
291 | 37529 | nfrancisco | /**
|
292 | * Returns the Architecture code of the system
|
||
293 | *
|
||
294 | * @return architecture code of the system
|
||
295 | */
|
||
296 | public String getArchitecture(); |
||
297 | |||
298 | 35979 | jjdelcerro | /**
|
299 | * Create a empty dependency object.
|
||
300 | *
|
||
301 | * @return the dependency
|
||
302 | */
|
||
303 | public Dependency createDependency();
|
||
304 | |||
305 | /**
|
||
306 | * Create a dependency instance with the data of the
|
||
307 | * package.
|
||
308 | *
|
||
309 | * @param packageInfo
|
||
310 | * @return a dependency of the package
|
||
311 | */
|
||
312 | public Dependency createDependency(PackageInfo packageInfo);
|
||
313 | |||
314 | /**
|
||
315 | * Create a dependencies calculator.
|
||
316 | *
|
||
317 | * @return the dependencias calculator
|
||
318 | */
|
||
319 | public DependenciesCalculator createDependenciesCalculator(InstallPackageService installService);
|
||
320 | |||
321 | /**
|
||
322 | * Create a version instance
|
||
323 | *
|
||
324 | * @return the version
|
||
325 | */
|
||
326 | public Version createVersion();
|
||
327 | 37169 | nfrancisco | |
328 | public PackageInfo createPackageInfo();
|
||
329 | |||
330 | public PackageInfoWriter getDefaultPackageInfoWriter();
|
||
331 | |||
332 | public PackageInfoReader getDefaultPackageInfoReader();
|
||
333 | |||
334 | public MakePackageService createMakePackage(File packageFolder, PackageInfo packageInfo); |
||
335 | 37489 | nfrancisco | |
336 | public void setDownloadBaseURL(URL url); |
||
337 | |||
338 | public URL getDownloadBaseURL(); |
||
339 | |||
340 | public void setVersion(String version); |
||
341 | |||
342 | public String getVersion(); |
||
343 | 37169 | nfrancisco | |
344 | 32269 | jpiera | } |