summaryrefslogtreecommitdiff
path: root/testtools/com/sun/star/comp/bridge/TestComponent.java
blob: 6fae82d5e4ae5fd6eda62357586a60bb4704c39c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
/*************************************************************************
 *
 *  $RCSfile: TestComponent.java,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: rt $ $Date: 2004-08-20 09:14:45 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

package com.sun.star.comp.bridge;

import com.sun.star.comp.loader.FactoryHelper;

import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XTypeProvider;

import com.sun.star.test.performance.ComplexTypes;
import com.sun.star.test.performance.XPerformanceTest;

import test.testtools.bridgetest.TestDataElements;
import test.testtools.bridgetest.TestElement;
import test.testtools.bridgetest.TestEnum;
import test.testtools.bridgetest.TestPolyStruct;
import test.testtools.bridgetest.XBridgeTest;
import test.testtools.bridgetest.XBridgeTest2;
import test.testtools.bridgetest.XMulti;
import test.testtools.bridgetest.XRecursiveCall;

import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;

import com.sun.star.registry.XRegistryKey;

import com.sun.star.uno.Type;



public class TestComponent {
    static public final boolean DEBUG = false;

    static public class _PerformancTestObject implements XPerformanceTest, XServiceInfo, XTypeProvider {
        static private final String __serviceName = "com.sun.star.comp.benchmark.JavaTestObject";

        private boolean  _bool;
        private char     _char;
        private byte     _byte;
        private short    _short;
        private int      _long;
        private int      _ulong;
        private long     _hyper;
        private float    _float;
        private double   _double;
        private String   _string = "";
        private Object   _xInterface;
        private Object   _any;
        private Object   _interface_sequence[] = new Object[0];
        private ComplexTypes _complexTypes = new ComplexTypes();

        // Attributes
        public int getLong_attr() throws com.sun.star.uno.RuntimeException {
            return _long;
        }

        public void setLong_attr( int _long_attr ) throws com.sun.star.uno.RuntimeException {
            _long = _long_attr;
        }

        public long getHyper_attr() throws com.sun.star.uno.RuntimeException {
            return _hyper;
        }

        public void setHyper_attr( long _hyper_attr ) throws com.sun.star.uno.RuntimeException {
            _hyper = _hyper_attr;
        }

        public float getFloat_attr() throws com.sun.star.uno.RuntimeException {
            return _float;
        }

        public void setFloat_attr( float _float_attr ) throws com.sun.star.uno.RuntimeException {
            _float = _float;
        }

        public double getDouble_attr() throws com.sun.star.uno.RuntimeException {
            return _double;
        }

        public void setDouble_attr( double _double_attr ) throws com.sun.star.uno.RuntimeException {
            _double = _double_attr;
        }

        public String getString_attr() throws com.sun.star.uno.RuntimeException {
            return _string;
        }

        public void setString_attr( String _string_attr ) throws com.sun.star.uno.RuntimeException {
            _string = _string_attr;
        }

        public Object getInterface_attr() throws com.sun.star.uno.RuntimeException {
            return _xInterface;
        }

        public void setInterface_attr( java.lang.Object _interface_attr ) throws com.sun.star.uno.RuntimeException {
            _xInterface = _interface_attr;
        }

        public Object getAny_attr() throws com.sun.star.uno.RuntimeException {
            return _any;
        }

        public void setAny_attr(Object _any_attr ) throws com.sun.star.uno.RuntimeException {
            _any = _any_attr;
        }

        public Object[] getSequence_attr() throws com.sun.star.uno.RuntimeException {
            return _interface_sequence;
        }

        public void setSequence_attr(Object[] _sequence_attr ) throws com.sun.star.uno.RuntimeException {
            _interface_sequence = _sequence_attr;
        }

        public ComplexTypes getStruct_attr() throws com.sun.star.uno.RuntimeException {
            return _complexTypes;
        }

        public void setStruct_attr( ComplexTypes _struct_attr ) throws com.sun.star.uno.RuntimeException {
            _complexTypes = _struct_attr;
        }


        // Methods
        public void async() throws com.sun.star.uno.RuntimeException {
        }

        public void sync(  ) throws com.sun.star.uno.RuntimeException {
        }

        public ComplexTypes complex_in( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException {
            return aVal;
        }

        public ComplexTypes complex_inout( /*INOUT*/ComplexTypes[] aVal ) throws com.sun.star.uno.RuntimeException {
            return aVal[0];
        }

        public void complex_oneway( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException {
        }

        public void complex_noreturn( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException {
        }

        public XPerformanceTest createObject(  ) throws com.sun.star.uno.RuntimeException {
            return new _PerformancTestObject();
        }

        public int getLong() throws com.sun.star.uno.RuntimeException {
            return _long;
        }

        public void setLong(/*IN*/int n) throws com.sun.star.uno.RuntimeException {
            _long = n;
        }

        public long getHyper() throws com.sun.star.uno.RuntimeException {
            return _hyper;
        }

        public void setHyper(/*IN*/long n) throws com.sun.star.uno.RuntimeException {
            _hyper = n;
        }

        public float getFloat() throws com.sun.star.uno.RuntimeException {
            return _float;
        }

        public void setFloat( /*IN*/float f ) throws com.sun.star.uno.RuntimeException {
            _float = f;
        }

        public double getDouble(  ) throws com.sun.star.uno.RuntimeException {
            return _double;
        }

        public void setDouble( /*IN*/double f ) throws com.sun.star.uno.RuntimeException {
            _double = f;
        }

        public String getString(  ) throws com.sun.star.uno.RuntimeException {
            return _string;
        }

        public void setString( /*IN*/String s ) throws com.sun.star.uno.RuntimeException {
            _string = s;
        }

        public Object getInterface(  ) throws com.sun.star.uno.RuntimeException {
            return _xInterface;
        }

        public void setInterface( /*IN*/Object x ) throws com.sun.star.uno.RuntimeException {
            _xInterface = x;
        }

        public Object getAny(  ) throws com.sun.star.uno.RuntimeException {
            return _any;
        }

        public void setAny( /*IN*/java.lang.Object a ) throws com.sun.star.uno.RuntimeException {
            _any = a;
        }

        public Object[] getSequence(  ) throws com.sun.star.uno.RuntimeException {
            return _interface_sequence;
        }

        public void setSequence( /*IN*/Object[] seq ) throws com.sun.star.uno.RuntimeException {
            if(DEBUG) System.err.println("#### " + getClass().getName() + ".setSequence:" + seq);

            _interface_sequence = seq;
        }

        public ComplexTypes getStruct(  ) throws com.sun.star.uno.RuntimeException {
            return _complexTypes;
        }

        public void setStruct( /*IN*/ComplexTypes c ) throws com.sun.star.uno.RuntimeException {
            _complexTypes = c;
        }

        public void raiseRuntimeException(  ) throws com.sun.star.uno.RuntimeException {
            throw new com.sun.star.uno.RuntimeException();
        }

        // XServiceInfo
        public String getImplementationName() throws com.sun.star.uno.RuntimeException {
            return __serviceName;
        }

        public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException {
            String rSNL[] = getSupportedServiceNames();

            for(int nPos = rSNL.length; (nPos--) != 0;) {
                if (rSNL[nPos].equals(rServiceName))
                    return true;
            }

            return false;
        }

        public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException {
            return new String[]{__serviceName};
        }

        // XTypeProvider
        public Type[] getTypes() throws com.sun.star.uno.RuntimeException {
            try {
                return new Type[]{new Type(XPerformanceTest.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)};
            }
            catch(Exception exception) {
                throw new com.sun.star.uno.RuntimeException(exception.getMessage());
            }
        }

        public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException {
            return toString().getBytes();
        }
    }

    static public class _TestObject implements XBridgeTest2, XRecursiveCall, XServiceInfo, XTypeProvider {
        static private final String __serviceName = "com.sun.star.test.bridge.JavaTestObject";

        private boolean  _bool;
        private char     _char;
        private byte     _byte;
        private short    _short;
        private short    _ushort;
        private int      _long;
        private int      _ulong;
        private long     _hyper;
        private long     _uhyper;
        private float    _float;
        private double   _double;
        private String   _string;
        private Object   _xInterface;
        private Object   _any;
        private TestEnum _testEnum = TestEnum.TEST;
        private TestElement _testElements[] = new TestElement[0];
        private TestDataElements _testDataElements = new TestDataElements();

        private int     _nLastCallId;
        private boolean _bFirstCall;
        private boolean _bSequenceOfCallTestPassed;

        private boolean[] arBool;
        private char[] arChar;
        private byte[] arByte;
        private short[] arShort;
        private short[] arUShort;
        private int[] arLong;
        private int[] arULong;
        private long[] arHyper;
        private long[] arUHyper;
        private float[] arFloat;
        private double[] arDouble;
        private String[] arString;
        private Object[] arObject;
        private Object[] arAny;
        private TestEnum[] arEnum;
        private int[][] arLong2;
        private int[][][] arLong3;
        public _TestObject(XMultiServiceFactory xMultiServiceFactory) {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".<init> " + xMultiServiceFactory);

            _nLastCallId = 0;
            _bFirstCall = true;
            _bSequenceOfCallTestPassed = true;
        }


        public void setValues(boolean          bBool,
                              char             cChar,
                              byte             nByte,
                              short            nShort,
                              short            nUShort,
                              int              nLong,
                              int              nULong,
                              long             nHyper,
                              long             nUHyper,
                              float            fFloat,
                              double           fDouble,
                              TestEnum         testEnum,
                              String           string,
                              Object           xInterface,
                              Object           any,
                              TestElement      testElements[],
                              TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException
        {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues:" + any);

            _bool             = bBool;
            _char             = cChar;
            _byte             = nByte;
            _short            = nShort;
            _ushort           = nUShort;
            _long             = nLong;
            _ulong            = nULong;
            _hyper            = nHyper;
            _uhyper           = nUHyper;
            _float            = fFloat;
            _double           = fDouble;
            _testEnum         = testEnum;
            _string           = string;
            _xInterface       = xInterface;
            _any              = any;
            _testElements     = testElements;
            _testDataElements = testDataElements;
        }



        public TestDataElements setValues2(/*INOUT*/boolean[]          io_bool,
                                           /*INOUT*/char[]             io_char,
                                           /*INOUT*/byte[]             io_byte,
                                           /*INOUT*/short[]            io_short,
                                           /*INOUT*/short[]            io_ushort,
                                           /*INOUT*/int[]              io_long,
                                           /*INOUT*/int[]              io_ulong,
                                           /*INOUT*/long[]             io_hyper,
                                           /*INOUT*/long[]             io_uhyper,
                                           /*INOUT*/float[]            io_float,
                                           /*INOUT*/double[]           io_double,
                                           /*INOUT*/TestEnum[]         io_testEnum,
                                           /*INOUT*/String[]           io_string,
                                           /*INOUT*/Object[]           io_xInterface,
                                           /*INOUT*/Object[]           io_any,
                                           /*INOUT*/TestElement[][]    io_testElements,
                                           /*INOUT*/TestDataElements[] io_testDataElements) throws com.sun.star.uno.RuntimeException
        {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues2:" + io_any[0]);

            _bool             = io_bool[0];
            _char             = io_char[0];
            _byte             = io_byte[0];
            _short            = io_short[0];
            _ushort           = io_ushort[0];
            _long             = io_long[0];
            _ulong            = io_ulong[0];
            _hyper            = io_hyper[0];
            _uhyper           = io_uhyper[0];
            _float            = io_float[0];
            _double           = io_double[0];
            _testEnum         = io_testEnum[0];
            _string           = io_string[0];
            _xInterface       = io_xInterface[0];
            _any              = io_any[0];
            _testElements     = io_testElements[0];
            _testDataElements = io_testDataElements[0];

            io_testElements[ 0 ] =
                new TestElement [] { io_testElements[ 0 ][ 1 ], io_testElements[ 0 ][ 0 ] };

            return _testDataElements;
        }

        public TestDataElements getValues(/*OUT*/boolean[]          o_bool,
                                          /*OUT*/char[]             o_char,
                                          /*OUT*/byte[]             o_byte,
                                          /*OUT*/short[]            o_short,
                                          /*OUT*/short[]            o_ushort,
                                          /*OUT*/int[]              o_long,
                                          /*OUT*/int[]              o_ulong,
                                          /*OUT*/long[]             o_hyper,
                                          /*OUT*/long[]             o_uhyper,
                                          /*OUT*/float[]            o_float,
                                          /*OUT*/double[]           o_double,
                                          /*OUT*/TestEnum[]         o_testEnum,
                                          /*OUT*/String[]           o_string,
                                          /*OUT*/Object[]           o_xInterface,
                                          /*OUT*/Object[]           o_any,
                                          /*OUT*/TestElement[][]    o_testElements,
                                          /*OUT*/TestDataElements[] o_testDataElements) throws com.sun.star.uno.RuntimeException
        {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".getValues:" + _any);

            o_bool[0]             = _bool;
            o_char[0]             = _char;
            o_byte[0]             = _byte;
            o_short[0]            = _short;
            o_ushort[0]           = _ushort;
            o_long[0]             = _long;
            o_ulong[0]            = _ulong;
            o_hyper[0]            = _hyper;
            o_uhyper[0]           = _uhyper;
            o_float[0]            = _float;
            o_double[0]           = _double;
            o_testEnum[0]         = _testEnum;
            o_string[0]           = _string;
              o_xInterface[0]       = _xInterface;
            o_any[0]              = _any;
            o_testElements[0]     = _testElements;
            o_testDataElements[0] = _testDataElements;

            return _testDataElements;
        }

        // Attributes
        public boolean getBool() throws com.sun.star.uno.RuntimeException {
            return _bool;
        }

        public void setBool(boolean bool) throws com.sun.star.uno.RuntimeException {
            _bool = bool;
        }

        public byte getByte() throws com.sun.star.uno.RuntimeException {
            return _byte;
        }

        public void setByte(byte zbyte) throws com.sun.star.uno.RuntimeException {
            _byte = zbyte;
        }

        public char getChar() throws com.sun.star.uno.RuntimeException {
            return _char;
        }

        public void setChar(char zchar) throws com.sun.star.uno.RuntimeException {
            _char = zchar;
        }

        public short getShort() throws com.sun.star.uno.RuntimeException {
            return _short;
        }

        public void setShort(short zshort) throws com.sun.star.uno.RuntimeException {
            _short = zshort;
        }

        public short getUShort() throws com.sun.star.uno.RuntimeException {
            return _ushort;
        }

        public void setUShort(short ushort) throws com.sun.star.uno.RuntimeException {
            _ushort = ushort;
        }

        public int getLong() throws com.sun.star.uno.RuntimeException {
            return _long;
        }

        public void setLong(int zint) throws com.sun.star.uno.RuntimeException {
            _long = zint;
        }

        public int getULong() throws com.sun.star.uno.RuntimeException {
            return _ulong;
        }

        public void setULong(int uint) throws com.sun.star.uno.RuntimeException {
            _ulong = uint;
        }

        public long getHyper() throws com.sun.star.uno.RuntimeException {
            return _hyper;
        }

        public void setHyper(long hyper) throws com.sun.star.uno.RuntimeException {
            _hyper = hyper;
        }

        public long getUHyper() throws com.sun.star.uno.RuntimeException {
            return _uhyper;
        }

        public void setUHyper(long uhyper) throws com.sun.star.uno.RuntimeException {
            _uhyper = uhyper;
        }

        public float getFloat() throws com.sun.star.uno.RuntimeException {
            return _float;
        }

        public void setFloat(float zfloat) throws com.sun.star.uno.RuntimeException {
            _float = zfloat;
        }

        public double getDouble() throws com.sun.star.uno.RuntimeException {
            return _double;
        }

        public void setDouble(double zdouble) throws com.sun.star.uno.RuntimeException {
            _double = zdouble;
        }

        public TestEnum getEnum() throws com.sun.star.uno.RuntimeException {
            return _testEnum;
        }

        public void setEnum(TestEnum testEnum) throws com.sun.star.uno.RuntimeException {
            _testEnum = testEnum;
        }

        public String getString() throws com.sun.star.uno.RuntimeException {
            return _string;
        }

        public void setString(String string) throws com.sun.star.uno.RuntimeException {
            _string = string;
        }

        public Object getInterface() throws com.sun.star.uno.RuntimeException {
            return _xInterface;
        }

        public void setInterface(Object zinterface) throws com.sun.star.uno.RuntimeException {
            _xInterface = zinterface;
        }

        public Object getAny() throws com.sun.star.uno.RuntimeException {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + _any);

            return _any;
        }

        public void setAny(Object any) throws com.sun.star.uno.RuntimeException {
            if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + any);

            _any = any;
        }

        public TestElement[] getSequence() throws com.sun.star.uno.RuntimeException {
            return _testElements;
        }

        public void setSequence(TestElement testElements[]) throws com.sun.star.uno.RuntimeException {
            _testElements = testElements;
        }

        public TestDataElements getStruct() throws com.sun.star.uno.RuntimeException {
            return _testDataElements;
        }

        public void setStruct(TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException {
            _testDataElements = testDataElements;
        }

        public int getRaiseAttr1() {
            throw new com.sun.star.uno.RuntimeException();
        }

        public void setRaiseAttr1(int n) throws IllegalArgumentException {
            throw new IllegalArgumentException();
        }

        public int getRaiseAttr2() throws IllegalArgumentException {
            throw new IllegalArgumentException();
        }

        public TestPolyStruct transportPolyBoolean(TestPolyStruct arg) {
            Boolean dummy = (Boolean) arg.member;
            return arg;
        }

        public void transportPolyHyper(TestPolyStruct[] arg) {
            Long dummy = (Long) arg[0].member;
        }

        public void transportPolySequence(
            TestPolyStruct arg1, TestPolyStruct[] arg2)
        {
            Object[] dummy = (Object[]) arg1.member;
            arg2[0] = arg1;
        }

        public TestPolyStruct getNullPolyLong() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyString() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyType() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyAny() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolySequence() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyEnum() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyBadEnum() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyStruct() {
            return new TestPolyStruct();
        }

        public TestPolyStruct getNullPolyInterface() {
            return new TestPolyStruct();
        }

        public Object transportAny(Object value) throws com.sun.star.uno.RuntimeException {
            return value;
        }

        public void call(int nCallId , int nWaitMUSEC) throws com.sun.star.uno.RuntimeException {
//              TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
//              osl_waitThread( &value );
            try {
                Thread.sleep(nWaitMUSEC / 10000);
            }
            catch(InterruptedException interruptedException) {
                throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage());
            }

            if(_bFirstCall)
                _bFirstCall = false;

            else
                _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);

            _nLastCallId = nCallId;
        }

        public void callOneway( int nCallId , int nWaitMUSEC )  throws com.sun.star.uno.RuntimeException {
//              TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
//              osl_waitThread( &value );
            try {
                Thread.sleep(nWaitMUSEC / 10000);
            }
            catch(InterruptedException interruptedException) {
                throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage());
            }

            _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);
            _nLastCallId = nCallId;
        }

        public boolean sequenceOfCallTestPassed()  throws com.sun.star.uno.RuntimeException {
            return _bSequenceOfCallTestPassed;
        }

        public synchronized void callRecursivly(XRecursiveCall xCall,   int nToCall) throws com.sun.star.uno.RuntimeException {
            if(nToCall != 0)
            {
                nToCall --;
                xCall.callRecursivly(this , nToCall);
            }
        }

        public synchronized void  startRecursiveCall(XRecursiveCall xCall, int nToCall) throws com.sun.star.uno.RuntimeException {
            if(nToCall != 0)
            {
                nToCall --;
                xCall.callRecursivly( this , nToCall );
            }
        }

        public XMulti getMulti() {
            return new XMulti() {
                    public int f1() { return 1; }

                    public int f2() { return 2; }

                    public int f3() { return 3; }

                    public int geta() { return a; }

                    public void seta(int value) { a = value; }

                    private int a;
                };
        }

        public int testMultiF1(XMulti multi) { return multi.f1(); }

        public int testMultiF2(XMulti multi) { return multi.f2(); }

        public int testMultiF3(XMulti multi) { return multi.f3(); }

        public int testMultiA(XMulti multi, int value) {
            multi.seta(value);
            return multi.geta();
        }

        // XBridgeTest
        public TestDataElements raiseException(short nArgumentPos, String rMsg, Object xContext)
            throws com.sun.star.lang.IllegalArgumentException,
                   com.sun.star.uno.RuntimeException
        {
            throw new com.sun.star.lang.IllegalArgumentException(rMsg, xContext, nArgumentPos);
        }

        public void raiseRuntimeExceptionOneway(String rMsg, Object xContext) throws com.sun.star.uno.RuntimeException {
            throw new com.sun.star.uno.RuntimeException(rMsg, xContext);
        }

        private void dothrow( com.sun.star.uno.RuntimeException t )
            throws com.sun.star.uno.RuntimeException
        {
            throw t;
        }
        public int getRuntimeException()
            throws com.sun.star.uno.RuntimeException
        {
            try
            {
                dothrow( new com.sun.star.uno.RuntimeException(
                             _string, _xInterface ) );
                return 0; // dummy
            }
            catch (com.sun.star.uno.RuntimeException t)
            {
                throw t;
            }
        }

        public void setRuntimeException(int _runtimeexception) throws com.sun.star.uno.RuntimeException {
            throw new com.sun.star.uno.RuntimeException(_string, _xInterface);
        }



        // XServiceInfo
        public String getImplementationName() throws com.sun.star.uno.RuntimeException {
            return __serviceName;
        }

        public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException {
            String rSNL[] = getSupportedServiceNames();

            for(int nPos = rSNL.length; (nPos--) != 0;) {
                if (rSNL[nPos].equals(rServiceName))
                    return true;
            }

            return false;
        }

        public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException {
            return new String[]{__serviceName};
        }

        // XTypeProvider
        public Type[] getTypes() throws com.sun.star.uno.RuntimeException {
            try {
                return new Type[]{new Type(XBridgeTest.class), new Type(XRecursiveCall.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)};
            }
            catch(Exception exception) {
                throw new com.sun.star.uno.RuntimeException(exception.getMessage());
            }
        }

        public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException {
            return toString().getBytes();
        }

        //XBridgeTest2
        public boolean[] setSequenceBool( /*IN*/boolean[] aSeq )
        {
            arBool = aSeq;
            return aSeq;
        }
        public char[] setSequenceChar( /*IN*/char[] aSeq )
        {
            arChar = aSeq;
            return aSeq;
        }
        public byte[] setSequenceByte( /*IN*/byte[] aSeq )
        {
            arByte = aSeq;
            return aSeq;
        }
        public short[] setSequenceShort( /*IN*/short[] aSeq )
        {
            arShort = aSeq;
            return aSeq;
        }
        public short[] setSequenceUShort( /*IN*/short[] aSeq )
        {
            arUShort = aSeq;
            return aSeq;
        }
        public int[] setSequenceLong( /*IN*/int[] aSeq )
        {
            arLong = aSeq;
            return aSeq;
        }
        public int[] setSequenceULong( /*IN*/int[] aSeq )
        {
            arULong = aSeq;
            return aSeq;
        }
        public long[] setSequenceHyper( /*IN*/long[] aSeq )
        {
            arHyper = aSeq;
            return aSeq;
        }
        public long[] setSequenceUHyper( /*IN*/long[] aSeq )
        {
            arUHyper = aSeq;
            return aSeq;
        }
        public float[] setSequenceFloat( /*IN*/float[] aSeq )
        {
            arFloat = aSeq;
            return aSeq;
        }
        public double[] setSequenceDouble( /*IN*/double[] aSeq )
        {
            arDouble = aSeq;
            return aSeq;
        }
        public TestEnum[] setSequenceEnum( /*IN*/TestEnum[] aSeq )
        {
            arEnum = aSeq;
            return aSeq;
        }
        public String[] setSequenceString( /*IN*/String[] aSeq )
        {
            arString = aSeq;
            return aSeq;
        }
        public java.lang.Object[] setSequenceXInterface( /*IN*/java.lang.Object[] aSeq )
        {
            arObject = aSeq;
            return aSeq;
        }
        public java.lang.Object[] setSequenceAny( /*IN*/java.lang.Object[] aSeq )
        {
            arAny = aSeq;
            return aSeq;
        }
        public TestElement[] setSequenceStruct( /*IN*/TestElement[] aSeq )
        {
            _testElements = aSeq;
            return aSeq;
        }
        public int[][] setDim2( /*IN*/int[][] aSeq )
        {
            arLong2 = aSeq;
            return aSeq;
        }
        public int[][][] setDim3( /*IN*/int[][][] aSeq )
        {
            arLong3 = aSeq;
            return aSeq;
        }
        public void setSequencesInOut( /*INOUT*/boolean[][] aSeqBoolean,
                                       /*INOUT*/char[][] aSeqChar, /*INOUT*/byte[][] aSeqByte,
                                       /*INOUT*/short[][] aSeqShort, /*INOUT*/short[][] aSeqUShort,
                                       /*INOUT*/int[][] aSeqLong, /*INOUT*/int[][] aSeqULong,
                                       /*INOUT*/long[][] aSeqHyper, /*INOUT*/long[][] aSeqUHyper,
                                       /*INOUT*/float[][] aSeqFloat, /*INOUT*/double[][] aSeqDouble,
                                       /*INOUT*/TestEnum[][] aSeqEnum, /*INOUT*/String[][] aSeqString,
                                       /*INOUT*/java.lang.Object[][] aSeqXInterface,
                                       /*INOUT*/java.lang.Object[][] aSeqAny,
                                       /*INOUT*/int[][][] aSeqDim2, /*INOUT*/int[][][][] aSeqDim3 )
        {
            arBool = aSeqBoolean[0];
            arChar = aSeqChar[0];
            arByte = aSeqByte[0];
            arShort = aSeqShort[0];
            arUShort = aSeqUShort[0];
            arLong = aSeqLong[0];
            arULong = aSeqULong[0];
            arFloat = aSeqFloat[0];
            arDouble = aSeqDouble[0];
            arEnum = aSeqEnum[0];
            arString = aSeqString[0];
            arObject = aSeqXInterface[0];
            arAny = aSeqAny[0];
            arLong2 = aSeqDim2[0];
            arLong3 = aSeqDim3[0];
        }
        public void setSequencesOut( /*OUT*/boolean[][] aSeqBoolean, /*OUT*/char[][] aSeqChar,
                                     /*OUT*/byte[][] aSeqByte, /*OUT*/short[][] aSeqShort,
                                     /*OUT*/short[][] aSeqUShort, /*OUT*/int[][] aSeqLong,
                                     /*OUT*/int[][] aSeqULong, /*OUT*/long[][] aSeqHyper,
                                     /*OUT*/long[][] aSeqUHyper, /*OUT*/float[][] aSeqFloat,
                                     /*OUT*/double[][] aSeqDouble, /*OUT*/TestEnum[][] aSeqEnum,
                                     /*OUT*/String[][] aSeqString,
                                     /*OUT*/java.lang.Object[][] aSeqXInterface,
                                     /*OUT*/java.lang.Object[][] aSeqAny, /*OUT*/int[][][] aSeqDim2,
                                     /*OUT*/int[][][][] aSeqDim3 )
        {
             aSeqBoolean[0] = arBool;
             aSeqChar[0] = arChar;
             aSeqByte[0] = arByte;
             aSeqShort[0] = arShort;
             aSeqUShort[0] = arUShort;
             aSeqLong[0] = arLong;
             aSeqULong[0] = arULong;
             aSeqHyper[0] = arHyper;
             aSeqUHyper[0] = arUHyper;
             aSeqFloat[0] = arFloat;
             aSeqDouble[0] = arDouble;
             aSeqEnum[0] = arEnum;
             aSeqString[0] = arString;
             aSeqXInterface[0] = arObject;
             aSeqAny[0] = arAny;
             aSeqDim2[0] = arLong2;
             aSeqDim3[0] = arLong3;
        }

    }

    /**
     * Gives a factory for creating the service.
     * This method is called by the <code>JavaLoader</code>
     * <p>
     * @return  returns a <code>XSingleServiceFactory</code> for creating the component
     * @param   implName     the name of the implementation for which a service is desired
     * @param   multiFactory the service manager to be uses if needed
     * @param   regKey       the registryKey
     * @see                  com.sun.star.comp.loader.JavaLoader
     */
    public static XSingleServiceFactory __getServiceFactory(String implName,
                                                            XMultiServiceFactory multiFactory,
                                                            XRegistryKey regKey)
    {
        XSingleServiceFactory xSingleServiceFactory = null;

          if(implName.equals(_TestObject.class.getName()))
            xSingleServiceFactory = FactoryHelper.getServiceFactory(_TestObject.class,
                                                                    _TestObject.__serviceName,
                                                                    multiFactory,
                                                                    regKey);

        else if(implName.equals(_PerformancTestObject.class.getName()))
            xSingleServiceFactory = FactoryHelper.getServiceFactory(_PerformancTestObject.class,
                                                                    _PerformancTestObject.__serviceName,
                                                                    multiFactory,
                                                                    regKey);

        return xSingleServiceFactory;
    }

    /**
     * Writes the service information into the given registry key.
     * This method is called by the <code>JavaLoader</code>
     * <p>
     * @return  returns true if the operation succeeded
     * @param   regKey       the registryKey
     * @see                  com.sun.star.comp.loader.JavaLoader
     */
    public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
        boolean result = true;

        result = result & FactoryHelper.writeRegistryServiceInfo(_TestObject.class.getName(), _TestObject.__serviceName, regKey);
        result = result & FactoryHelper.writeRegistryServiceInfo(_PerformancTestObject.class.getName(),
                                                                 _PerformancTestObject.__serviceName, regKey);

        return result;
    }

}