org.omg.CORBA.Object s1_obj, s2_obj, |
uc1_obj, uc2_obj,m1_obj,m2_obj; |
GatewayContext uc1, uc2,s1,s2; |
//get IOR string from fixed url |
String ref = getIORFromURL(masterURL); |
//convert IOR to corba object |
org.omg.CORBA.Object obj = orb.string_to_object(ref); |
//narrow corba Object to specific corba server type |
GatewayContext master = |
GatewayContextHelper.narrow(obj); |
//get the proxy reference of slave server S1 |
s1_obj = master.getContext("M/S1"); |
s1 = GatewayContextHelper.narrow(s1_obj); |
//add new user context with name "uc1" |
uc1_obj = s1.addNewContext("uc1"); |
//narrow it to WebFowContext |
uc1 = GatewayContextHelper.narrow(uc1_obj); |
m1_obj = uc1.addNewModule("timerModule_1"); |
//get the proxy reference of slave server S2 |
s2_obj = master.getContext("M/S2"); |
s2 = GatewayContextHelper.narrow(s2_obj); |
//add new user context with name "uc2" |
uc2_obj = s2.addNewContext("uc2"); |
//narrow it to WebFowContext |
uc2 = GatewayContextHelper.narrow(uc2_obj); |
m2_obj = uc1.addNewModule("timerModule_2"); |
//Finally make "push" type of connection between |
//modules M1and M2. Make sure you issue |
//the "attachPushEvent" //command to the parent |
//of event source where M1 is the source of event. |
//uc1.attachPushEvent(m1_obj," timerEventData", |
//m2_obj,"targetMethod"); |
Continued |
The sequence of Gateway API calls |
to create the above distributed environment which |
includes master and two slaves and two modules |
and their association |