[Esbox-commits] r1883 - branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware
raul at garage.maemo.org
raul at garage.maemo.org
Tue Jul 21 00:25:01 EEST 2009
Author: raul
Date: 2009-07-21 00:24:59 +0300 (Tue, 21 Jul 2009)
New Revision: 1883
Modified:
branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadUtility.java
branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java
branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java
Log:
Updating documentation.
Modified: branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadUtility.java
===================================================================
--- branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadUtility.java 2009-07-20 19:32:46 UTC (rev 1882)
+++ branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadUtility.java 2009-07-20 21:24:59 UTC (rev 1883)
@@ -336,7 +336,7 @@
}
/**
- *
+ * Creates an error status based with the given message.
* @param message
* @return
*/
@@ -345,7 +345,7 @@
}
/**
- *
+ * Cancel download.
* @param fileDownload
* @param monitor
*/
@@ -356,11 +356,11 @@
}
/**
- *
- * @param fileSize File size (Kb)
- * @param localURL
- * @return
- * @throws IOException
+ * Check if there is enough space to uncompress the Maemo SDK virtual image.
+ * @param fileSize the size of file (in Kbytes)
+ * @param localURL the destination path to uncompress the Maemo SDK virtual image.
+ * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
+ * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
*/
private static boolean haveEnoughtFreeSpace(int fileSize, URL localURL) throws IOException {
long freeSpace = FilesystemUtils.freeSpaceOS(new Path(localURL.getPath()),true);
@@ -368,9 +368,9 @@
}
/**
- *
- * @param connection
- * @return
+ * Validate the http connection.
+ * @param connection the connection to be validated.
+ * @return an IStatus as result.
* @throws IOException
*/
private static IStatus validateConnection(HttpURLConnection connection) throws IOException {
@@ -388,10 +388,10 @@
}
/**
- *
- * @param downloadFile
- * @param progressMonitor
- * @return
+ * Download the Maemo SDK virtual image.
+ * @param downloadFile the file to be downloaded.
+ * @param progressMonitor the progress monitor.
+ * @return the status as result of installation process.
* @throws MicaException
*/
public static IStatus downloadMaemoSDKImageTool(FileDownload downloadFile, IProgressMonitor progressMonitor) throws MicaException {
Modified: branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java
===================================================================
--- branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java 2009-07-20 19:32:46 UTC (rev 1882)
+++ branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java 2009-07-20 21:24:59 UTC (rev 1883)
@@ -78,10 +78,10 @@
/**
* Install component into virtual image based on installer data information
- * @param timeout
- * @param shell
- * @param monitor
- * @return
+ * @param timeout the timeout
+ * @param shell the shell
+ * @param monitor the monitor
+ * @return the result status as result for the installation process.
*/
public IStatus installVirtualImage(int timeout, Shell shell, IProgressMonitor monitor) {
IStatus status = Activator.createStatus(IStatus.OK, "Maemo SDK Virtual Image was properly installed.");
@@ -103,12 +103,17 @@
}
if (canProceed(status) && ((installData.canInstallCppEnv() || installData.canInstallPythonEnv()))) {
- status = this.installPackages(timeout, shell, monitor);
+ status = this.installPackages(shell, monitor);
}
return status;
}
+ /**
+ * Check if can go ahead on installation based on given status.
+ * @param status the status.
+ * @return true if can go ahead on installation process; false, otherwise.
+ */
private boolean canProceed(IStatus status) {
return ! (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR));
}
@@ -167,7 +172,7 @@
final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "File " + fileName
+ " was properly uncompressed into " + destinationPath) } ;
- if (!haveEnoughtFreeSpace(fileName,destinationPath)) {
+ if (!haveEnoughFreeSpace(fileName,destinationPath)) {
return Activator.createStatus(IStatus.ERROR,"Cannot retrieve information about zipped Maemo SDK virtual image.");
}
@@ -256,6 +261,12 @@
return statuses[0];
}
+ /**
+ * Utility method to install Scratchbox into Maemo SDK virtual image.
+ * @param shell the shell
+ * @param monitor the progress monitor
+ * @return the result status of process
+ */
private IStatus installScratchbox(final Shell shell, IProgressMonitor monitor) {
monitor.subTask("Installing Scratchbox 1...");
reporter.logInfo("Installing Scratchbox 1 on Maemo SDK virtual image. This operation may take several minutes.");
@@ -273,6 +284,12 @@
return statuses[0];
}
+ /**
+ * Utility method to install Scratchbox targets into Maemo SDK virtual image.
+ * @param shell the shell
+ * @param monitor the progress monitor
+ * @return the result status of process
+ */
private IStatus installScratchboxTargets(final Shell shell, IProgressMonitor monitor) {
monitor.subTask("Installing Scratchbox 1 targets...");
reporter.logInfo("Installing Scratchbox 1 Targets on Maemo SDK virtual image. This operation may take several minutes.");
@@ -381,13 +398,13 @@
}
/**
- * Install programming environment packages (python and c++)
+ * Install programming environment packages (python and c++) into Maemo SDK virtual image.
* @param timeout
* @param shell
* @param monitor
* @return
*/
- private IStatus installPackages(int timeout, Shell shell, IProgressMonitor monitor) {
+ private IStatus installPackages(Shell shell, IProgressMonitor monitor) {
monitor.subTask("Installing programming environment...");
reporter.logInfo("Installing Python/C++ programming environment on Maemo SDK virtual image. This operation may take several minutes.");
@@ -426,7 +443,7 @@
/**
* Get current build machine.
- * @return
+ * @return current build machine or <b>null</b> if any build machine is properly configured.
*/
private IMachine getBuildMachine() {
IBuildMachine buildMachines[] =
@@ -441,6 +458,10 @@
return machine;
}
+ /**
+ * Get packages to be installed into Maemo SDK virtual image based on the given <i>MaemoSDKVMInstallData</i>.
+ * @return an array of String with packages to be installed into Maemo SDK virtual image.
+ */
private String[] checkPackagesToInstall() {
List<String> packagesToInstall = new ArrayList<String>();
@@ -456,7 +477,14 @@
return packagesToInstall.toArray(new String[packagesToInstall.size()]);
}
- private static boolean haveEnoughtFreeSpace(String fileName, String destinationPath) {
+ /**
+ * Check if there is enough space to uncompress the Maemo SDK virtual image.
+ * @param fileName the name of Maemo SDK virtual image.
+ * @param destinationPath the destination path to uncompress the Maemo SDK virtual image.
+ * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
+ * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
+ */
+ private static boolean haveEnoughFreeSpace(String fileName, String destinationPath) {
ZipInputStream zipInputStream = null;
ZipEntry zipEntry;
@@ -464,6 +492,7 @@
long fileSize = 0;
zipInputStream = new ZipInputStream(new FileInputStream(fileName));
+ // check the total size of zip file. It is necessary to check the size of each zip file entry.
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
fileSize += zipEntry.getSize();
}
Modified: branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java
===================================================================
--- branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java 2009-07-20 19:32:46 UTC (rev 1882)
+++ branches/work_Raul/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java 2009-07-20 21:24:59 UTC (rev 1883)
@@ -11,6 +11,8 @@
package org.maemo.esbox.internal.api.vm.vmware;
/**
+ * Class that combines a RandonAccessFile and an OutputStream
+ * so it can be used by other methods to download the file.
* @author raulherbster
*
*/
@@ -22,51 +24,51 @@
protected boolean sync;
/**
- *
- * @param fnm
+ * Constructor.
+ * @param fileName the name of file
* @throws IOException
*/
- public RandomFileOutputStream(String fnm) throws IOException {
- this(fnm, false);
+ public RandomFileOutputStream(String fileName) throws IOException {
+ this(fileName, false);
}
/**
- *
- * @param fnm
+ * Constructor.
+ * @param fileName the name of file
* @param syn
* @throws IOException
*/
- public RandomFileOutputStream(String fnm, boolean syn) throws IOException {
- this(new File(fnm), syn);
+ public RandomFileOutputStream(String fileName, boolean syn) throws IOException {
+ this(new File(fileName), syn);
}
/**
- *
- * @param fil
+ * Constructor.
+ * @param fileName the name of file
* @throws IOException
*/
- public RandomFileOutputStream(File fil) throws IOException {
- this(fil, false);
+ public RandomFileOutputStream(File fileName) throws IOException {
+ this(fileName, false);
}
/**
- *
- * @param fil
+ * Constructor.
+ * @param fileName the name of file
* @param syn
* @throws IOException
*/
- public RandomFileOutputStream(File fil, boolean syn) throws IOException {
+ public RandomFileOutputStream(File fileName, boolean syn) throws IOException {
super();
- fil = fil.getAbsoluteFile();
+ fileName = fileName.getAbsoluteFile();
File par; // parent file
- if ((par = fil.getParentFile()) != null) {
+ if ((par = fileName.getParentFile()) != null) {
par.mkdir();
}
- randomFile = new RandomAccessFile(fil, "rw");
+ randomFile = new RandomAccessFile(fileName, "rw");
sync = syn;
}
@@ -122,8 +124,8 @@
}
/**
- *
- * @return
+ * Get the position of file pointer.
+ * @return the position of file pointer.
* @throws IOException
*/
public long getFilePointer() throws IOException {
@@ -131,8 +133,8 @@
}
/**
- *
- * @param pos
+ * Set the position of file pointer.
+ * @param pos the position of file pointer.
* @throws IOException
*/
public void setFilePointer(long pos) throws IOException {
@@ -140,8 +142,8 @@
}
/**
- *
- * @return
+ * Get the size of this stream.
+ * @return the size of this stream.
* @throws IOException
*/
public long getFileSize() throws IOException {
@@ -149,8 +151,8 @@
}
/**
- *
- * @param len
+ * Set the size of this stream.
+ * @param len the new size of this stream
* @throws IOException
*/
public void setFileSize(long len) throws IOException {
@@ -158,12 +160,12 @@
}
/**
- *
- * @return
+ * Get the file descriptor of this stream.
+ * @return the file descriptor of this stream.
* @throws IOException
*/
public FileDescriptor getFD() throws IOException {
return randomFile.getFD();
}
-} // END PUBLIC CLASS
\ No newline at end of file
+}
More information about the Esbox-commits
mailing list