summaryrefslogtreecommitdiffstats
path: root/cmds/bmgr
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-06-16 11:02:01 -0700
committerChristopher Tate <ctate@google.com>2009-06-16 13:58:17 -0700
commitf68eb500f99361541049e09eb7f9ddd6f4ef4efa (patch)
treeccb031f408b087de63baf720b13779d4d989a61d /cmds/bmgr
parent5633034f79bfa67c4219f16fd6d23e962e800be2 (diff)
downloadframeworks_base-f68eb500f99361541049e09eb7f9ddd6f4ef4efa.zip
frameworks_base-f68eb500f99361541049e09eb7f9ddd6f4ef4efa.tar.gz
frameworks_base-f68eb500f99361541049e09eb7f9ddd6f4ef4efa.tar.bz2
More bmgr work; fix clear-data signalling
The 'list sets' and 'restore token#' commands from bmgr now do what they are supposed to. At this point we see the restore target's data being cleared properly and its agent being launched and invoked for restore.
Diffstat (limited to 'cmds/bmgr')
-rw-r--r--cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java54
1 files changed, 49 insertions, 5 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index 467cac1..3af80fa 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -36,9 +36,14 @@ public final class Bmgr {
private String mCurArgData;
public static void main(String[] args) {
- new Bmgr().run(args);
+ try {
+ new Bmgr().run(args);
+ } catch (Exception e) {
+ System.err.println("Exception caught:");
+ e.printStackTrace();
+ }
}
-
+
public void run(String[] args) {
boolean validCommand = false;
if (args.length < 1) {
@@ -70,6 +75,11 @@ public final class Bmgr {
doList();
return;
}
+
+ if ("restore".equals(op)) {
+ doRestore();
+ return;
+ }
}
private void doRun() {
@@ -114,6 +124,10 @@ public final class Bmgr {
try {
int curTransport = mBmgr.getCurrentTransport();
mRestore = mBmgr.beginRestoreSession(curTransport);
+ if (mRestore == null) {
+ System.err.println(BMGR_NOT_RUNNING_ERR);
+ return;
+ }
if ("sets".equals(arg)) {
doListRestoreSets();
@@ -127,13 +141,12 @@ public final class Bmgr {
}
private void doListTransports() {
-
}
private void doListRestoreSets() {
try {
RestoreSet[] sets = mRestore.getAvailableRestoreSets();
- if (sets.length == 0) {
+ if (sets == null || sets.length == 0) {
System.out.println("No restore sets available");
} else {
for (RestoreSet s : sets) {
@@ -146,6 +159,37 @@ public final class Bmgr {
}
}
+ private void doRestore() {
+ int token;
+ try {
+ token = Integer.parseInt(nextArg());
+ } catch (NumberFormatException e) {
+ showUsage();
+ return;
+ }
+
+ try {
+ int curTransport = mBmgr.getCurrentTransport();
+ mRestore = mBmgr.beginRestoreSession(curTransport);
+ if (mRestore == null) {
+ System.err.println(BMGR_NOT_RUNNING_ERR);
+ return;
+ }
+ RestoreSet[] sets = mRestore.getAvailableRestoreSets();
+ for (RestoreSet s : sets) {
+ if (s.token == token) {
+ System.out.println("Scheduling restore: " + s.name);
+ mRestore.performRestore(token);
+ break;
+ }
+ }
+ mRestore.endRestoreSession();
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(BMGR_NOT_RUNNING_ERR);
+ }
+ }
+
private String nextArg() {
if (mNextArg >= mArgs.length) {
return null;
@@ -161,7 +205,7 @@ public final class Bmgr {
System.err.println(" bmgr list sets");
System.err.println(" #bmgr list transports");
System.err.println(" #bmgr transport which#");
- System.err.println(" #bmgr restore set#");
+ System.err.println(" bmgr restore token#");
System.err.println(" bmgr run");
}
} \ No newline at end of file