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;
@@ -61,9 +61,10 @@ public class DownloadManager
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
@@ -277,7 +278,6 @@ public class DownloadManager
}
// now go through and do the post-download phase
IOException failure = null;
DownloadDescriptor fdesc = null;
for (int ii = 0; ii < size; 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
// the last failure and report that when we're done
fdesc = loader.getDescriptor();
failure = ioe;
Log.warning("Downloader failed in postDownload hook " +
"[desc=" + fdesc + "].");
Log.logStackTrace(ioe);
@@ -296,8 +295,10 @@ public class DownloadManager
}
// if we had any failure, go ahead and report it now
if (failure != null) {
notifyFailed(obs, fdesc, failure);
if (fdesc != null) {
PatchException pe = new PatchException(
"Failed to patch one or more updated bundles.");
notifyFailed(obs, fdesc, pe);
} else {
// 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;
@@ -118,9 +118,23 @@ public class ResourceManager
public void downloadProgress (int percent, long remaining);
/**
* Called following the call to {@link #dowloadProgress} of 100
* percent completion to indicate that we have validated and
* unpacked our bundles and are fully ready to go.
* Called to inform the observer that the bundle patching process
* has begun. This follows the download phase, but is optional.
*/
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 ();
@@ -362,7 +376,7 @@ public class ResourceManager
public void downloadProgress (int percent, long remaining) {
}
public void patchingProgress (int percent) {
public void patching () {
}
public void postDownloadHook () {
@@ -419,7 +433,7 @@ public class ResourceManager
// nothing for now
}
public void patchingProgress (int percent) {
public void patching () {
// nothing for now
}
@@ -480,12 +494,12 @@ public class ResourceManager
obs.downloadProgress(percent, remaining);
}
public void patchingProgress (int percent) {
// TODO:
// obs.patchingProgress(percent)?
public void patching () {
obs.patching();
}
public void postDownloadHook () {
obs.unpacking();
bundlesDownloaded();
}