1 package net.sf.gaeappmanager.google.appengine;
2
3
4
5
6
7
8
9 public class Main {
10
11 private static void usage() {
12 System.err
13 .println("Usage: java -jar gae-app-manager.jar [full gmail address] [account password] [appspot application name]");
14 System.err.println("\nEx.:");
15 System.err
16 .println("\tjava -jar gae-app-manager.jar alois.belaska@gmail.com heslo eshopsengine");
17 }
18
19 private static void printQuota(QuotaValue qValue) {
20 StringBuilder builder = new StringBuilder();
21
22 builder.append(qValue.getQuota().name());
23 builder.append("[");
24 builder.append(qValue.getValue());
25 builder.append("/");
26 builder.append(qValue.getLimit());
27 builder.append(" (");
28 builder.append(qValue.getPercent());
29 builder.append("%)");
30
31 if (!qValue.getUnit().isEmpty()) {
32 builder.append(" ");
33 builder.append(qValue.getUnit());
34 }
35
36 builder.append(",");
37
38 if (qValue.isOkay()) {
39 builder.append("OKAY");
40 } else {
41 builder.append("NOT OKAY");
42 }
43
44 builder.append("]");
45
46 System.out.println(builder);
47 }
48
49 public static void main(String[] args) throws Exception {
50 if (args.length != 3) {
51 usage();
52 return;
53 }
54
55 QuotaDetails details = Manager.retrieveAppQuotaDetails(args[0],
56 args[1], args[2] + "-watchdog", args[2]);
57
58 System.out.println("Quotas are reset every "
59 + details.getResetIntervalHours() + " hours. Next reset: "
60 + details.getNextResetWithinHours() + " hours");
61
62 for (QuotaValue qValue : details.getValues()) {
63 printQuota(qValue);
64 }
65 }
66 }