1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package jgroup.arm;
20
21 import jgroup.core.arm.ReplicationManager;
22 import jgroup.core.registry.DependableRegistry;
23 import jgroup.core.registry.RegistryFactory;
24 import jgroup.relacs.config.AppConfig;
25 import jgroup.util.Abort;
26
27
28
29
30
31
32
33 public class ManagementClient
34 {
35
36 public static void main(String argv[])
37 throws Exception
38 {
39
40
41
42
43 DependableRegistry dregistry = RegistryFactory.getRegistry();
44
45
46
47
48
49
50 ReplicationManager replicaManager =
51 (ReplicationManager) dregistry.lookup("Jgroup/ReplicationManager");
52 System.out.println("Successful lookup: ReplicationManager");
53
54 AppConfig app = null;
55 String clazz = System.getProperty("arm.deploy.class");
56 if (clazz != null && clazz.length() > 0) {
57 app = AppConfig.getApplication(clazz);
58 }
59
60 try {
61 if (argv[0].equals("create")) {
62 System.out.println("Creating group: " + app);
63 replicaManager.createGroup(app);
64 } else if (argv[0].equals("remove")) {
65 System.out.println("Removing group: " + app);
66 replicaManager.removeGroup(app);
67 }
68 } catch (Exception exception) {
69 throw new Abort("Failed to create server", exception);
70 }
71 System.exit(0);
72 }
73
74 }