Revision 38540 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.maven/src/main/java/org/gvsig/installer/maven/AbstractGeneratePackageMojo.java
AbstractGeneratePackageMojo.java | ||
---|---|---|
38 | 38 |
import org.gvsig.installer.lib.api.PackageInfo; |
39 | 39 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageService; |
40 | 40 |
import org.gvsig.installer.lib.api.creation.MakePluginPackageServiceException; |
41 |
import org.gvsig.installer.lib.impl.utils.MD5BinaryFileUtils; |
|
41 | 42 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
42 | 43 |
import org.gvsig.tools.locator.LocatorException; |
43 | 44 |
|
... | ... | |
169 | 170 |
bos.flush(); |
170 | 171 |
bos.close(); |
171 | 172 |
fos.close(); |
173 |
|
|
174 |
writeMD5FileForBinaryFile(packageBundleFile); |
|
172 | 175 |
} catch (FileNotFoundException e) { |
173 | 176 |
throw new MojoExecutionException("Error creating the " |
174 | 177 |
+ getPackageTypeName() + " file: " + packageBundleFile, e); |
... | ... | |
185 | 188 |
+ packageName); |
186 | 189 |
} |
187 | 190 |
|
188 |
/** |
|
191 |
private void writeMD5FileForBinaryFile(File the_file) throws IOException { |
|
192 |
|
|
193 |
String md5_str = ""; |
|
194 |
try { |
|
195 |
md5_str = MD5BinaryFileUtils.getMD5Checksum(the_file); |
|
196 |
} catch (Exception ex) { |
|
197 |
throw new IOException( |
|
198 |
"Unable to compute MD5 checksum for file: " |
|
199 |
+ the_file.getAbsolutePath() + " (" + ex.getMessage() + ")"); |
|
200 |
} |
|
201 |
|
|
202 |
String separator = " *"; |
|
203 |
// for ascii file: separator = " "; |
|
204 |
|
|
205 |
md5_str = md5_str + separator + the_file.getName(); |
|
206 |
|
|
207 |
File md5_file = new File(the_file.getAbsolutePath() + ".md5"); |
|
208 |
if (md5_file.exists()) { |
|
209 |
md5_file.delete(); |
|
210 |
} |
|
211 |
|
|
212 |
FileOutputStream fos = new FileOutputStream(md5_file); |
|
213 |
BufferedOutputStream bos = new BufferedOutputStream(fos); |
|
214 |
|
|
215 |
bos.write(md5_str.getBytes()); |
|
216 |
|
|
217 |
bos.flush(); |
|
218 |
bos.close(); |
|
219 |
fos.close(); |
|
220 |
} |
|
221 |
|
|
222 |
/** |
|
189 | 223 |
* Returns the name of the package file to create. |
190 | 224 |
* |
191 | 225 |
* @param info |
Also available in: Unified diff