KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > interop > bug360 > Client


1 package test.interop.bug360;
2
3 import java.io.*;
4 import org.omg.CORBA.Any JavaDoc;
5 import org.omg.PortableServer.*;
6 import org.omg.CosNaming.*;
7 import org.omg.CORBA.OctetSeqHelper JavaDoc;
8 import org.omg.CORBA.StringSeqHelper JavaDoc;
9
10 public class Client
11 {
12     public static onewayPushConsumer consumer = null;
13     private static int counter;
14
15
16     public static void main( String JavaDoc[] args )
17     {
18     try
19     {
20         org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init(args,null);
21
22         // get hold of the naming service
23
NamingContextExt nc =
24                 NamingContextExtHelper.narrow( orb.resolve_initial_references("NameService"));
25
26          consumer =
27               onewayPushConsumerHelper.narrow( nc.resolve(nc.to_name("bug360.service")));
28
29         // create a new any
30
Any JavaDoc a = org.omg.CORBA.ORB.init().create_any();
31
32             Struct3 s3 =
33                 new Struct3( Enum5xxxxxxxx.E5Exxx ,
34                              (float)0.0, (float)1.1,
35                              Enum6xxxxxxxxxxxxxxxxx.E6Cxxxxxxxxxxxxx
36                              );
37             Struct2 s2 =
38                 new Struct2( Enum1.E1B,
39                              1,
40                              (float)1.1,
41                              Enum2xxxxxxxxxxxx.E2Bxxxxxxxx,
42                              (float)2.2,
43                              (float)2.2,
44                              Enum2xxxxxxxxxxxx.E2Bxxxxxxxx,
45                              Enum3xxxxxxxxxxxxxxxx.E3Cxxxxxxxxxxx,
46                              (float)3.3,
47                              Enum4xxxxxxxxxxxxx.E4Dxxxxxxxx ,
48                              s3
49                              );
50
51             Struct1Helper.insert( a, new Struct1( 1, s2 ) );
52
53         consumer.synchronousPush( a ) ;
54     
55     }
56     catch ( Exception JavaDoc e)
57     {
58         e.printStackTrace();
59     }
60     }
61 }
62
63
64
Popular Tags