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