root / TestApp.java @ 1
History | View | Annotate | Download (1.41 KB)
1 |
import java.net.UnknownHostException; |
---|---|
2 |
import java.rmi.NotBoundException; |
3 |
import java.rmi.RemoteException; |
4 |
import java.rmi.registry.LocateRegistry; |
5 |
import java.rmi.registry.Registry; |
6 |
|
7 |
public class TestApp { |
8 |
|
9 |
public static void main(String args[]) throws RemoteException, NotBoundException, UnknownHostException { |
10 |
String peerAp = args[0]; |
11 |
String subProtocol = args[1]; |
12 |
|
13 |
Registry registry = LocateRegistry.getRegistry(); |
14 |
TestAppRemote stub = (TestAppRemote) registry.lookup(peerAp); |
15 |
|
16 |
switch (subProtocol) {
|
17 |
case "BACKUP": |
18 |
stub.backup(args[2], Integer.parseInt(args[3]), false); |
19 |
break;
|
20 |
|
21 |
case "RESTORE": |
22 |
stub.restore(args[2], false); |
23 |
break;
|
24 |
|
25 |
case "DELETE": |
26 |
stub.delete(args[2], false); |
27 |
break;
|
28 |
|
29 |
case "BACKUPENH": |
30 |
stub.backup(args[2], Integer.parseInt(args[3]), true); |
31 |
break;
|
32 |
|
33 |
case "RESTOREENH": |
34 |
stub.restore(args[2], true); |
35 |
break;
|
36 |
|
37 |
case "DELETEENH": |
38 |
stub.delete(args[2], true); |
39 |
break;
|
40 |
|
41 |
case "RECLAIM": |
42 |
stub.reclaim(Integer.parseInt(args[2])); |
43 |
break;
|
44 |
|
45 |
case "STATE": |
46 |
stub.state(); |
47 |
break;
|
48 |
|
49 |
default:
|
50 |
break;
|
51 |
} |
52 |
} |
53 |
} |