1 package org.jacorb.test.orb; 2 3 import org.jacorb.test.CharServerPOA; 4 import org.omg.CORBA.CharHolder ; 5 import org.jacorb.test.CharServerPackage.wcharSeqHolder; 6 import org.jacorb.test.CharServerPackage.DataFlavour; 7 import org.jacorb.test.CharServerPackage.DataFlavourHelper; 8 9 public class CharServerImpl extends CharServerPOA 10 { 11 public char bounce_char(char x) 12 { 13 return x; 14 } 15 16 public char bounce_wchar(char x) 17 { 18 return x; 19 } 20 21 public short pass_in_char(char x) 22 { 23 return ( short ) x; 24 } 25 26 public short pass_in_wchar(char x) 27 { 28 return ( short ) x; 29 } 30 31 public void pass_inout_char(CharHolder x) 32 { 33 x.value = Character.toUpperCase( x.value ); 34 } 35 36 public void pass_inout_wchar(CharHolder x) 37 { 38 x.value = Character.toUpperCase( x.value ); 39 } 40 41 public void pass_out_char(short unicode_number, CharHolder x) 42 { 43 x.value = ( char ) unicode_number; 44 } 45 46 public void pass_out_wchar(short unicode_number, CharHolder x) 47 { 48 x.value = ( char ) unicode_number; 49 } 50 51 public char return_char(short unicode_number) 52 { 53 return ( char ) unicode_number; 54 } 55 56 public char return_wchar(short unicode_number) 57 { 58 return ( char ) unicode_number; 59 } 60 61 public char[] test_wchar_seq( char[] argin, 62 wcharSeqHolder argout, 63 wcharSeqHolder arginout) 64 { 65 test( argin ); 66 test( arginout.value ); 67 68 arginout.value = new char[]{ 'a', 'a' }; 69 argout.value = new char[]{ 'a', 'a' }; 70 71 return new char[]{ 'a', 'a' }; 72 } 73 74 public org.omg.CORBA.Any return_dataflavour_inany(DataFlavour flavour) 75 { 76 if ( ! ( flavour.name.equals( "Test_Flavour" ) ) ) 77 { 78 throw new RuntimeException ( "Error - unexpected value for flavour" ); 79 } 80 81 org.omg.CORBA.Any result = org.omg.CORBA.ORB.init().create_any(); 82 DataFlavourHelper.insert( result, flavour ); 83 return result; 84 } 85 86 private void test( char[] arg ) 87 { 88 if ( arg[ 0 ] != 'a' && arg[ 1 ] != 'a' ) 89 { 90 throw new RuntimeException ( "Error - arguments do not match expected value" ); 91 } 92 } 93 } 94 | Popular Tags |