Revision 37599

View differences:

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/PackageInfo.java
40 40
import org.gvsig.tools.task.SimpleTaskStatus;
41 41

  
42 42
/**
43
 * Information of a package that is used on the installation process.
44
 * This information is composed by next fields:
45
 * </br> <li>
43
 * Information of a package that is used on the installation process. This
44
 * information is composed by next fields: </br> <li>
46 45
 * <lu><b>Code</b>: unique identifier for the package.</lu> <lu><b>Name</b>:
47 46
 * name of the package.</lu> <lu><b>Description</b>: brief description of the
48 47
 * package functionality</lu> * <lu><b>Version</b>: number of version.</lu>
......
60 59
 */
61 60
public interface PackageInfo extends Cloneable {
62 61

  
63
    /**
64
     * @return
65
     *         Gets the code of the package.
66
     */
67
    public String getCode();
62
	/**
63
	 * @return Gets the code of the package.
64
	 */
65
	public String getCode();
68 66

  
69
    public void setCode(String code);
67
	public void setCode(String code);
70 68

  
71
    public String getID();
69
	public String getID();
72 70

  
73
    /**
74
     * @return
75
     *         Gets the name of the package.
76
     */
77
    public String getName();
71
	/**
72
	 * @return Gets the name of the package.
73
	 */
74
	public String getName();
78 75

  
79
    public void setName(String name);
76
	public void setName(String name);
80 77

  
81
    /**
82
     * @return
83
     *         Gets the description of the package.
84
     */
85
    public String getDescription();
78
	/**
79
	 * @return Gets the description of the package.
80
	 */
81
	public String getDescription();
86 82

  
87
    public void setDescription(String description);
83
	public void setDescription(String description);
88 84

  
89
    /**
90
     * @return
91
     *         Gets the version of the package.
92
     */
93
    public Version getVersion();
85
	/**
86
	 * @return Gets the version of the package.
87
	 */
88
	public Version getVersion();
94 89

  
95
    public void setVersion(String version);
96
    public void setVersion(Version version);
90
	public void setVersion(String version);
97 91

  
98
    /**
99
     * @return
100
     *         Gets the build number of the package.
101
     */
102
    public int getBuild();
92
	public void setVersion(Version version);
103 93

  
104
    public void setBuild(int build);
94
	/**
95
	 * @return Gets the build number of the package.
96
	 */
97
	public int getBuild();
105 98

  
106
    /**
107
     * @return
108
     *         Gets the state of the package.
109
     * @see STATE
110
     */
111
    public String getState();
99
	public void setBuild(int build);
112 100

  
113
    /**
114
     * Sets the state of the package
115
     * 
116
     * @param state
117
     * @see STATE
118
     */
119
    public void setState(String state);
101
	/**
102
	 * @return Gets the state of the package.
103
	 * @see STATE
104
	 */
105
	public String getState();
120 106

  
121
    /**
122
     * @return
123
     *         Gets if the package is official.
124
     */
125
    public boolean isOfficial();
107
	/**
108
	 * Sets the state of the package
109
	 * 
110
	 * @param state
111
	 * @see STATE
112
	 */
113
	public void setState(String state);
126 114

  
127
    public void setOfficial(boolean official);
115
	/**
116
	 * @return Gets if the package is official.
117
	 */
118
	public boolean isOfficial();
128 119

  
129
    /**
130
     * @return
131
     *         Gets the type of the package.
132
     */
133
    public String getType();
120
	public void setOfficial(boolean official);
134 121

  
135
    public void setType(String type);
122
	/**
123
	 * @return Gets the type of the package.
124
	 */
125
	public String getType();
136 126

  
137
    /**
138
     * Returns the supported operating system.
139
     * 
140
     * @return the supported operating system
141
     * @see OS
142
     */
143
    public String getOperatingSystem();
127
	public void setType(String type);
144 128

  
145
    /**
146
     * Sets the supported operating system.
147
     * 
148
     * @param operatingSystem
149
     *            the supported operating system
150
     * @see OS
151
     */
152
    public void setOperatingSystem(String operatingSystem);
129
	/**
130
	 * Returns the supported operating system.
131
	 * 
132
	 * @return the supported operating system
133
	 * @see OS
134
	 */
135
	public String getOperatingSystem();
153 136

  
154
    /**
155
     * Returns the supported hardware architecture.
156
     * 
157
     * @return the supported hardware architecture
158
     * @see ARCH
159
     */
160
    public String getArchitecture();
137
	/**
138
	 * Sets the supported operating system.
139
	 * 
140
	 * @param operatingSystem
141
	 *            the supported operating system
142
	 * @see OS
143
	 */
144
	public void setOperatingSystem(String operatingSystem);
161 145

  
162
    /**
163
     * Sets the supported hardware architecture.
164
     * 
165
     * @param architecture
166
     *            the supported hardware architecture
167
     * @see ARCH
168
     */
169
    public void setArchitecture(String architecture);
146
	/**
147
	 * Returns the supported hardware architecture.
148
	 * 
149
	 * @return the supported hardware architecture
150
	 * @see ARCH
151
	 */
152
	public String getArchitecture();
170 153

  
171
    /**
172
     * Returns the supported java vm version.
173
     * 
174
     * @return the supported java vm version
175
     * @see JVM
176
     */
177
    public String getJavaVM();
154
	/**
155
	 * Sets the supported hardware architecture.
156
	 * 
157
	 * @param architecture
158
	 *            the supported hardware architecture
159
	 * @see ARCH
160
	 */
161
	public void setArchitecture(String architecture);
178 162

  
179
    /**
180
     * Sets the supported java vm version.
181
     * 
182
     * @param javaVM
183
     *            the supported java vm version
184
     * @see JVM
185
     */
186
    public void setJavaVM(String javaVM);
163
	/**
164
	 * Returns the supported java vm version.
165
	 * 
166
	 * @return the supported java vm version
167
	 * @see JVM
168
	 */
169
	public String getJavaVM();
187 170

  
188
    /**
189
     * Returns the supported gvSIG version.
190
     * 
191
     * @return the supported gvSIG version
192
     */
193
    public String getGvSIGVersion();
171
	/**
172
	 * Sets the supported java vm version.
173
	 * 
174
	 * @param javaVM
175
	 *            the supported java vm version
176
	 * @see JVM
177
	 */
178
	public void setJavaVM(String javaVM);
194 179

  
195
    /**
196
     * Sets the supported gvSIG version.
197
     * 
198
     * @param gvSIGVersion
199
     *            the supported gvSIG version
200
     */
201
    public void setGvSIGVersion(String gvSIGVersion);
180
	/**
181
	 * Returns the supported gvSIG version.
182
	 * 
183
	 * @return the supported gvSIG version
184
	 */
185
	public String getGvSIGVersion();
202 186

  
203
    /**
204
     * Returns the package bundle download {@link URL}.
205
     * 
206
     * May be null if there is no remote URL to download the bundle.
207
     * 
208
     * @return the package bundle download {@link URL}
209
     */
210
    public URL getDownloadURL();
211
    
212
    public String getDownloadURLAsString();
213
    
214
//    /**
215
//     * Returns the package bundle download {@link URL}.
216
//     * 
217
//     * May be null if there is no remote URL to download the bundle.
218
//     * 
219
//     * @return the package bundle download {@link URL}
220
//     */
221
    public URL getDownloadURL(URL baseURL);
187
	/**
188
	 * Sets the supported gvSIG version.
189
	 * 
190
	 * @param gvSIGVersion
191
	 *            the supported gvSIG version
192
	 */
193
	public void setGvSIGVersion(String gvSIGVersion);
222 194

  
223
    /**
224
     * Sets the package bundle download {@link URL}. Optional.
225
     * 
226
     * @param defaultURL
227
     *            the package bundle download {@link URL}
228
     */
229
    public void setDownloadURL(URL defaultURL);
230
    
231
    public void setDownloadURL(String defaultDownloadURL);
232
    
233
    /**
234
     * Returns the package info model version.
235
     * 
236
     * @return the package info model version
237
     */
238
    public String getModelVersion();
195
	/**
196
	 * Returns the package bundle download {@link URL}.
197
	 * 
198
	 * May be null if there is no remote URL to download the bundle.
199
	 * 
200
	 * @return the package bundle download {@link URL}
201
	 */
202
	public URL getDownloadURL();
239 203

  
240
    /**
241
     * Sets the package info model version.
242
     * 
243
     * @param modelVersion
244
     *            the package info model version
245
     */
246
    public void setModelVersion(String modelVersion);
247
    
248
    public String getOwner();
249
    
250
    /**
251
     * Sets the package owner.
252
     * 
253
     * @param owner
254
     *            the package owner
255
     */
256
    public void setOwner(String owner);
257
    
258
    /**
259
     * Returns the package source files url {@link URL}.
260
     * 
261
     * @return the package source files url {@link URL}
262
     */
263
    public URL getSourcesURL();
204
	public String getDownloadURLAsString();
264 205

  
265
    /**
266
     * Sets the package sources.
267
     * 
268
     * @param sources
269
     *            the package sources
270
     */
271
    public void setSourcesURL(URL sources);
206
	// /**
207
	// * Returns the package bundle download {@link URL}.
208
	// *
209
	// * May be null if there is no remote URL to download the bundle.
210
	// *
211
	// * @return the package bundle download {@link URL}
212
	// */
213
	public URL getDownloadURL(URL baseURL);
272 214

  
273
    /**
274
     * Returns the package web url {@link URL}.
275
     * 
276
     * @return the package web url {@link URL}
277
     */
278
    public URL getWebURL();
215
	/**
216
	 * Sets the package bundle download {@link URL}. Optional.
217
	 * 
218
	 * @param defaultURL
219
	 *            the package bundle download {@link URL}
220
	 */
221
	public void setDownloadURL(URL defaultURL);
279 222

  
280
    /**
281
     * Sets the package web url {@link URL}.
282
     * 
283
     * @param webURL
284
     *            the package web url {@link URL}
285
     */
286
    public void setWebURL(URL webURL);
287
    
288
    /**
289
     * Gets the ant script that has to be executed in the
290
     * installation process.
291
     * 
292
     * @return
293
     *         the script.
294
     */
295
    public String getAntScript();
223
	public void setDownloadURL(String defaultDownloadURL);
296 224

  
297
    /**
298
     * Sets the ant script that can be executed in the
299
     * installation process.
300
     * 
301
     * @param antScript
302
     *            The ant script to copy.
303
     */
304
    public void setAntScript(String antScript);
225
	/**
226
	 * Returns the package info model version.
227
	 * 
228
	 * @return the package info model version
229
	 */
230
	public String getModelVersion();
305 231

  
306
    public File downloadFile() throws InstallPackageServiceException;
232
	/**
233
	 * Sets the package info model version.
234
	 * 
235
	 * @param modelVersion
236
	 *            the package info model version
237
	 */
238
	public void setModelVersion(String modelVersion);
307 239

  
308
    public File downloadFile(SimpleTaskStatus taskStatus)
309
        throws InstallPackageServiceException;
240
	public String getOwner();
310 241

  
311
    /**
312
     * @return
313
     */
314
    public void addFileToCopy(File file);
242
	/**
243
	 * Sets the package owner.
244
	 * 
245
	 * @param owner
246
	 *            the package owner
247
	 */
248
	public void setOwner(String owner);
315 249

  
316
    public File getFileToCopy(int i);
250
	/**
251
	 * Returns the package source files url {@link URL}.
252
	 * 
253
	 * @return the package source files url {@link URL}
254
	 */
255
	public URL getSourcesURL();
317 256

  
318
    public void removeFileToCopy(File file);
257
	/**
258
	 * Sets the package sources.
259
	 * 
260
	 * @param sources
261
	 *            the package sources
262
	 */
263
	public void setSourcesURL(URL sources);
319 264

  
320
    public void clearFilesToCopy();
265
	/**
266
	 * Returns the package web url {@link URL}.
267
	 * 
268
	 * @return the package web url {@link URL}
269
	 */
270
	public URL getWebURL();
321 271

  
322
    public List<File> getFilesToCopy();
272
	/**
273
	 * Sets the package web url {@link URL}.
274
	 * 
275
	 * @param webURL
276
	 *            the package web url {@link URL}
277
	 */
278
	public void setWebURL(URL webURL);
323 279

  
324
    /**
325
     * @param folder
326
     * @return
327
     */
328
    public boolean removeInstallFolder(File folder);
329
    
330
    public boolean removeFilesFolder(File folder);
280
	/**
281
	 * Gets the ant script that has to be executed in the installation process.
282
	 * 
283
	 * @return the script.
284
	 */
285
	public String getAntScript();
331 286

  
332
    /**
333
     * @param string
334
     * @return
335
     */
336
    public boolean matchID(String string);
287
	/**
288
	 * Sets the ant script that can be executed in the installation process.
289
	 * 
290
	 * @param antScript
291
	 *            The ant script to copy.
292
	 */
293
	public void setAntScript(String antScript);
337 294

  
338
    public Dependencies getDependencies();
339
    
340
    public void setDependencies(String dependencies);
341
    
342
    public void setDependencies(Dependencies dependencies);
343
    
344
    public String toStringCompact();
345
    
346
    public List<String> getCategories();
347
    
348
    public void setCategories(List<String> categoriesList);
349
    
350
    public String getCategoriesAsString();
351
    
352
    public void addCategoriesAsString(String categoriesString);
353
    
295
	public File downloadFile() throws InstallPackageServiceException;
296

  
297
	public File downloadFile(SimpleTaskStatus taskStatus)
298
			throws InstallPackageServiceException;
299

  
300
	/**
301
	 * @return
302
	 */
303
	public void addFileToCopy(File file);
304

  
305
	public File getFileToCopy(int i);
306

  
307
	public void removeFileToCopy(File file);
308

  
309
	public void clearFilesToCopy();
310

  
311
	public List<File> getFilesToCopy();
312

  
313
	/**
314
	 * @param folder
315
	 * @return
316
	 */
317
	public boolean removeInstallFolder(File folder);
318

  
319
	public boolean removeFilesFolder(File folder);
320

  
321
	/**
322
	 * @param string
323
	 * @return
324
	 */
325
	public boolean matchID(String string);
326

  
327
	public Dependencies getDependencies();
328

  
329
	public void setDependencies(String dependencies);
330

  
331
	public void setDependencies(Dependencies dependencies);
332

  
333
	public String toStringCompact();
334

  
335
	public List<String> getCategories();
336

  
337
	public void setCategories(List<String> categoriesList);
338

  
339
	public String getCategoriesAsString();
340

  
341
	public void addCategoriesAsString(String categoriesString);
342

  
354 343
}
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
83 83
 * </p>
84 84
 * The services that offers this managers are basically two: the creation of
85 85
 * bundles for just one package of plugin type and a service for the
86
 * installation of packages from a bundle.
87
 * </p>
86
 * installation of packages from a bundle. </p>
88 87
 * 
89 88
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
90 89
 */
91 90
public interface InstallerManager extends Manager {
92 91

  
93
    /**
94
     * Package state default values.
95
     */
96
    public static interface STATE {
92
	/**
93
	 * Package state default values.
94
	 */
95
	public static interface STATE {
97 96

  
98
        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
    }
97
		static final String DEVEL = "devel";
98
		static final String TESTING = "testing";
99
		static final String PILOT = "pilot";
100
		static final String PROTOTYPE = "prototype";
101
		static final String ALPHA = "alpha";
102
		static final String BETA = "beta";
103
		static final String RC = "RC";
104
		static final String FINAL = "final";
105
	}
107 106

  
108
    /**
109
     * Supported operating system default values.
110
     */
111
    public static interface OS {
107
	/**
108
	 * Supported operating system default values.
109
	 */
110
	public static interface OS {
112 111

  
113
        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
    }
112
		static final String ALL = "all";
113
		static final String LINUX = "lin";
114
		static final String WINDOWS = "win";
115
		static final String OSX_10_4 = "osx_10_4";
116
		static final String OSX_10_5 = "osx_10_5";
117
		static final String OSX_10_6 = "osx_10_6";
118
	}
120 119

  
121
    /**
122
     * Supported architecture default values.
123
     */
124
    public static interface ARCH {
120
	/**
121
	 * Supported architecture default values.
122
	 */
123
	public static interface ARCH {
125 124

  
126
        static final String ALL = "all";
127
        static final String X86 = "x86";
128
        static final String X86_64 = "x86_64";
129
    }
125
		static final String ALL = "all";
126
		static final String X86 = "x86";
127
		static final String X86_64 = "x86_64";
128
	}
130 129

  
131
    /**
132
     * Supported Java virtual machine version default values.
133
     */
134
    public static interface JVM {
130
	/**
131
	 * Supported Java virtual machine version default values.
132
	 */
133
	public static interface JVM {
135 134

  
136
        static final String J1_5 = "j1_5";
137
        static final String J1_6 = "j1_6";
138
    }
135
		static final String J1_5 = "j1_5";
136
		static final String J1_6 = "j1_6";
137
	}
139 138

  
140
    /**
141
     * Fields into the bundle file name message format.
142
     * 
143
     * @see InstallerManager#getPackageSetNameFormat()
144
     * @see InstallerManager#setPackageSetNameFormat(String)
145
     */
146
    public static interface PACKAGE_FILE_NAME_FIELDS {
139
	/**
140
	 * Fields into the bundle file name message format.
141
	 * 
142
	 * @see InstallerManager#getPackageSetNameFormat()
143
	 * @see InstallerManager#setPackageSetNameFormat(String)
144
	 */
145
	public static interface PACKAGE_FILE_NAME_FIELDS {
147 146

  
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
    }
147
		static final int GVSIG_VERSION = 0;
148
		static final int NAME = 1;
149
		static final int VERSION = 2;
150
		static final int BUILD = 3;
151
		static final int STATE = 4;
152
		static final int OS = 5;
153
		static final int ARCH = 6;
154
		static final int JVM = 7;
155
	}
157 156

  
158
    /**
159
     * 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
    public void registerMakePluginPackageService(
169
        Class<? extends MakePluginPackageService> clazz);
157
	/**
158
	 * It registers a class that implements the service for the creation of
159
	 * bundle that contains inside a package of type plugin. The registered
160
	 * class have to implement the {@link MakePluginPackageService} interface.
161
	 * 
162
	 * @param clazz
163
	 *            class that implements the {@link MakePluginPackageService}
164
	 *            interface.
165
	 */
166
	public void registerMakePluginPackageService(
167
			Class<? extends MakePluginPackageService> clazz);
170 168

  
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;
169
	/**
170
	 * It creates and returns an object that is used to create a bundle that
171
	 * contains inside a package of type plugin. All the parameters are set
172
	 * using the {@link MakePluginPackageService} interface. *
173
	 * 
174
	 * @return an object that is used to create a plugin installer
175
	 * @throws MakePluginPackageServiceException
176
	 *             when there is a problem creating the service
177
	 */
178
	public MakePluginPackageService getMakePluginPackageService(
179
			File pluginsDirectory) throws MakePluginPackageServiceException;
183 180

  
184
    /**
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;
181
	/**
182
	 * Returns a list of package infos for the already installed plugins.
183
	 * 
184
	 * @param pluginsDirectory
185
	 *            where to look for the installed plugins
186
	 * @return the list of package infos for the already installed plugins
187
	 * @throws MakePluginPackageServiceException
188
	 *             if there is an error loading the information of the installed
189
	 *             plugins
190
	 */
191
	public PackageInfo[] getInstalledPackages(File pluginsDirectory)
192
			throws MakePluginPackageServiceException;
196 193

  
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
    public String getPackageSetNameFormat();
194
	/**
195
	 * Returns the package bundle file name format.
196
	 * <p>
197
	 * The string has to use a suitable {@link MessageFormat} format, and the
198
	 * available field numbers are the ones defined in the
199
	 * BUNDLE_FILE_NAME_FIELDS interface.
200
	 * </p>
201
	 * 
202
	 * @return the package bundle file name format.
203
	 */
204
	public String getPackageSetNameFormat();
208 205

  
209
    /**
210
     * Sets the package bundle file name format.
211
     * 
212
     * @see InstallerManager#getPackageSetNameFormat()
213
     * @param packageBundleNameFormat
214
     *            the package bundle file name format.
215
     */
216
    public void setPackageSetNameFormat(String packageBundleNameFormat);
206
	/**
207
	 * Sets the package bundle file name format.
208
	 * 
209
	 * @see InstallerManager#getPackageSetNameFormat()
210
	 * @param packageBundleNameFormat
211
	 *            the package bundle file name format.
212
	 */
213
	public void setPackageSetNameFormat(String packageBundleNameFormat);
217 214

  
218
    /**
219
     * Returns the name of the package set file for a given package info.
220
     * 
221
     * @param info
222
     *            of the plugin
223
     * @return the name of the package set file
224
     */
225
    public String getPackageSetFileName(PackageInfo info);
215
	/**
216
	 * Returns the name of the package set file for a given package info.
217
	 * 
218
	 * @param info
219
	 *            of the plugin
220
	 * @return the name of the package set file
221
	 */
222
	public String getPackageSetFileName(PackageInfo info);
226 223

  
227
    /**
228
     * 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);
224
	/**
225
	 * Returns the name of the package file for a given package info.
226
	 * 
227
	 * @param info
228
	 *            of the plugin
229
	 * @return the name of the package file
230
	 */
231
	public String getPackageFileName(PackageInfo info);
235 232

  
236
    /**
237
     * 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);
233
	/**
234
	 * Returns the name of the package index file for a given package info.
235
	 * 
236
	 * @param info
237
	 *            of the plugin
238
	 * @return the name of the package index file
239
	 */
240
	public String getPackageIndexFileName(PackageInfo info);
244 241

  
245
    /**
246
     * 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
    public void registerInstallPackageService(
255
        Class<? extends InstallPackageService> clazz);
242
	/**
243
	 * It registers a class that implements the service for the installation of
244
	 * a package that is inside a bundle. This class has to implement the
245
	 * {@link InstallPackageService} interface.
246
	 * 
247
	 * @param clazz
248
	 *            class that implements the {@link InstallPackageService}
249
	 *            interface.
250
	 */
251
	public void registerInstallPackageService(
252
			Class<? extends InstallPackageService> clazz);
256 253

  
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;
254
	/**
255
	 * It creates and returns an object that is used to install a package in
256
	 * gvSIG. All the parameters are set using the {@link InstallPackageService}
257
	 * interface.
258
	 * 
259
	 * @return an object that is used to install the package.
260
	 * @throws InstallPackageServiceException
261
	 *             when there is a problem creating the service.
262
	 */
263
	public InstallPackageService getInstallPackageService()
264
			throws InstallPackageServiceException;
269 265

  
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();
266
	/**
267
	 * Returns the default extensions of the package files.
268
	 * 
269
	 * @return the default extensions of the package files
270
	 */
271
	public String getDefaultPackageFileExtension();
276 272

  
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
    
284
    /**
285
     * Returns the default extensions of the index set files.
286
     * 
287
     * @return the default extensions of the index set files
288
     */
289
    public String getDefaultIndexSetFileExtension();
290
    
291
    /**
292
     * Return the OS code of the system
293
     *   
294
     * @return os code of the system
295
     */
273
	/**
274
	 * Returns the default extensions of the package set files.
275
	 * 
276
	 * @return the default extensions of the package set files
277
	 */
278
	public String getDefaultPackageSetFileExtension();
279

  
280
	/**
281
	 * Returns the default extensions of the index set files.
282
	 * 
283
	 * @return the default extensions of the index set files
284
	 */
285
	public String getDefaultIndexSetFileExtension();
286

  
287
	/**
288
	 * Return the OS code of the system
289
	 * 
290
	 * @return os code of the system
291
	 */
296 292
	public String getOperatingSystem();
297
	
298
    /**
299
     * Returns the Architecture code of the system
300
     *   
301
     * @return architecture code of the system
302
     */
303
    public String getArchitecture();
304
	
293

  
305 294
	/**
295
	 * Returns the Architecture code of the system
296
	 * 
297
	 * @return architecture code of the system
298
	 */
299
	public String getArchitecture();
300

  
301
	/**
306 302
	 * Create a empty dependency object.
307 303
	 * 
308 304
	 * @return the dependency
309 305
	 */
310 306
	public Dependency createDependency();
311
	
307

  
312 308
	/**
313
	 * Create a dependency instance with the data of the
314
	 * package.
309
	 * Create a dependency instance with the data of the package.
315 310
	 * 
316 311
	 * @param packageInfo
317 312
	 * @return a dependency of the package
318 313
	 */
319 314
	public Dependency createDependency(PackageInfo packageInfo);
320
	
315

  
321 316
	/**
322 317
	 * Create a dependencies calculator.
323 318
	 * 
324 319
	 * @return the dependencias calculator
325 320
	 */
326
	public DependenciesCalculator createDependenciesCalculator(InstallPackageService installService);
327
	
321
	public DependenciesCalculator createDependenciesCalculator(
322
			InstallPackageService installService);
323

  
328 324
	/**
329 325
	 * Create a version instance
330 326
	 * 
331 327
	 * @return the version
332 328
	 */
333 329
	public Version createVersion();
334
	
330

  
335 331
	public PackageInfo createPackageInfo();
336
	
337
    public PackageInfoWriter getDefaultPackageInfoWriter();
338 332

  
339
    public PackageInfoReader getDefaultPackageInfoReader();
340
    
341
    public MakePackageService createMakePackage(File packageFolder, PackageInfo packageInfo);
342
    
343
    public void setDownloadBaseURL(URL url);
344
    
345
    public URL getDownloadBaseURL();
346
    
347
    public void setVersion(String version);
348
    
349
    public String getVersion();
350
	
333
	public PackageInfoWriter getDefaultPackageInfoWriter();
334

  
335
	public PackageInfoReader getDefaultPackageInfoReader();
336

  
337
	public MakePackageService createMakePackage(File packageFolder,
338
			PackageInfo packageInfo);
339

  
340
	public void setDownloadBaseURL(URL url);
341

  
342
	public URL getDownloadBaseURL();
343

  
344
	public void setVersion(String version);
345

  
346
	public String getVersion();
347

  
351 348
}
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/PackageInfoReader.java
25 25

  
26 26
import org.gvsig.tools.exception.BaseException;
27 27

  
28

  
29 28
/**
30 29
 * @author gvSIG Team
31 30
 * @version $Id$
32
 *
31
 * 
33 32
 */
34 33
public interface PackageInfoReader {
35 34

  
36
    public void read(PackageInfo installerInfoResource, InputStream is)
37
    throws BaseException;
35
	public void read(PackageInfo installerInfoResource, InputStream is)
36
			throws BaseException;
38 37
}
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/Dependency.java
4 4

  
5 5
public interface Dependency extends Cloneable {
6 6

  
7
	
8 7
	public final String REQUIRED = "required";
9 8
	public final String CONFLICT = "conflict";
10 9
	public final String RECOMMENDED = "recommended";
11 10

  
12 11
	public Dependency parse(String dependency);
13
	
12

  
14 13
	public String getType();
15
	
14

  
16 15
	public String getCode();
17
	
16

  
18 17
	public String getOp();
19
	
18

  
20 19
	public Version getVersion();
21
	
20

  
22 21
	public boolean match(String type, String code, Version version);
23 22
}
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/DependenciesCalculator.java
3 3
import java.util.Collection;
4 4
import java.util.List;
5 5

  
6

  
7 6
public interface DependenciesCalculator {
8 7

  
9 8
	public abstract void addPackageToInstall(PackageInfo packageInfo);
......
17 16
	public abstract void calculate();
18 17

  
19 18
	public abstract List<PackageInfo> getRequiredPackages();
20
	
21
    public Dependencies getUnresolvedDependencies();
22 19

  
20
	public Dependencies getUnresolvedDependencies();
21

  
23 22
}
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/InstallerLocator.java
39 39
 */
40 40
public class InstallerLocator extends AbstractLocator {
41 41

  
42
    private static final String LOCATOR_NAME = "InstallerLocator";
43
    /**
44
     * InstallerManager name used by the locator to access the instance
45
     */
46
    public static final String INSTALLER_MANAGER_NAME = "InstallerManager";
47
    private static final String INSTALLER_MANAGER_DESCRIPTION =
48
        "InstallerManager of gvSIG";
42
	private static final String LOCATOR_NAME = "InstallerLocator";
43
	/**
44
	 * InstallerManager name used by the locator to access the instance
45
	 */
46
	public static final String INSTALLER_MANAGER_NAME = "InstallerManager";
47
	private static final String INSTALLER_MANAGER_DESCRIPTION = "InstallerManager of gvSIG";
49 48

  
50
    /**
51
     * Unique instance.
52
     */
53
    private static final InstallerLocator instance = new InstallerLocator();
49
	/**
50
	 * Unique instance.
51
	 */
52
	private static final InstallerLocator instance = new InstallerLocator();
54 53

  
55
    /**
56
     * @see Locator#getLocatorName()
57
     */
58
    public String getLocatorName() {
59
        return LOCATOR_NAME;
60
    }
54
	/**
55
	 * @see Locator#getLocatorName()
56
	 */
57
	public String getLocatorName() {
58
		return LOCATOR_NAME;
59
	}
61 60

  
62
    /**
63
     * Return a reference to {@link InstallerManager}.
64
     * 
65
     * @return a reference to InstallerManager
66
     * @throws LocatorException
67
     *             if there is no access to the class or the class cannot be
68
     *             instantiated
69
     * @see Locator#get(String)
70
     */
71
    public static InstallerManager getInstallerManager()
72
        throws LocatorException {
73
        return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME);
74
    }
61
	/**
62
	 * Return a reference to {@link InstallerManager}.
63
	 * 
64
	 * @return a reference to InstallerManager
65
	 * @throws LocatorException
66
	 *             if there is no access to the class or the class cannot be
67
	 *             instantiated
68
	 * @see Locator#get(String)
69
	 */
70
	public static InstallerManager getInstallerManager()
71
			throws LocatorException {
72
		return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME);
73
	}
75 74

  
76
    /**
77
     * Return the singleton instance.
78
     * 
79
     * @return the singleton instance
80
     */
81
    public static InstallerLocator getInstance() {
82
        return instance;
83
    }
75
	/**
76
	 * Return the singleton instance.
77
	 * 
78
	 * @return the singleton instance
79
	 */
80
	public static InstallerLocator getInstance() {
81
		return instance;
82
	}
84 83

  
85
    /**
86
     * Registers the Class implementing the {@link InstallerManager} interface.
87
     * 
88
     * @param clazz
89
     *            implementing the InstallerManager interface
90
     */
91
    public static void registerInstallerManager(
92
        Class<? extends InstallerManager> clazz) {
84
	/**
85
	 * Registers the Class implementing the {@link InstallerManager} interface.
86
	 * 
87
	 * @param clazz
88
	 *            implementing the InstallerManager interface
89
	 */
90
	public static void registerInstallerManager(
91
			Class<? extends InstallerManager> clazz) {
93 92

  
94
        getInstance().register(INSTALLER_MANAGER_NAME,
95
            INSTALLER_MANAGER_DESCRIPTION, clazz);
96
    }
93
		getInstance().register(INSTALLER_MANAGER_NAME,
94
				INSTALLER_MANAGER_DESCRIPTION, clazz);
95
	}
97 96
}
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/InstallerLibrary.java
38 38
 */
39 39
public class InstallerLibrary extends AbstractLibrary {
40 40

  
41
    @Override
42
    public void doRegistration() {
43
        registerAsAPI(InstallerLibrary.class);
44
        this.require(ToolsLibrary.class);
45
    }
41
	@Override
42
	public void doRegistration() {
43
		registerAsAPI(InstallerLibrary.class);
44
		this.require(ToolsLibrary.class);
45
	}
46 46

  
47
    @Override
48
    protected void doInitialize() throws LibraryException {
47
	@Override
48
	protected void doInitialize() throws LibraryException {
49 49
		// Nothing to do
50
    }
50
	}
51 51

  
52
    @Override
53
    protected void doPostInitialize() throws LibraryException {
52
	@Override
53
	protected void doPostInitialize() throws LibraryException {
54 54
		// Nothing to do
55
    }
55
	}
56 56

  
57 57
}
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/SimpleProgressStatus.java
21 21
 */
22 22
package org.gvsig.installer.lib.api;
23 23

  
24

  
25 24
/**
26 25
 * @author gvSIG Team
27 26
 * @version $Id$
28
 *
27
 * 
29 28
 */
30 29
public interface SimpleProgressStatus {
31
    
32
    public int getCompleted();
33
    
34
    public String getLabel();
35
    
36
    public void requestCancel();
30

  
31
	public int getCompleted();
32

  
33
	public String getLabel();
34

  
35
	public void requestCancel();
37 36
}
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/execution/InstallPackageServiceException.java
30 30
import org.gvsig.tools.exception.BaseException;
31 31

  
32 32
/**
33
 * Base exception for all the exceptions that are thrown by the process
34
 * of installation of a package. The {@link InstallPackageService} throws
35
 * this exception on its methods.
33
 * Base exception for all the exceptions that are thrown by the process of
34
 * installation of a package. The {@link InstallPackageService} throws this
35
 * exception on its methods.
36 36
 * 
37 37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
38 38
 */
39 39
public class InstallPackageServiceException extends BaseException {
40 40

  
41
    private static final String message = "Error installing a package";
42
    
43
    private static final long serialVersionUID = -7645352975209203727L;
41
	private static final String message = "Error installing a package";
44 42

  
45
    private static final String KEY = "installer_execution_exception";
43
	private static final long serialVersionUID = -7645352975209203727L;
46 44

  
47
    /**
48
     * @see BaseException#BaseException(String, long)
49
     */
50
    public InstallPackageServiceException() {
51
        super(message, KEY, serialVersionUID);
52
    }
45
	private static final String KEY = "installer_execution_exception";
53 46

  
54
    /**
55
     * @see BaseException#BaseException(Throwable, String, long)
56
     */
57
    public InstallPackageServiceException(Throwable cause) {
58
        super(message, cause, KEY, serialVersionUID);
59
    }
60
    
61
    protected InstallPackageServiceException(String message, Throwable cause, String key, long code) {
62
        super(message, cause, key, code);
63
    }
47
	/**
48
	 * @see BaseException#BaseException(String, long)
49
	 */
50
	public InstallPackageServiceException() {
51
		super(message, KEY, serialVersionUID);
52
	}
64 53

  
65
    protected InstallPackageServiceException(String message, String key, long code) {
66
        super(message, key, code);
67
    }
68
    
54
	/**
55
	 * @see BaseException#BaseException(Throwable, String, long)
56
	 */
57
	public InstallPackageServiceException(Throwable cause) {
58
		super(message, cause, KEY, serialVersionUID);
59
	}
60

  
61
	protected InstallPackageServiceException(String message, Throwable cause,
62
			String key, long code) {
63
		super(message, cause, key, code);
64
	}
65

  
66
	protected InstallPackageServiceException(String message, String key,
67
			long code) {
68
		super(message, key, code);
69
	}
70

  
69 71
}
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/execution/InstallPackageService.java
54 54
 */
55 55
public interface InstallPackageService extends Service {
56 56

  
57
    public void reset();
57
	public void reset();
58 58

  
59
    /**
60
     * Adds a the URI of a bundle that contains some packages to install. A
61
     * bundle
62
     * is a compressed zip file with a structure defined in the
63
     * {@link InstallerManager} class.
64
     * 
65
     * @param bundleURI
66
     *            the URI of a bundle.
67
     * @throws InstallPackageServiceException
68
     *             it is thrown if there is an exception reading the URI.
69
     */
70
    public void addBundle(File bundleFile)
71
        throws InstallPackageServiceException;
59
	/**
60
	 * Adds a the URI of a bundle that contains some packages to install. A
61
	 * bundle is a compressed zip file with a structure defined in the
62
	 * {@link InstallerManager} class.
63
	 * 
64
	 * @param bundleURI
65
	 *            the URI of a bundle.
66
	 * @throws InstallPackageServiceException
67
	 *             it is thrown if there is an exception reading the URI.
68
	 */
69
	public void addBundle(File bundleFile)
70
			throws InstallPackageServiceException;
72 71

  
73
    /**
74
     * Adds a URL of a bundle that contains some packages to install. A
75
     * bundle is a compressed zip file with a structure defined in the
76
     * {@link InstallerManager} class.
77
     * 
78
     * @param bundleURL
79
     *            the {@link URL} of a bundle.
80
     * @throws InstallPackageServiceException
81
     *             it is thrown if there is an exception reading the {@link URL}
82
     *             .
83
     */
84
    public void addBundle(URL bundleURL) throws InstallPackageServiceException;
72
	/**
73
	 * Adds a URL of a bundle that contains some packages to install. A bundle
74
	 * is a compressed zip file with a structure defined in the
75
	 * {@link InstallerManager} class.
76
	 * 
77
	 * @param bundleURL
78
	 *            the {@link URL} of a bundle.
79
	 * @throws InstallPackageServiceException
80
	 *             it is thrown if there is an exception reading the {@link URL}
81
	 *             .
82
	 */
83
	public void addBundle(URL bundleURL) throws InstallPackageServiceException;
85 84

  
86
    /**
87
     * In reads a directory and reads all the bundles. This method retrieve
88
     * all the information of the packages located in the bundles and allows to
89
     * the
90
     * user to show this information.
91
     * 
92
     * @param bundlesDirectory
93
     *            a directory that contains bundles.
94
     * @throws InstallPackageServiceException
95
     *             If there is any problem reading the directory of bundles.
96
     */
97
    public void addBundlesFromDirectory(File bundlesDirectory)
98
        throws InstallPackageServiceException;
85
	/**
86
	 * In reads a directory and reads all the bundles. This method retrieve all
87
	 * the information of the packages located in the bundles and allows to the
88
	 * user to show this information.
89
	 * 
90
	 * @param bundlesDirectory
91
	 *            a directory that contains bundles.
92
	 * @throws InstallPackageServiceException
93
	 *             If there is any problem reading the directory of bundles.
94
	 */
95
	public void addBundlesFromDirectory(File bundlesDirectory)
96
			throws InstallPackageServiceException;
99 97

  
100
    /**
101
     * Install a package in a concrete gvSIG installation directory. The
102
     * selected
103
     * package has to be contained in one of the bundles that has been
104
     * previously
105
     * added using the {@link #addBundle(File)} or the
106
     * {@link #addBundlesFromDirectory(File)} method.
107
     * 
108
     * @param applicationDirectory
109
     *            a valid root directory where an instance og gvSIG is
110
     *            installed.
111
     * @param packageInfo
112
     *            the package to install.
113
     * @throws InstallPackageServiceException
114
     *             If there is an error installing the package.
115
     */
116
    public void installPackage(File applicationDirectory,
117
        PackageInfo packageInfo) throws InstallPackageServiceException;
98
	/**
99
	 * Install a package in a concrete gvSIG installation directory. The
100
	 * selected package has to be contained in one of the bundles that has been
101
	 * previously added using the {@link #addBundle(File)} or the
102
	 * {@link #addBundlesFromDirectory(File)} method.
103
	 * 
104
	 * @param applicationDirectory
105
	 *            a valid root directory where an instance og gvSIG is
106
	 *            installed.
107
	 * @param packageInfo
108
	 *            the package to install.
109
	 * @throws InstallPackageServiceException
110
	 *             If there is an error installing the package.
111
	 */
112
	public void installPackage(File applicationDirectory,
113
			PackageInfo packageInfo) throws InstallPackageServiceException;
118 114

  
119
    /**
120
     * Install a package in a concrete gvSIG installation directory. The
121
     * selected
122
     * package has to be contained in one of the bundles that has been
123
     * previously
124
     * added using the {@link #addBundle(File)} or the
125
     * {@link #addBundlesFromDirectory(File)} method.
126
     * 
127
     * @param applicationDirectory
128
     *            a valid root directory where an instance og gvSIG is
129
     *            installed.
130
     * @param packageCode
131
     *            the code of the package.
132
     * @throws InstallPackageServiceException
133
     *             if there is an error installing the {@link PackageInfo#}
134
     */
135
    public void installPackage(File applicationDirectory, String packageCode)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff