Break out and report the patching and unpacking phases.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2756 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-08-09 00:31:14 +00:00
parent 748db4d5d7
commit b9341c9430
2 changed files with 31 additions and 16 deletions
@@ -1,5 +1,5 @@
// //
// $Id: DownloadManager.java,v 1.11 2003/08/08 17:45:00 mdb Exp $ // $Id: DownloadManager.java,v 1.12 2003/08/09 00:31:14 mdb Exp $
package com.threerings.resource; package com.threerings.resource;
@@ -61,9 +61,10 @@ public class DownloadManager
public void downloadProgress (int percent, long remaining); public void downloadProgress (int percent, long remaining);
/** /**
* Called on the download thread during the patching of jar files. * Called on the download thread when the patching of jar files
* has begun.
*/ */
public void patchingProgress (int percent); public void patching ();
/** /**
* Called after the download and patching has completed on the * Called after the download and patching has completed on the
@@ -277,7 +278,6 @@ public class DownloadManager
} }
// now go through and do the post-download phase // now go through and do the post-download phase
IOException failure = null;
DownloadDescriptor fdesc = null; DownloadDescriptor fdesc = null;
for (int ii = 0; ii < size; ii++) { for (int ii = 0; ii < size; ii++) {
Downloader loader = (Downloader)fetch.get(ii); Downloader loader = (Downloader)fetch.get(ii);
@@ -288,7 +288,6 @@ public class DownloadManager
// can, so we don't fail entirely here, just keep track of // can, so we don't fail entirely here, just keep track of
// the last failure and report that when we're done // the last failure and report that when we're done
fdesc = loader.getDescriptor(); fdesc = loader.getDescriptor();
failure = ioe;
Log.warning("Downloader failed in postDownload hook " + Log.warning("Downloader failed in postDownload hook " +
"[desc=" + fdesc + "]."); "[desc=" + fdesc + "].");
Log.logStackTrace(ioe); Log.logStackTrace(ioe);
@@ -296,8 +295,10 @@ public class DownloadManager
} }
// if we had any failure, go ahead and report it now // if we had any failure, go ahead and report it now
if (failure != null) { if (fdesc != null) {
notifyFailed(obs, fdesc, failure); PatchException pe = new PatchException(
"Failed to patch one or more updated bundles.");
notifyFailed(obs, fdesc, pe);
} else { } else {
// make sure to always let the observer know that we've // make sure to always let the observer know that we've
@@ -1,5 +1,5 @@
// //
// $Id: ResourceManager.java,v 1.32 2003/08/05 01:33:20 mdb Exp $ // $Id: ResourceManager.java,v 1.33 2003/08/09 00:31:14 mdb Exp $
package com.threerings.resource; package com.threerings.resource;
@@ -118,9 +118,23 @@ public class ResourceManager
public void downloadProgress (int percent, long remaining); public void downloadProgress (int percent, long remaining);
/** /**
* Called following the call to {@link #dowloadProgress} of 100 * Called to inform the observer that the bundle patching process
* percent completion to indicate that we have validated and * has begun. This follows the download phase, but is optional.
* unpacked our bundles and are fully ready to go. */
public void patching ();
/**
* Called to inform the observer that the bundle unpacking process
* has begun. This follows the download or patching phase.
*/
public void unpacking ();
/**
* Called to indicate that we have validated and unpacked our
* bundles and are fully ready to go. A call to {@link
* #dowloadProgress} with 100 percent completion is guaranteed to
* precede this call and optionally one to {@link #patching} and
* {@link #unpacking}.
*/ */
public void downloadComplete (); public void downloadComplete ();
@@ -362,7 +376,7 @@ public class ResourceManager
public void downloadProgress (int percent, long remaining) { public void downloadProgress (int percent, long remaining) {
} }
public void patchingProgress (int percent) { public void patching () {
} }
public void postDownloadHook () { public void postDownloadHook () {
@@ -419,7 +433,7 @@ public class ResourceManager
// nothing for now // nothing for now
} }
public void patchingProgress (int percent) { public void patching () {
// nothing for now // nothing for now
} }
@@ -480,12 +494,12 @@ public class ResourceManager
obs.downloadProgress(percent, remaining); obs.downloadProgress(percent, remaining);
} }
public void patchingProgress (int percent) { public void patching () {
// TODO: obs.patching();
// obs.patchingProgress(percent)?
} }
public void postDownloadHook () { public void postDownloadHook () {
obs.unpacking();
bundlesDownloaded(); bundlesDownloaded();
} }