1 |
package uk.ac.ukc.iscream.client; |
2 |
|
3 |
import uk.ac.ukc.iscream.client.*; |
4 |
import uk.ac.ukc.iscream.clientinterface.*; |
5 |
import uk.ac.ukc.iscream.componentmanager.*; |
6 |
import org.omg.CosNaming.*; |
7 |
import org.omg.CORBA.*; |
8 |
import org.omg.PortableServer.*; |
9 |
|
10 |
public class ClientMain { |
11 |
public static void main(String args[]) { |
12 |
System.setProperty("org.omg.CORBA.ORBClass","jacorb.orb.ORB"); |
13 |
System.setProperty("org.omg.CORBA.ORBSingletonClass","jacorb.orb.ORBSingleton"); |
14 |
try { |
15 |
ReferenceManager _refman = ReferenceManager.getInstance(); |
16 |
_refman.activatePOA(); |
17 |
|
18 |
ClientServant corbaServant = new ClientServant(); |
19 |
org.omg.CORBA.Object o = _refman.getRootPOA().servant_to_reference(corbaServant); |
20 |
Client client = ClientHelper.narrow(o); |
21 |
|
22 |
o = _refman.getCORBARef("iscream.ClientInterface.CorbaListener"); |
23 |
CorbaClientListener lRef = CorbaClientListenerHelper.narrow(o); |
24 |
|
25 |
boolean result; |
26 |
System.out.println(" -- connecting -- "); |
27 |
CorbaControlHandler handler = lRef.connect(client); |
28 |
System.out.println(" -- starting data -- "); |
29 |
result = handler.startData(); |
30 |
System.out.println(" -- sleep for 30s -- "); |
31 |
Thread.sleep(30000); |
32 |
System.out.println(" -- stopping data -- "); |
33 |
result = handler.stopData(); |
34 |
Thread.sleep(2000); |
35 |
System.out.println(" -- completed -- "); |
36 |
|
37 |
} |
38 |
catch (Exception e) { |
39 |
System.out.println("ERROR : " + e); |
40 |
e.printStackTrace(System.out); |
41 |
} |
42 |
} |
43 |
|
44 |
} |