Revision 37599 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.maven/src/main/java/org/gvsig/installer/maven/GeneratePluginPackageIndexMojo.java
GeneratePluginPackageIndexMojo.java | ||
---|---|---|
36 | 36 |
* Maven mojo to launch the gvSIG installer to generate a package index of a |
37 | 37 |
* gvSIG plugin. |
38 | 38 |
* <p> |
39 |
* Look at the <a href= |
|
40 |
* "http://www.gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/anexos/proyectos-oficiales-en-gvsig/nombrado-de-binarios-para-un-plugin-de-gvsig" |
|
39 |
* Look at the <a href="http://www.gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/anexos/proyectos-oficiales-en-gvsig/nombrado-de-binarios-para-un-plugin-de-gvsig" |
|
41 | 40 |
* >gvSIG plugin naming standard</a> for information about installers naming and |
42 | 41 |
* versioning. |
43 | 42 |
* </p> |
... | ... | |
51 | 50 |
*/ |
52 | 51 |
public class GeneratePluginPackageIndexMojo extends AbstractGeneratePackageMojo { |
53 | 52 |
|
54 |
/**
|
|
55 |
* Remote plugin package base download URL.
|
|
56 |
* The base path URL where the installation package will be located.
|
|
57 |
*
|
|
58 |
* @required
|
|
59 |
* @parameter
|
|
60 |
*/
|
|
61 |
private String baseDownloadURL;
|
|
53 |
/**
|
|
54 |
* Remote plugin package base download URL. The base path URL where the
|
|
55 |
* installation package will be located.
|
|
56 |
*
|
|
57 |
* @required
|
|
58 |
* @parameter
|
|
59 |
*/
|
|
60 |
private String baseDownloadURL;
|
|
62 | 61 |
|
63 |
@Override
|
|
64 |
protected void createPackage(MakePluginPackageService makePluginService,
|
|
65 |
PackageInfo info, OutputStream os)
|
|
66 |
throws MakePluginPackageServiceException {
|
|
62 |
@Override
|
|
63 |
protected void createPackage(MakePluginPackageService makePluginService,
|
|
64 |
PackageInfo info, OutputStream os)
|
|
65 |
throws MakePluginPackageServiceException {
|
|
67 | 66 |
|
68 |
File pluginFolder = makePluginService.getPluginFolder(info);
|
|
67 |
File pluginFolder = makePluginService.getPluginFolder(info);
|
|
69 | 68 |
|
70 |
PackageInfo infoIndex; |
|
71 |
try { |
|
72 |
infoIndex = (PackageInfo) info.clone(); |
|
73 |
} catch (CloneNotSupportedException e) { |
|
74 |
throw new MakePluginPackageServiceException( |
|
75 |
"Error cloning the package info: " + info, e); |
|
76 |
} |
|
77 |
String fullDownloadURL = |
|
78 |
baseDownloadURL |
|
79 |
+ "/" |
|
80 |
+ InstallerLocator.getInstallerManager().getPackageFileName( |
|
81 |
info); |
|
82 |
try { |
|
83 |
infoIndex.setDownloadURL(new URL(fullDownloadURL)); |
|
84 |
} catch (MalformedURLException e) { |
|
85 |
throw new MakePluginPackageServiceException( |
|
86 |
"Error using as URL the text: " + fullDownloadURL, e); |
|
87 |
} |
|
69 |
PackageInfo infoIndex; |
|
70 |
try { |
|
71 |
infoIndex = (PackageInfo) info.clone(); |
|
72 |
} catch (CloneNotSupportedException e) { |
|
73 |
throw new MakePluginPackageServiceException( |
|
74 |
"Error cloning the package info: " + info, e); |
|
75 |
} |
|
76 |
String fullDownloadURL = baseDownloadURL |
|
77 |
+ "/" |
|
78 |
+ InstallerLocator.getInstallerManager().getPackageFileName( |
|
79 |
info); |
|
80 |
try { |
|
81 |
infoIndex.setDownloadURL(new URL(fullDownloadURL)); |
|
82 |
} catch (MalformedURLException e) { |
|
83 |
throw new MakePluginPackageServiceException( |
|
84 |
"Error using as URL the text: " + fullDownloadURL, e); |
|
85 |
} |
|
88 | 86 |
|
89 |
makePluginService.writePackageInfoForIndex(infoIndex, pluginFolder);
|
|
90 |
makePluginService.createPackageIndex(info, os);
|
|
91 |
}
|
|
87 |
makePluginService.writePackageInfoForIndex(infoIndex, pluginFolder);
|
|
88 |
makePluginService.createPackageIndex(info, os);
|
|
89 |
}
|
|
92 | 90 |
|
93 |
@Override
|
|
94 |
protected String getPackageTypeName() {
|
|
95 |
return "PackageIndex";
|
|
96 |
}
|
|
91 |
@Override
|
|
92 |
protected String getPackageTypeName() {
|
|
93 |
return "PackageIndex";
|
|
94 |
}
|
|
97 | 95 |
|
98 |
@Override
|
|
99 |
protected String getPackageFileName(PackageInfo info) {
|
|
100 |
return InstallerLocator.getInstallerManager().getPackageIndexFileName(
|
|
101 |
info);
|
|
102 |
}
|
|
96 |
@Override
|
|
97 |
protected String getPackageFileName(PackageInfo info) {
|
|
98 |
return InstallerLocator.getInstallerManager().getPackageIndexFileName(
|
|
99 |
info);
|
|
100 |
}
|
|
103 | 101 |
} |
Also available in: Unified diff