1 | org.omg.CORBA.Object s1_obj, s2_obj, |
2 | uc1_obj, uc2_obj,m1_obj,m2_obj; |
3 | GatewayContext uc1, uc2,s1,s2; |
4 | //get IOR string from fixed url |
5 | String ref = getIORFromURL(masterURL); |
6 | //convert IOR to corba object |
7 | org.omg.CORBA.Object obj = orb.string_to_object(ref); |
8 | //narrow corba Object to specific corba server type |
9 | GatewayContext master = |
10 | GatewayContextHelper.narrow(obj); |
11 | //get the proxy reference of slave server S1 |
12 | s1_obj = master.getContext("M/S1"); |
13 | s1 = GatewayContextHelper.narrow(s1_obj); |
14 | //add new user context with name "uc1" |
15 | uc1_obj = s1.addNewContext("uc1"); |
16 | //narrow it to WebFowContext |
17 | uc1 = GatewayContextHelper.narrow(uc1_obj); |
18 | m1_obj = uc1.addNewModule("timerModule_1"); |
19 | //get the proxy reference of slave server S2 |
20 | s2_obj = master.getContext("M/S2"); |
21 | s2 = GatewayContextHelper.narrow(s2_obj); |
22 | //add new user context with name "uc2" |
23 | uc2_obj = s2.addNewContext("uc2"); |
24 | //narrow it to WebFowContext |
25 | uc2 = GatewayContextHelper.narrow(uc2_obj); |
26 | m2_obj = uc1.addNewModule("timerModule_2"); |
27 | //Finally make "push" type of connection between |
28 | //modules M1and M2. Make sure you issue |
29 | //the "attachPushEvent" //command to the parent |
30 | //of event source where M1 is the source of event. |
31 | //uc1.attachPushEvent(m1_obj," timerEventData", |
32 | //m2_obj,"targetMethod"); |
33 | Continued |
34 | The sequence of Gateway API calls |
35 | to create the above distributed environment which |
36 | includes master and two slaves and two modules |
37 | and their association |