1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.comp.bridge; 25 26 import com.sun.star.comp.loader.FactoryHelper; 27 28 import com.sun.star.lang.XServiceInfo; 29 import com.sun.star.lang.XTypeProvider; 30 31 import com.sun.star.test.performance.ComplexTypes; 32 import com.sun.star.test.performance.XPerformanceTest; 33 34 import test.testtools.bridgetest.BadConstructorArguments; 35 import test.testtools.bridgetest.Constructors; 36 import test.testtools.bridgetest.Constructors2; 37 import test.testtools.bridgetest.TestDataElements; 38 import test.testtools.bridgetest.TestElement; 39 import test.testtools.bridgetest.TestEnum; 40 import test.testtools.bridgetest.TestPolyStruct; 41 import test.testtools.bridgetest.TestPolyStruct2; 42 import test.testtools.bridgetest.TestStruct; 43 import test.testtools.bridgetest.SmallStruct; 44 import test.testtools.bridgetest.MediumStruct; 45 import test.testtools.bridgetest.BigStruct; 46 import test.testtools.bridgetest.AllFloats; 47 import test.testtools.bridgetest.TwoFloats; 48 import test.testtools.bridgetest.ThreeDoubles; 49 import test.testtools.bridgetest.MixedFloatLong; 50 import test.testtools.bridgetest.OneByte; 51 import test.testtools.bridgetest.ThreeLongs; 52 import test.testtools.bridgetest.XBridgeTest; 53 import test.testtools.bridgetest.XBridgeTest2; 54 import test.testtools.bridgetest.XCurrentContextChecker; 55 import test.testtools.bridgetest.XMulti; 56 import test.testtools.bridgetest.XRecursiveCall; 57 58 59 import com.sun.star.lang.IllegalArgumentException; 60 import com.sun.star.lang.XMultiServiceFactory; 61 import com.sun.star.lang.XSingleServiceFactory; 62 63 import com.sun.star.registry.XRegistryKey; 64 65 import com.sun.star.uno.Any; 66 import com.sun.star.uno.Type; 67 import com.sun.star.uno.XComponentContext; 68 import com.sun.star.uno.XInterface; 69 70 public class TestComponent { 71 static public final boolean DEBUG = false; 72 73 static public class _PerformancTestObject implements XPerformanceTest, XServiceInfo, XTypeProvider { 74 static private final String __serviceName = "com.sun.star.comp.benchmark.JavaTestObject"; 75 76 private boolean _bool; 77 private char _char; 78 private byte _byte; 79 private short _short; 80 private int _long; 81 private int _ulong; 82 private long _hyper; 83 private float _float; 84 private double _double; 85 private String _string = ""; 86 private Object _xInterface; 87 private Object _any; 88 private Object _interface_sequence[] = new Object[0]; 89 private ComplexTypes _complexTypes = new ComplexTypes(); 90 91 // Attributes 92 public int getLong_attr() throws com.sun.star.uno.RuntimeException { 93 return _long; 94 } 95 96 public void setLong_attr( int _long_attr ) throws com.sun.star.uno.RuntimeException { 97 _long = _long_attr; 98 } 99 100 public long getHyper_attr() throws com.sun.star.uno.RuntimeException { 101 return _hyper; 102 } 103 104 public void setHyper_attr( long _hyper_attr ) throws com.sun.star.uno.RuntimeException { 105 _hyper = _hyper_attr; 106 } 107 108 public float getFloat_attr() throws com.sun.star.uno.RuntimeException { 109 return _float; 110 } 111 112 public void setFloat_attr( float _float_attr ) throws com.sun.star.uno.RuntimeException { 113 _float = _float; 114 } 115 116 public double getDouble_attr() throws com.sun.star.uno.RuntimeException { 117 return _double; 118 } 119 120 public void setDouble_attr( double _double_attr ) throws com.sun.star.uno.RuntimeException { 121 _double = _double_attr; 122 } 123 124 public String getString_attr() throws com.sun.star.uno.RuntimeException { 125 return _string; 126 } 127 128 public void setString_attr( String _string_attr ) throws com.sun.star.uno.RuntimeException { 129 _string = _string_attr; 130 } 131 132 public Object getInterface_attr() throws com.sun.star.uno.RuntimeException { 133 return _xInterface; 134 } 135 136 public void setInterface_attr( java.lang.Object _interface_attr ) throws com.sun.star.uno.RuntimeException { 137 _xInterface = _interface_attr; 138 } 139 140 public Object getAny_attr() throws com.sun.star.uno.RuntimeException { 141 return _any; 142 } 143 144 public void setAny_attr(Object _any_attr ) throws com.sun.star.uno.RuntimeException { 145 _any = _any_attr; 146 } 147 148 public Object[] getSequence_attr() throws com.sun.star.uno.RuntimeException { 149 return _interface_sequence; 150 } 151 152 public void setSequence_attr(Object[] _sequence_attr ) throws com.sun.star.uno.RuntimeException { 153 _interface_sequence = _sequence_attr; 154 } 155 156 public ComplexTypes getStruct_attr() throws com.sun.star.uno.RuntimeException { 157 return _complexTypes; 158 } 159 160 public void setStruct_attr( ComplexTypes _struct_attr ) throws com.sun.star.uno.RuntimeException { 161 _complexTypes = _struct_attr; 162 } 163 164 165 // Methods 166 public void async() throws com.sun.star.uno.RuntimeException { 167 } 168 169 public void sync( ) throws com.sun.star.uno.RuntimeException { 170 } 171 172 public ComplexTypes complex_in( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { 173 return aVal; 174 } 175 176 public ComplexTypes complex_inout( /*INOUT*/ComplexTypes[] aVal ) throws com.sun.star.uno.RuntimeException { 177 return aVal[0]; 178 } 179 180 public void complex_oneway( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { 181 } 182 183 public void complex_noreturn( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { 184 } 185 186 public XPerformanceTest createObject( ) throws com.sun.star.uno.RuntimeException { 187 return new _PerformancTestObject(); 188 } 189 190 public int getLong() throws com.sun.star.uno.RuntimeException { 191 return _long; 192 } 193 194 public void setLong(/*IN*/int n) throws com.sun.star.uno.RuntimeException { 195 _long = n; 196 } 197 198 public long getHyper() throws com.sun.star.uno.RuntimeException { 199 return _hyper; 200 } 201 202 public void setHyper(/*IN*/long n) throws com.sun.star.uno.RuntimeException { 203 _hyper = n; 204 } 205 206 public float getFloat() throws com.sun.star.uno.RuntimeException { 207 return _float; 208 } 209 210 public void setFloat( /*IN*/float f ) throws com.sun.star.uno.RuntimeException { 211 _float = f; 212 } 213 214 public double getDouble( ) throws com.sun.star.uno.RuntimeException { 215 return _double; 216 } 217 218 public void setDouble( /*IN*/double f ) throws com.sun.star.uno.RuntimeException { 219 _double = f; 220 } 221 222 public String getString( ) throws com.sun.star.uno.RuntimeException { 223 return _string; 224 } 225 226 public void setString( /*IN*/String s ) throws com.sun.star.uno.RuntimeException { 227 _string = s; 228 } 229 230 public Object getInterface( ) throws com.sun.star.uno.RuntimeException { 231 return _xInterface; 232 } 233 234 public void setInterface( /*IN*/Object x ) throws com.sun.star.uno.RuntimeException { 235 _xInterface = x; 236 } 237 238 public Object getAny( ) throws com.sun.star.uno.RuntimeException { 239 return _any; 240 } 241 242 public void setAny( /*IN*/java.lang.Object a ) throws com.sun.star.uno.RuntimeException { 243 _any = a; 244 } 245 246 public Object[] getSequence( ) throws com.sun.star.uno.RuntimeException { 247 return _interface_sequence; 248 } 249 250 public void setSequence( /*IN*/Object[] seq ) throws com.sun.star.uno.RuntimeException { 251 if(DEBUG) System.err.println("#### " + getClass().getName() + ".setSequence:" + seq); 252 253 _interface_sequence = seq; 254 } 255 256 public ComplexTypes getStruct( ) throws com.sun.star.uno.RuntimeException { 257 return _complexTypes; 258 } 259 260 public void setStruct( /*IN*/ComplexTypes c ) throws com.sun.star.uno.RuntimeException { 261 _complexTypes = c; 262 } 263 264 public void raiseRuntimeException( ) throws com.sun.star.uno.RuntimeException { 265 throw new com.sun.star.uno.RuntimeException(); 266 } 267 268 // XServiceInfo 269 public String getImplementationName() throws com.sun.star.uno.RuntimeException { 270 return __serviceName; 271 } 272 273 public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException { 274 String rSNL[] = getSupportedServiceNames(); 275 276 for(int nPos = rSNL.length; (nPos--) != 0;) { 277 if (rSNL[nPos].equals(rServiceName)) 278 return true; 279 } 280 281 return false; 282 } 283 284 public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { 285 return new String[]{__serviceName}; 286 } 287 288 // XTypeProvider 289 public Type[] getTypes() throws com.sun.star.uno.RuntimeException { 290 try { 291 return new Type[]{new Type(XPerformanceTest.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; 292 } 293 catch(Exception exception) { 294 throw new com.sun.star.uno.RuntimeException(exception.getMessage()); 295 } 296 } 297 298 public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException { 299 return toString().getBytes(); 300 } 301 } 302 303 static public class _TestObject implements XBridgeTest2, XRecursiveCall, XServiceInfo, XTypeProvider { 304 static private final String __serviceName = "com.sun.star.test.bridge.JavaTestObject"; 305 306 private boolean _bool; 307 private char _char; 308 private byte _byte; 309 private short _short; 310 private short _ushort; 311 private int _long; 312 private int _ulong; 313 private long _hyper; 314 private long _uhyper; 315 private float _float; 316 private double _double; 317 private String _string; 318 private Object _xInterface; 319 private Object _any; 320 private TestEnum _testEnum = TestEnum.TEST; 321 private TestElement _testElements[] = new TestElement[0]; 322 private TestDataElements _testDataElements = new TestDataElements(); 323 324 private int _nLastCallId; 325 private boolean _bFirstCall; 326 private boolean _bSequenceOfCallTestPassed; 327 328 private boolean[] arBool; 329 private char[] arChar; 330 private byte[] arByte; 331 private short[] arShort; 332 private short[] arUShort; 333 private int[] arLong; 334 private int[] arULong; 335 private long[] arHyper; 336 private long[] arUHyper; 337 private float[] arFloat; 338 private double[] arDouble; 339 private String[] arString; 340 private Object[] arObject; 341 private Object[] arAny; 342 private TestEnum[] arEnum; 343 private int[][] arLong2; 344 private int[][][] arLong3; 345 public _TestObject(XMultiServiceFactory xMultiServiceFactory) { 346 if(DEBUG) System.err.println("##### " + getClass().getName() + ".<init> " + xMultiServiceFactory); 347 348 _nLastCallId = 0; 349 _bFirstCall = true; 350 _bSequenceOfCallTestPassed = true; 351 } 352 353 354 public void setValues(boolean bBool, 355 char cChar, 356 byte nByte, 357 short nShort, 358 short nUShort, 359 int nLong, 360 int nULong, 361 long nHyper, 362 long nUHyper, 363 float fFloat, 364 double fDouble, 365 TestEnum testEnum, 366 String string, 367 Object xInterface, 368 Object any, 369 TestElement testElements[], 370 TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException 371 { 372 if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues:" + any); 373 374 _bool = bBool; 375 _char = cChar; 376 _byte = nByte; 377 _short = nShort; 378 _ushort = nUShort; 379 _long = nLong; 380 _ulong = nULong; 381 _hyper = nHyper; 382 _uhyper = nUHyper; 383 _float = fFloat; 384 _double = fDouble; 385 _testEnum = testEnum; 386 _string = string; 387 _xInterface = xInterface; 388 _any = any; 389 _testElements = testElements; 390 _testDataElements = testDataElements; 391 } 392 393 394 395 public TestDataElements setValues2(/*INOUT*/boolean[] io_bool, 396 /*INOUT*/char[] io_char, 397 /*INOUT*/byte[] io_byte, 398 /*INOUT*/short[] io_short, 399 /*INOUT*/short[] io_ushort, 400 /*INOUT*/int[] io_long, 401 /*INOUT*/int[] io_ulong, 402 /*INOUT*/long[] io_hyper, 403 /*INOUT*/long[] io_uhyper, 404 /*INOUT*/float[] io_float, 405 /*INOUT*/double[] io_double, 406 /*INOUT*/TestEnum[] io_testEnum, 407 /*INOUT*/String[] io_string, 408 /*INOUT*/Object[] io_xInterface, 409 /*INOUT*/Object[] io_any, 410 /*INOUT*/TestElement[][] io_testElements, 411 /*INOUT*/TestDataElements[] io_testDataElements) throws com.sun.star.uno.RuntimeException 412 { 413 if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues2:" + io_any[0]); 414 415 _bool = io_bool[0]; 416 _char = io_char[0]; 417 _byte = io_byte[0]; 418 _short = io_short[0]; 419 _ushort = io_ushort[0]; 420 _long = io_long[0]; 421 _ulong = io_ulong[0]; 422 _hyper = io_hyper[0]; 423 _uhyper = io_uhyper[0]; 424 _float = io_float[0]; 425 _double = io_double[0]; 426 _testEnum = io_testEnum[0]; 427 _string = io_string[0]; 428 _xInterface = io_xInterface[0]; 429 _any = io_any[0]; 430 _testElements = io_testElements[0]; 431 _testDataElements = io_testDataElements[0]; 432 433 io_testElements[ 0 ] = 434 new TestElement [] { io_testElements[ 0 ][ 1 ], io_testElements[ 0 ][ 0 ] }; 435 436 return _testDataElements; 437 } 438 439 public TestDataElements getValues(/*OUT*/boolean[] o_bool, 440 /*OUT*/char[] o_char, 441 /*OUT*/byte[] o_byte, 442 /*OUT*/short[] o_short, 443 /*OUT*/short[] o_ushort, 444 /*OUT*/int[] o_long, 445 /*OUT*/int[] o_ulong, 446 /*OUT*/long[] o_hyper, 447 /*OUT*/long[] o_uhyper, 448 /*OUT*/float[] o_float, 449 /*OUT*/double[] o_double, 450 /*OUT*/TestEnum[] o_testEnum, 451 /*OUT*/String[] o_string, 452 /*OUT*/Object[] o_xInterface, 453 /*OUT*/Object[] o_any, 454 /*OUT*/TestElement[][] o_testElements, 455 /*OUT*/TestDataElements[] o_testDataElements) throws com.sun.star.uno.RuntimeException 456 { 457 if(DEBUG) System.err.println("##### " + getClass().getName() + ".getValues:" + _any); 458 459 o_bool[0] = _bool; 460 o_char[0] = _char; 461 o_byte[0] = _byte; 462 o_short[0] = _short; 463 o_ushort[0] = _ushort; 464 o_long[0] = _long; 465 o_ulong[0] = _ulong; 466 o_hyper[0] = _hyper; 467 o_uhyper[0] = _uhyper; 468 o_float[0] = _float; 469 o_double[0] = _double; 470 o_testEnum[0] = _testEnum; 471 o_string[0] = _string; 472 o_xInterface[0] = _xInterface; 473 o_any[0] = _any; 474 o_testElements[0] = _testElements; 475 o_testDataElements[0] = _testDataElements; 476 477 return _testDataElements; 478 } 479 480 public SmallStruct echoSmallStruct( SmallStruct i_Struct) throws com.sun.star.uno.RuntimeException { 481 return i_Struct; 482 } 483 484 public MediumStruct echoMediumStruct( MediumStruct i_Struct) throws com.sun.star.uno.RuntimeException { 485 return i_Struct; 486 } 487 488 public BigStruct echoBigStruct( BigStruct i_Struct) throws com.sun.star.uno.RuntimeException { 489 return i_Struct; 490 } 491 492 public AllFloats echoAllFloats( AllFloats i_Struct) throws com.sun.star.uno.RuntimeException { 493 return i_Struct; 494 } 495 496 public TwoFloats echoTwoFloats( TwoFloats i_Struct) throws com.sun.star.uno.RuntimeException { 497 return i_Struct; 498 } 499 500 public ThreeDoubles echoThreeDoubles( ThreeDoubles i_Struct) throws com.sun.star.uno.RuntimeException { 501 return i_Struct; 502 } 503 504 public MixedFloatLong echoMixedFloatLong( MixedFloatLong i_Struct) throws com.sun.star.uno.RuntimeException { 505 return i_Struct; 506 } 507 508 public OneByte echoOneByte( OneByte i_Struct) throws com.sun.star.uno.RuntimeException { 509 return i_Struct; 510 } 511 512 public ThreeLongs echoThreeLongs( ThreeLongs i_Struct) throws com.sun.star.uno.RuntimeException { 513 return i_Struct; 514 } 515 516 public int testPPCAlignment( long l1, long l2, int i1, long l3, int i2 ) throws com.sun.star.uno.RuntimeException { 517 return i2; 518 } 519 520 public long testPackedStack( long a0, long a1, long a2, long a3, long a4, long a5, long a6, 521 byte b, byte c, short s, int l, byte d, long h ) 522 throws com.sun.star.uno.RuntimeException 523 { 524 return ((((long)b) << 56) | 525 (((long)(c & 0xff)) << 48) | 526 (((long)(s & 0xffff)) << 32) | 527 (((long)l) & 0xffffffffL)) ^ 528 (((long)d) << 24) ^ h; 529 } 530 531 public double testFpStack( double a0, double a1, double a2, double a3, double a4, 532 double a5, double a6, double a7, float f8, double d9 ) 533 throws com.sun.star.uno.RuntimeException 534 { 535 return (double)f8 + d9; 536 } 537 538 // Attributes 539 public boolean getBool() throws com.sun.star.uno.RuntimeException { 540 return _bool; 541 } 542 543 public void setBool(boolean bool) throws com.sun.star.uno.RuntimeException { 544 _bool = bool; 545 } 546 547 public byte getByte() throws com.sun.star.uno.RuntimeException { 548 return _byte; 549 } 550 551 public void setByte(byte zbyte) throws com.sun.star.uno.RuntimeException { 552 _byte = zbyte; 553 } 554 555 public char getChar() throws com.sun.star.uno.RuntimeException { 556 return _char; 557 } 558 559 public void setChar(char zchar) throws com.sun.star.uno.RuntimeException { 560 _char = zchar; 561 } 562 563 public short getShort() throws com.sun.star.uno.RuntimeException { 564 return _short; 565 } 566 567 public void setShort(short zshort) throws com.sun.star.uno.RuntimeException { 568 _short = zshort; 569 } 570 571 public short getUShort() throws com.sun.star.uno.RuntimeException { 572 return _ushort; 573 } 574 575 public void setUShort(short ushort) throws com.sun.star.uno.RuntimeException { 576 _ushort = ushort; 577 } 578 579 public int getLong() throws com.sun.star.uno.RuntimeException { 580 return _long; 581 } 582 583 public void setLong(int zint) throws com.sun.star.uno.RuntimeException { 584 _long = zint; 585 } 586 587 public int getULong() throws com.sun.star.uno.RuntimeException { 588 return _ulong; 589 } 590 591 public void setULong(int uint) throws com.sun.star.uno.RuntimeException { 592 _ulong = uint; 593 } 594 595 public long getHyper() throws com.sun.star.uno.RuntimeException { 596 return _hyper; 597 } 598 599 public void setHyper(long hyper) throws com.sun.star.uno.RuntimeException { 600 _hyper = hyper; 601 } 602 603 public long getUHyper() throws com.sun.star.uno.RuntimeException { 604 return _uhyper; 605 } 606 607 public void setUHyper(long uhyper) throws com.sun.star.uno.RuntimeException { 608 _uhyper = uhyper; 609 } 610 611 public float getFloat() throws com.sun.star.uno.RuntimeException { 612 return _float; 613 } 614 615 public void setFloat(float zfloat) throws com.sun.star.uno.RuntimeException { 616 _float = zfloat; 617 } 618 619 public double getDouble() throws com.sun.star.uno.RuntimeException { 620 return _double; 621 } 622 623 public void setDouble(double zdouble) throws com.sun.star.uno.RuntimeException { 624 _double = zdouble; 625 } 626 627 public TestEnum getEnum() throws com.sun.star.uno.RuntimeException { 628 return _testEnum; 629 } 630 631 public void setEnum(TestEnum testEnum) throws com.sun.star.uno.RuntimeException { 632 _testEnum = testEnum; 633 } 634 635 public String getString() throws com.sun.star.uno.RuntimeException { 636 return _string; 637 } 638 639 public void setString(String string) throws com.sun.star.uno.RuntimeException { 640 _string = string; 641 } 642 643 public Object getInterface() throws com.sun.star.uno.RuntimeException { 644 return _xInterface; 645 } 646 647 public void setInterface(Object zinterface) throws com.sun.star.uno.RuntimeException { 648 _xInterface = zinterface; 649 } 650 651 public Object getAny() throws com.sun.star.uno.RuntimeException { 652 if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + _any); 653 654 return _any; 655 } 656 657 public void setAny(Object any) throws com.sun.star.uno.RuntimeException { 658 if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + any); 659 660 _any = any; 661 } 662 663 public TestElement[] getSequence() throws com.sun.star.uno.RuntimeException { 664 return _testElements; 665 } 666 667 public void setSequence(TestElement testElements[]) throws com.sun.star.uno.RuntimeException { 668 _testElements = testElements; 669 } 670 671 public TestDataElements getStruct() throws com.sun.star.uno.RuntimeException { 672 return _testDataElements; 673 } 674 675 public void setStruct(TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException { 676 _testDataElements = testDataElements; 677 } 678 679 public int getRaiseAttr1() { 680 throw new com.sun.star.uno.RuntimeException(); 681 } 682 683 public void setRaiseAttr1(int n) throws IllegalArgumentException { 684 throw new IllegalArgumentException(); 685 } 686 687 public int getRaiseAttr2() throws IllegalArgumentException { 688 throw new IllegalArgumentException(); 689 } 690 691 public TestPolyStruct transportPolyBoolean(TestPolyStruct arg) { 692 Boolean dummy = (Boolean) arg.member; 693 return arg; 694 } 695 696 public void transportPolyHyper(TestPolyStruct[] arg) { 697 Long dummy = (Long) arg[0].member; 698 } 699 700 public void transportPolySequence( 701 TestPolyStruct arg1, TestPolyStruct[] arg2) 702 { 703 Object[] dummy = (Object[]) arg1.member; 704 arg2[0] = arg1; 705 } 706 707 public TestPolyStruct getNullPolyLong() { 708 return new TestPolyStruct(); 709 } 710 711 public TestPolyStruct getNullPolyString() { 712 return new TestPolyStruct(); 713 } 714 715 public TestPolyStruct getNullPolyType() { 716 return new TestPolyStruct(); 717 } 718 719 public TestPolyStruct getNullPolyAny() { 720 return new TestPolyStruct(); 721 } 722 723 public TestPolyStruct getNullPolySequence() { 724 return new TestPolyStruct(); 725 } 726 727 public TestPolyStruct getNullPolyEnum() { 728 return new TestPolyStruct(); 729 } 730 731 public TestPolyStruct getNullPolyBadEnum() { 732 return new TestPolyStruct(); 733 } 734 735 public TestPolyStruct getNullPolyStruct() { 736 return new TestPolyStruct(); 737 } 738 739 public TestPolyStruct getNullPolyInterface() { 740 return new TestPolyStruct(); 741 } 742 743 public Object transportAny(Object value) throws com.sun.star.uno.RuntimeException { 744 return value; 745 } 746 747 public void call(int nCallId , int nWaitMUSEC) throws com.sun.star.uno.RuntimeException { 748 // TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 }; 749 // osl_waitThread( &value ); 750 try { 751 Thread.sleep(nWaitMUSEC / 10000); 752 } 753 catch(InterruptedException interruptedException) { 754 throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage()); 755 } 756 757 if(_bFirstCall) 758 _bFirstCall = false; 759 760 else 761 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); 762 763 _nLastCallId = nCallId; 764 } 765 766 public void callOneway( int nCallId , int nWaitMUSEC ) throws com.sun.star.uno.RuntimeException { 767 // TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 }; 768 // osl_waitThread( &value ); 769 try { 770 Thread.sleep(nWaitMUSEC / 10000); 771 } 772 catch(InterruptedException interruptedException) { 773 throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage()); 774 } 775 776 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); 777 _nLastCallId = nCallId; 778 } 779 780 public boolean sequenceOfCallTestPassed() throws com.sun.star.uno.RuntimeException { 781 return _bSequenceOfCallTestPassed; 782 } 783 784 public synchronized void callRecursivly(XRecursiveCall xCall, int nToCall) throws com.sun.star.uno.RuntimeException { 785 if(nToCall != 0) 786 { 787 nToCall --; 788 xCall.callRecursivly(this , nToCall); 789 } 790 } 791 792 public synchronized void startRecursiveCall(XRecursiveCall xCall, int nToCall) throws com.sun.star.uno.RuntimeException { 793 if(nToCall != 0) 794 { 795 nToCall --; 796 xCall.callRecursivly( this , nToCall ); 797 } 798 } 799 800 public XMulti getMulti() { 801 return new XMulti() { 802 public double getatt1() { 803 return attribute1; 804 } 805 806 public void setatt1(double value) { 807 attribute1 = value; 808 } 809 810 public int fn11(int arg) { 811 return 11 * arg; 812 } 813 814 public String fn12(String arg) { 815 return "12" + arg; 816 } 817 818 public int fn21(int arg) { 819 return 21 * arg; 820 } 821 822 public String fn22(String arg) { 823 return "22" + arg; 824 } 825 826 public double getatt3() { 827 return attribute3; 828 } 829 830 public void setatt3(double value) { 831 attribute3 = value; 832 } 833 834 public int fn31(int arg) { 835 return 31 * arg; 836 } 837 838 public String fn32(String arg) { 839 return "32" + arg; 840 } 841 842 public int fn33() { 843 return 33; 844 } 845 846 public int fn41(int arg) { 847 return 41 * arg; 848 } 849 850 public int fn61(int arg) { 851 return 61 * arg; 852 } 853 854 public String fn62(String arg) { 855 return "62" + arg; 856 } 857 858 public int fn71(int arg) { 859 return 71 * arg; 860 } 861 862 public String fn72(String arg) { 863 return "72" + arg; 864 } 865 866 public int fn73() { 867 return 73; 868 } 869 870 private double attribute1 = 0.0; 871 private double attribute3 = 0.0; 872 }; 873 } 874 875 private static final class CheckFailed extends Exception { 876 CheckFailed(String message) { 877 super(message); 878 } 879 } 880 881 private static void checkEqual(int value, int argument) 882 throws CheckFailed 883 { 884 if (argument != value) { 885 throw new CheckFailed(value + " != " + argument); 886 } 887 } 888 889 private static void checkEqual(double value, double argument) 890 throws CheckFailed 891 { 892 if (argument != value) { 893 throw new CheckFailed(value + " != " + argument); 894 } 895 } 896 897 private static void checkEqual(String value, String argument) 898 throws CheckFailed 899 { 900 if (!argument.equals(value)) { 901 throw new CheckFailed(value + " != " + argument); 902 } 903 } 904 905 public String testMulti(XMulti multi) { 906 try { 907 checkEqual(0.0, multi.getatt1()); 908 multi.setatt1(0.1); 909 checkEqual(0.1, multi.getatt1()); 910 checkEqual(11 * 1, multi.fn11(1)); 911 checkEqual("12" + "abc", multi.fn12("abc")); 912 checkEqual(21 * 2, multi.fn21(2)); 913 checkEqual("22" + "de", multi.fn22("de")); 914 checkEqual(0.0, multi.getatt3()); 915 multi.setatt3(0.3); 916 checkEqual(0.3, multi.getatt3()); 917 checkEqual(31 * 3, multi.fn31(3)); 918 checkEqual("32" + "f", multi.fn32("f")); 919 checkEqual(33, multi.fn33()); 920 checkEqual(41 * 4, multi.fn41(4)); 921 checkEqual(61 * 6, multi.fn61(6)); 922 checkEqual("62" + "", multi.fn62("")); 923 checkEqual(71 * 7, multi.fn71(7)); 924 checkEqual("72" + "g", multi.fn72("g")); 925 checkEqual(73, multi.fn73()); 926 } catch (CheckFailed f) { 927 return f.getMessage(); 928 } 929 return ""; 930 } 931 932 // XBridgeTest 933 public TestDataElements raiseException(short nArgumentPos, String rMsg, Object xContext) 934 throws com.sun.star.lang.IllegalArgumentException, 935 com.sun.star.uno.RuntimeException 936 { 937 throw new com.sun.star.lang.IllegalArgumentException(rMsg, xContext, nArgumentPos); 938 } 939 940 public void raiseRuntimeExceptionOneway(String rMsg, Object xContext) throws com.sun.star.uno.RuntimeException { 941 throw new com.sun.star.uno.RuntimeException(rMsg, xContext); 942 } 943 944 private void dothrow( com.sun.star.uno.RuntimeException t ) 945 throws com.sun.star.uno.RuntimeException 946 { 947 throw t; 948 } 949 public int getRuntimeException() 950 throws com.sun.star.uno.RuntimeException 951 { 952 try 953 { 954 dothrow( new com.sun.star.uno.RuntimeException( 955 _string, _xInterface ) ); 956 return 0; // dummy 957 } 958 catch (com.sun.star.uno.RuntimeException t) 959 { 960 throw t; 961 } 962 } 963 964 public void setRuntimeException(int _runtimeexception) throws com.sun.star.uno.RuntimeException { 965 throw new com.sun.star.uno.RuntimeException(_string, _xInterface); 966 } 967 968 969 970 // XServiceInfo 971 public String getImplementationName() throws com.sun.star.uno.RuntimeException { 972 return __serviceName; 973 } 974 975 public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException { 976 String rSNL[] = getSupportedServiceNames(); 977 978 for(int nPos = rSNL.length; (nPos--) != 0;) { 979 if (rSNL[nPos].equals(rServiceName)) 980 return true; 981 } 982 983 return false; 984 } 985 986 public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { 987 return new String[]{__serviceName}; 988 } 989 990 // XTypeProvider 991 public Type[] getTypes() throws com.sun.star.uno.RuntimeException { 992 try { 993 return new Type[]{new Type(XBridgeTest.class), new Type(XRecursiveCall.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; 994 } 995 catch(Exception exception) { 996 throw new com.sun.star.uno.RuntimeException(exception.getMessage()); 997 } 998 } 999 1000 public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException { 1001 return toString().getBytes(); 1002 } 1003 1004 //XBridgeTest2 1005 public boolean[] setSequenceBool( /*IN*/boolean[] aSeq ) 1006 { 1007 arBool = aSeq; 1008 return aSeq; 1009 } 1010 public char[] setSequenceChar( /*IN*/char[] aSeq ) 1011 { 1012 arChar = aSeq; 1013 return aSeq; 1014 } 1015 public byte[] setSequenceByte( /*IN*/byte[] aSeq ) 1016 { 1017 arByte = aSeq; 1018 return aSeq; 1019 } 1020 public short[] setSequenceShort( /*IN*/short[] aSeq ) 1021 { 1022 arShort = aSeq; 1023 return aSeq; 1024 } 1025 public short[] setSequenceUShort( /*IN*/short[] aSeq ) 1026 { 1027 arUShort = aSeq; 1028 return aSeq; 1029 } 1030 public int[] setSequenceLong( /*IN*/int[] aSeq ) 1031 { 1032 arLong = aSeq; 1033 return aSeq; 1034 } 1035 public int[] setSequenceULong( /*IN*/int[] aSeq ) 1036 { 1037 arULong = aSeq; 1038 return aSeq; 1039 } 1040 public long[] setSequenceHyper( /*IN*/long[] aSeq ) 1041 { 1042 arHyper = aSeq; 1043 return aSeq; 1044 } 1045 public long[] setSequenceUHyper( /*IN*/long[] aSeq ) 1046 { 1047 arUHyper = aSeq; 1048 return aSeq; 1049 } 1050 public float[] setSequenceFloat( /*IN*/float[] aSeq ) 1051 { 1052 arFloat = aSeq; 1053 return aSeq; 1054 } 1055 public double[] setSequenceDouble( /*IN*/double[] aSeq ) 1056 { 1057 arDouble = aSeq; 1058 return aSeq; 1059 } 1060 public TestEnum[] setSequenceEnum( /*IN*/TestEnum[] aSeq ) 1061 { 1062 arEnum = aSeq; 1063 return aSeq; 1064 } 1065 public String[] setSequenceString( /*IN*/String[] aSeq ) 1066 { 1067 arString = aSeq; 1068 return aSeq; 1069 } 1070 public java.lang.Object[] setSequenceXInterface( /*IN*/java.lang.Object[] aSeq ) 1071 { 1072 arObject = aSeq; 1073 return aSeq; 1074 } 1075 public java.lang.Object[] setSequenceAny( /*IN*/java.lang.Object[] aSeq ) 1076 { 1077 arAny = aSeq; 1078 return aSeq; 1079 } 1080 public TestElement[] setSequenceStruct( /*IN*/TestElement[] aSeq ) 1081 { 1082 _testElements = aSeq; 1083 return aSeq; 1084 } 1085 public int[][] setDim2( /*IN*/int[][] aSeq ) 1086 { 1087 arLong2 = aSeq; 1088 return aSeq; 1089 } 1090 public int[][][] setDim3( /*IN*/int[][][] aSeq ) 1091 { 1092 arLong3 = aSeq; 1093 return aSeq; 1094 } 1095 public void setSequencesInOut( /*INOUT*/boolean[][] aSeqBoolean, 1096 /*INOUT*/char[][] aSeqChar, /*INOUT*/byte[][] aSeqByte, 1097 /*INOUT*/short[][] aSeqShort, /*INOUT*/short[][] aSeqUShort, 1098 /*INOUT*/int[][] aSeqLong, /*INOUT*/int[][] aSeqULong, 1099 /*INOUT*/long[][] aSeqHyper, /*INOUT*/long[][] aSeqUHyper, 1100 /*INOUT*/float[][] aSeqFloat, /*INOUT*/double[][] aSeqDouble, 1101 /*INOUT*/TestEnum[][] aSeqEnum, /*INOUT*/String[][] aSeqString, 1102 /*INOUT*/java.lang.Object[][] aSeqXInterface, 1103 /*INOUT*/java.lang.Object[][] aSeqAny, 1104 /*INOUT*/int[][][] aSeqDim2, /*INOUT*/int[][][][] aSeqDim3 ) 1105 { 1106 arBool = aSeqBoolean[0]; 1107 arChar = aSeqChar[0]; 1108 arByte = aSeqByte[0]; 1109 arShort = aSeqShort[0]; 1110 arUShort = aSeqUShort[0]; 1111 arLong = aSeqLong[0]; 1112 arULong = aSeqULong[0]; 1113 arFloat = aSeqFloat[0]; 1114 arDouble = aSeqDouble[0]; 1115 arEnum = aSeqEnum[0]; 1116 arString = aSeqString[0]; 1117 arObject = aSeqXInterface[0]; 1118 arAny = aSeqAny[0]; 1119 arLong2 = aSeqDim2[0]; 1120 arLong3 = aSeqDim3[0]; 1121 } 1122 public void setSequencesOut( /*OUT*/boolean[][] aSeqBoolean, /*OUT*/char[][] aSeqChar, 1123 /*OUT*/byte[][] aSeqByte, /*OUT*/short[][] aSeqShort, 1124 /*OUT*/short[][] aSeqUShort, /*OUT*/int[][] aSeqLong, 1125 /*OUT*/int[][] aSeqULong, /*OUT*/long[][] aSeqHyper, 1126 /*OUT*/long[][] aSeqUHyper, /*OUT*/float[][] aSeqFloat, 1127 /*OUT*/double[][] aSeqDouble, /*OUT*/TestEnum[][] aSeqEnum, 1128 /*OUT*/String[][] aSeqString, 1129 /*OUT*/java.lang.Object[][] aSeqXInterface, 1130 /*OUT*/java.lang.Object[][] aSeqAny, /*OUT*/int[][][] aSeqDim2, 1131 /*OUT*/int[][][][] aSeqDim3 ) 1132 { 1133 aSeqBoolean[0] = arBool; 1134 aSeqChar[0] = arChar; 1135 aSeqByte[0] = arByte; 1136 aSeqShort[0] = arShort; 1137 aSeqUShort[0] = arUShort; 1138 aSeqLong[0] = arLong; 1139 aSeqULong[0] = arULong; 1140 aSeqHyper[0] = arHyper; 1141 aSeqUHyper[0] = arUHyper; 1142 aSeqFloat[0] = arFloat; 1143 aSeqDouble[0] = arDouble; 1144 aSeqEnum[0] = arEnum; 1145 aSeqString[0] = arString; 1146 aSeqXInterface[0] = arObject; 1147 aSeqAny[0] = arAny; 1148 aSeqDim2[0] = arLong2; 1149 aSeqDim3[0] = arLong3; 1150 } 1151 1152 public void testConstructorsService(XComponentContext context) 1153 throws BadConstructorArguments 1154 { 1155 Constructors.create1(context, 1156 true, 1157 Byte.MIN_VALUE, 1158 Short.MIN_VALUE, 1159 (short) -1, 1160 Integer.MIN_VALUE, 1161 -1, 1162 Long.MIN_VALUE, 1163 -1L, 1164 0.123f, 1165 0.456, 1166 'X', 1167 "test", 1168 Type.ANY, 1169 new Any(Type.BOOLEAN, Boolean.TRUE), 1170 new boolean[] { true }, 1171 new byte[] { Byte.MIN_VALUE }, 1172 new short[] { Short.MIN_VALUE }, 1173 new short[] { (short) -1 }, 1174 new int[] { Integer.MIN_VALUE }, 1175 new int[] { -1 }, 1176 new long[] { Long.MIN_VALUE }, 1177 new long[] { -1L }, 1178 new float[] { 0.123f }, 1179 new double[] { 0.456 }, 1180 new char[] { 'X' }, 1181 new String[] { "test" }, 1182 new Type[] { Type.ANY }, 1183 new Boolean[] { Boolean.TRUE }, 1184 new boolean[][] { new boolean[] { true } }, 1185 new Object[][] { 1186 new Object[] { new Any(Type.BOOLEAN, Boolean.TRUE) } }, 1187 new TestEnum[] { TestEnum.TWO }, 1188 new TestStruct[] { new TestStruct(10) }, 1189 new TestPolyStruct[] { new TestPolyStruct(Boolean.TRUE) }, 1190 new TestPolyStruct[] { 1191 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)) }, 1192 new Object[] { null }, 1193 TestEnum.TWO, 1194 new TestStruct(10), 1195 new TestPolyStruct(Boolean.TRUE), 1196 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)), 1197 null); 1198 Constructors.create2(context, new Object[] { 1199 Boolean.TRUE, 1200 new Byte(Byte.MIN_VALUE), 1201 new Short(Short.MIN_VALUE), 1202 new Any(Type.UNSIGNED_SHORT, new Short((short) -1)), 1203 new Integer(Integer.MIN_VALUE), 1204 new Any(Type.UNSIGNED_LONG, new Integer(-1)), 1205 new Long(Long.MIN_VALUE), 1206 new Any(Type.UNSIGNED_HYPER, new Long(-1L)), 1207 new Float(0.123f), 1208 new Double(0.456), 1209 new Character('X'), 1210 "test", 1211 Type.ANY, 1212 new Any(Type.BOOLEAN, Boolean.TRUE), 1213 new boolean[] { true }, 1214 new byte[] { Byte.MIN_VALUE }, 1215 new short[] { Short.MIN_VALUE }, 1216 new Any( 1217 new Type("[]unsigned short"), new short[] { (short) -1 }), 1218 new int[] { Integer.MIN_VALUE }, 1219 new Any(new Type("[]unsigned long"), new int[] { -1 }), 1220 new long[] { Long.MIN_VALUE }, 1221 new Any(new Type("[]unsigned hyper"), new long[] { -1L }), 1222 new float[] { 0.123f }, 1223 new double[] { 0.456 }, 1224 new char[] { 'X' }, 1225 new String[] { "test" }, 1226 new Type[] { Type.ANY }, 1227 new Any(new Type("[]any"), new Boolean[] { Boolean.TRUE }), 1228 new boolean[][] { new boolean[] { true } }, 1229 new Object[][] { 1230 new Object[] { new Any(Type.BOOLEAN, Boolean.TRUE) } }, 1231 new TestEnum[] { TestEnum.TWO }, 1232 new TestStruct[] { new TestStruct(10) }, 1233 new Any( 1234 new Type( 1235 "[]test.testtools.bridgetest.TestPolyStruct<boolean>"), 1236 new TestPolyStruct[] { new TestPolyStruct(Boolean.TRUE) }), 1237 new Any( 1238 new Type("[]test.testtools.bridgetest.TestPolyStruct<any>"), 1239 new TestPolyStruct[] { 1240 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)) 1241 }), 1242 new XInterface[] { null }, 1243 TestEnum.TWO, 1244 new TestStruct(10), 1245 new Any( 1246 new Type( 1247 "test.testtools.bridgetest.TestPolyStruct<boolean>"), 1248 new TestPolyStruct(Boolean.TRUE)), 1249 new Any( 1250 new Type("test.testtools.bridgetest.TestPolyStruct<any>"), 1251 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))), 1252 null }); 1253 Constructors2.create1( 1254 context, 1255 new TestPolyStruct(Type.LONG), 1256 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)), 1257 new TestPolyStruct(new Boolean(true)), 1258 new TestPolyStruct(new Byte(Byte.MIN_VALUE)), 1259 new TestPolyStruct(new Short(Short.MIN_VALUE)), 1260 new TestPolyStruct(new Integer(Integer.MIN_VALUE)), 1261 new TestPolyStruct(new Long(Long.MIN_VALUE)), 1262 new TestPolyStruct(new Character('X')), 1263 new TestPolyStruct("test"), 1264 new TestPolyStruct(new Float(0.123f)), 1265 new TestPolyStruct(new Double(0.456)), 1266 new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()), 1267 new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()), 1268 new TestPolyStruct(TestEnum.TWO), 1269 new TestPolyStruct(new TestPolyStruct2(new Character('X'), 1270 new Any(Type.BOOLEAN, Boolean.TRUE))), 1271 new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2( 1272 new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test")), 1273 new TestPolyStruct2("test", new TestPolyStruct2(new Character('X'), 1274 new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)))), 1275 new TestPolyStruct2( new TestPolyStruct2(new Character('X'), 1276 new Any(Type.BOOLEAN, Boolean.TRUE)), new TestPolyStruct(new Character('X'))), 1277 new TestPolyStruct(new Type[] { Type.LONG}), 1278 new TestPolyStruct(new Any[] { new Any(Type.BOOLEAN, Boolean.TRUE) }), 1279 new TestPolyStruct(new boolean[] {true}), 1280 new TestPolyStruct(new byte[] {Byte.MIN_VALUE}), 1281 new TestPolyStruct(new short[] {Short.MIN_VALUE}), 1282 new TestPolyStruct(new int[] {Integer.MIN_VALUE}), 1283 new TestPolyStruct(new long[] {Long.MIN_VALUE}), 1284 new TestPolyStruct(new char[] {'X'}), 1285 new TestPolyStruct(new String[] {"test"}), 1286 new TestPolyStruct(new float[] {0.123f}), 1287 new TestPolyStruct(new double[] {0.456d}), 1288 new TestPolyStruct(new Object[] {new com.sun.star.lib.uno.helper.ComponentBase()}), 1289 new TestPolyStruct(new com.sun.star.lang.XComponent[] {new com.sun.star.lib.uno.helper.ComponentBase()}), 1290 new TestPolyStruct(new TestEnum[] {TestEnum.TWO}), 1291 new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2( 1292 new Character('X'), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}), 1293 new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2( 1294 new TestPolyStruct(new Character('X')), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}), 1295 new TestPolyStruct(new int[][] { new int[] {Integer.MIN_VALUE} }), 1296 new TestPolyStruct[]{ new TestPolyStruct(new Integer(Integer.MIN_VALUE))}, 1297 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2( 1298 new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}, 1299 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2( 1300 new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}, 1301 new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2( 1302 new Character('X'), new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}, 1303 new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2(new Character('X'), new Any( 1304 Type.BOOLEAN, Boolean.TRUE)),new TestPolyStruct(new Character('X')))}, 1305 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new Character('X'))}}, 1306 new TestPolyStruct[][]{new TestPolyStruct[]{ 1307 new TestPolyStruct(new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}}, 1308 new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2( 1309 new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}}, 1310 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2( 1311 "test", new TestPolyStruct2(new Character('X'),new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}}, 1312 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2( 1313 new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), 1314 new TestPolyStruct(new Character('X')))}}); 1315 } 1316 1317 public XCurrentContextChecker getCurrentContextChecker() { 1318 return new CurrentContextChecker(); 1319 } 1320 } 1321 1322 /** 1323 * Gives a factory for creating the service. 1324 * This method is called by the <code>JavaLoader</code> 1325 * <p> 1326 * @return returns a <code>XSingleServiceFactory</code> for creating the component 1327 * @param implName the name of the implementation for which a service is desired 1328 * @param multiFactory the service manager to be uses if needed 1329 * @param regKey the registryKey 1330 * @see com.sun.star.comp.loader.JavaLoader 1331 */ 1332 public static XSingleServiceFactory __getServiceFactory(String implName, 1333 XMultiServiceFactory multiFactory, 1334 XRegistryKey regKey) 1335 { 1336 XSingleServiceFactory xSingleServiceFactory = null; 1337 1338 if(implName.equals(_TestObject.class.getName())) 1339 xSingleServiceFactory = FactoryHelper.getServiceFactory(_TestObject.class, 1340 _TestObject.__serviceName, 1341 multiFactory, 1342 regKey); 1343 1344 else if(implName.equals(_PerformancTestObject.class.getName())) 1345 xSingleServiceFactory = FactoryHelper.getServiceFactory(_PerformancTestObject.class, 1346 _PerformancTestObject.__serviceName, 1347 multiFactory, 1348 regKey); 1349 1350 return xSingleServiceFactory; 1351 } 1352 } 1353