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