KickJava   Java API By Example, From Geeks To Geeks.

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


1 package test.interop.bug360;
2
3 import org.omg.CORBA.*;
4
5 public class onewayPushConsumerImpl
6     extends onewayPushConsumerPOA
7 {
8     org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init();
9
10     public onewayPushConsumerImpl(){}
11
12     public void synchronousPush(Any a)
13     {
14         process( a );
15     }
16
17     public void onewayPush(Any a)
18     {
19        process( a );
20     }
21
22     private void process(Any a)
23     {
24     String JavaDoc result = "<empty>";
25     try
26     {
27             int kind = a.type().kind().value();
28
29         switch( kind )
30         {
31         case TCKind._tk_char:
32         result = "char: " + a.extract_char();
33         break;
34         case TCKind._tk_longlong:
35         result = "longlong: " + a.extract_longlong();
36         break;
37         case TCKind._tk_short:
38         result ="Short: " + a.extract_short();
39         break;
40         case TCKind._tk_double:
41         result = "Double: " + a.extract_double();
42         break;
43         case TCKind._tk_float:
44         result = "Float: " + a.extract_float();
45         break;
46         case TCKind._tk_string:
47         result = "String: " + a.extract_string();
48         break;
49         case TCKind._tk_wstring:
50         result = "WString: " + a.extract_wstring();
51         break;
52         case TCKind._tk_struct:
53         result = "struct " ;
54         break;
55         case TCKind._tk_union:
56         result = "union " ;
57         break;
58         case TCKind._tk_objref:
59         result = "obj " ;
60         break;
61         case TCKind._tk_any:
62         result = "any " ;
63         break;
64         case TCKind._tk_alias:
65
66         break;
67         default:
68         System.out.println("Unknown, kind " + a.type().kind().value());
69         
70         }
71     }
72     catch ( Exception JavaDoc e )
73     {
74         e.printStackTrace();
75     }
76     System.out.println(result);
77     }
78 }
79
80
81
Popular Tags