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