KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > outparam > serverImpl


1 package demo.outparam;
2
3 /**
4  * File: jacorb/demo/OutParam/server.java
5  *
6  * An example server for using out and inout holders
7  *
8  */

9
10 public class serverImpl
11     extends MyServerPOA
12 {
13
14     public void op1(java.lang.String JavaDoc a1,
15             stringSeqHolder/*out*/ s)
16     {
17     String JavaDoc result [] = new String JavaDoc[5];
18     for( int j = 0; j < 5; j++ )
19         result[j] = a1;
20     s.value = result;
21     }
22
23     public void op2(MyServerHolder s)
24     {
25     s.value = _this();
26     }
27
28     public void op3(my_structHolder/*out*/ m)
29     {
30     m.value = new my_struct("hallo", 4711, null);
31     }
32
33     public void op4(stringArrayHolder sah)
34     {
35     String JavaDoc s[] = new String JavaDoc[5];
36     for( int i = 0; i < 5; s[i++]= "***");
37     sah.value = s;
38     }
39
40     public String JavaDoc op5( org.omg.CORBA.StringHolder JavaDoc ws)
41     {
42         ws.value = "1234567890";
43         return "op5 done.";
44     }
45
46     public void print(String JavaDoc s)
47     {
48     System.out.println(s);
49     }
50
51     public void stringCubeInOut(stringCubeHolder/*inout*/ sc)
52     {
53     String JavaDoc [][][] string_cube = sc.value;
54
55     for( int outer = 0; outer < string_cube.length; outer++ )
56     {
57         for( int middle = 0; middle < string_cube[outer].length; middle++ )
58         {
59         for( int inner = 0; inner < string_cube[outer][middle].length; inner++ )
60         {
61             System.out.print("StringCube ["+outer+"]["+middle+"]["+inner+"]: ");
62             System.out.println(string_cube[outer][middle][inner]);
63             string_cube[outer][middle][inner] = "Returned element ["+outer+"]["+middle+"]["+inner+"]";
64         }
65         }
66     }
67         
68     }
69
70     public boolean addNums(double n1, double n2, org.omg.CORBA.DoubleHolder JavaDoc n3)
71     {
72     n3.value = n1 + n2;
73     return true;
74     }
75 }
76
77
78
Popular Tags