Revision 32451 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/creation/DefaultInstallerCreationService.java
DefaultInstallerCreationService.java | ||
---|---|---|
37 | 37 |
import java.io.InputStream; |
38 | 38 |
import java.io.OutputStream; |
39 | 39 |
import java.util.ArrayList; |
40 |
import java.util.Collection; |
|
41 | 40 |
import java.util.HashMap; |
42 |
import java.util.Iterator; |
|
43 | 41 |
import java.util.List; |
44 |
import java.util.ListIterator; |
|
45 | 42 |
import java.util.Map; |
46 | 43 |
|
47 |
import javax.swing.JCheckBox; |
|
48 |
|
|
49 | 44 |
import org.gvsig.installer.lib.api.InstallerInfo; |
50 | 45 |
import org.gvsig.installer.lib.api.creation.InstallerCreationService; |
51 | 46 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
52 | 47 |
import org.gvsig.installer.lib.impl.DefaultInstallerInfo; |
53 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileException; |
|
54 | 48 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileReader; |
55 | 49 |
import org.gvsig.installer.lib.impl.info.InstallerInfoFileWriter; |
56 |
import org.gvsig.tools.service.AbstractService; |
|
57 | 50 |
import org.gvsig.tools.service.Manager; |
58 | 51 |
import org.slf4j.Logger; |
59 | 52 |
|
... | ... | |
101 | 94 |
writeSelectedFiles(); |
102 | 95 |
|
103 | 96 |
Compress compress = new Compress(); |
104 |
compress.compressPlugin(getAbsoluteSelectePluginFile(), installerStream); |
|
97 |
InstallerInfo infInstallerInfo = getSelectedPlugin(); |
|
98 |
String pluginFileName = getSelectedPlugin().getCode() + "-" + infInstallerInfo.getVersion() + "-" + infInstallerInfo.getBuild(); |
|
99 |
compress.compressPlugin(getAbsoluteSelectePluginFile(), pluginFileName, installerStream); |
|
105 | 100 |
} |
106 | 101 |
|
107 | 102 |
|
... | ... | |
333 | 328 |
} |
334 | 329 |
|
335 | 330 |
public void setSelectedPlugin(int index) throws InstallerCreationServiceException { |
336 |
pluginToInstallIndex = index; |
|
337 |
|
|
338 |
|
|
339 |
//Load the ant file |
|
340 |
File antFile = new File(getAntFileName()); |
|
341 |
if (antFile.exists()){ |
|
342 |
try { |
|
343 |
loadAntFile(antFile); |
|
344 |
} catch (IOException e) { |
|
345 |
throw new InstallerCreationServiceException("Error reading the ant file"); |
|
346 |
} |
|
347 |
} |
|
348 |
|
|
349 |
//Load the files to copy |
|
350 |
File copiedFilesDirectoryfile = new File(getCopiedFilesDirectoryName()); |
|
351 |
if (copiedFilesDirectoryfile.exists()){ |
|
352 |
loadCopiedFiles(copiedFilesDirectoryfile); |
|
353 |
} |
|
331 |
if (index > installerInfos.size()){ |
|
332 |
throw new InstallerCreationServiceException("The plugin doesn't exist"); |
|
333 |
} |
|
334 |
pluginToInstallIndex = index; |
|
354 | 335 |
} |
355 | 336 |
|
356 |
public void setSelectedPlugin(String code) { |
|
357 |
pluginToInstallIndex = -1;
|
|
337 |
public void setSelectedPlugin(String code) throws InstallerCreationServiceException {
|
|
338 |
int selectedCode = -1;;
|
|
358 | 339 |
for (int i=0 ; i<getPluginsSize() ; i++){ |
359 | 340 |
if (installerInfos.get(i).getCode().equals(code)){ |
360 |
pluginToInstallIndex = i; |
|
341 |
selectedCode = i; |
|
342 |
break; |
|
361 | 343 |
} |
362 | 344 |
} |
345 |
if (selectedCode == -1){ |
|
346 |
throw new InstallerCreationServiceException("The plugin doesn't exist"); |
|
347 |
} |
|
348 |
pluginToInstallIndex = selectedCode; |
|
363 | 349 |
} |
364 | 350 |
|
365 |
public InstallerInfo getSelectedPlugin() throws InstallerCreationServiceException { |
|
366 |
return getSelectedInstallerInfo(); |
|
351 |
public InstallerInfo getSelectedPlugin() { |
|
352 |
try { |
|
353 |
return getSelectedInstallerInfo(); |
|
354 |
} catch (InstallerCreationServiceException e) { |
|
355 |
//there is not a selected plugin |
|
356 |
return null; |
|
357 |
} |
|
367 | 358 |
} |
368 | 359 |
|
369 | 360 |
public String getDefaultAntScript() throws InstallerCreationServiceException { |
Also available in: Unified diff