}
private void doLocalServer() throws GearsException {
LocalServer localServer = new LocalServer();
final ManagedResourceStore managedResourceStore = localServer
.createManagedResourceStore("ToCollege.net");
try {
managedResourceStore.setManifestURL(Interactive
.getRelativeURL(MANIFEST_URL));
} catch (Exception e) {
// expected in hosted mode. catches JS exception from setting
// 8080 when running on 8888
throw new GearsException(e.getMessage());
}
new Timer() {
public void run() {
switch (managedResourceStore.getUpdateStatus()) {
case ManagedResourceStore.UPDATE_OK:
Log.info("UPDATE_OK "
+ managedResourceStore.getCurrentVersion());
cancel();
break;
case ManagedResourceStore.UPDATE_CHECKING:
Log.debug("Checking "
+ managedResourceStore.getCurrentVersion());
break;
case ManagedResourceStore.UPDATE_DOWNLOADING:
Log.debug("Downloading "
+ managedResourceStore.getCurrentVersion());
break;
case ManagedResourceStore.UPDATE_FAILED:
Log.warn("Fail "
+ managedResourceStore.getCurrentVersion());
Log.warn(managedResourceStore.getLastErrorMessage());
cancel();
break;
}
}
}.scheduleRepeating(2000);
managedResourceStore.checkForUpdate();
}