38
|
1 package christie.topology.manager;
|
|
2
|
60
|
3 import christie.annotation.Peek;
|
38
|
4 import christie.codegear.CodeGear;
|
|
5 import christie.codegear.CodeGearManager;
|
|
6
|
41
|
7 import java.util.HashMap;
|
|
8 import java.util.LinkedList;
|
|
9
|
45
|
10 import christie.topology.HostMessage;
|
41
|
11
|
38
|
12 public class TopologyManager extends CodeGear {
|
|
13
|
74
|
14 @Peek
|
|
15 TopologyManagerConfig topologyManagerConfig;
|
|
16
|
60
|
17 public TopologyManager() {
|
45
|
18 }
|
41
|
19
|
38
|
20 @Override
|
|
21 protected void run(CodeGearManager cgm) {
|
41
|
22 cgm.setup(new CheckComingHost());
|
45
|
23 getLocalDGM().put("absCookieTable", new HashMap<String, String>());
|
|
24
|
74
|
25 if(!topologyManagerConfig.dynamic) {
|
83
|
26 getLocalDGM().put("running", false);
|
74
|
27 cgm.setup(new FileParser());
|
|
28 cgm.setup(new IncomingHosts());
|
|
29 cgm.setup(new ConfigWaiter());
|
83
|
30 }else{
|
|
31 getLocalDGM().put("running", true);
|
|
32
|
|
33 if (topologyManagerConfig.type == TopologyType.Tree) {
|
|
34 getLocalDGM().put("parentManager", new ParentManager(topologyManagerConfig.hasChild));
|
|
35 getLocalDGM().put("nameTable", new HashMap<String, HostMessage>());
|
|
36 getLocalDGM().put("hostCount", 0);
|
|
37
|
92
|
38 cgm.setup(new CreateTreeTopology());
|
83
|
39 //cgm.setup(new ReceiveDisconnectMessage());
|
|
40 }
|
74
|
41 }
|
|
42
|
45
|
43 cgm.setup(new CreateHash());
|
|
44 cgm.setup(new TopologyFinish());
|
38
|
45
|
73
|
46 getLocalDGM().put("topology", new HashMap<String, HashMap<String, HostMessage>>());
|
|
47 getLocalDGM().put("createdList", new LinkedList<String>());
|
|
48
|
38
|
49 }
|
|
50
|
41
|
51
|
38
|
52 }
|