1 7 8 package com.sun.corba.se.impl.orb ; 9 10 import java.net.URL ; 11 import java.net.InetSocketAddress ; 12 import java.net.Socket ; 13 import java.net.ServerSocket ; 14 15 import java.io.IOException ; 16 17 import java.util.HashMap ; 18 import java.util.List ; 19 import java.util.Map ; 20 21 import java.security.AccessController ; 22 import java.security.PrivilegedExceptionAction ; 23 import java.security.PrivilegedActionException ; 24 25 import org.omg.PortableInterceptor.ORBInitializer ; 26 import org.omg.PortableInterceptor.ORBInitInfo ; 27 28 import com.sun.corba.se.pept.broker.Broker; 29 import com.sun.corba.se.pept.encoding.InputObject; 30 import com.sun.corba.se.pept.encoding.OutputObject; 31 import com.sun.corba.se.pept.protocol.MessageMediator; 32 import com.sun.corba.se.pept.transport.Acceptor; 33 import com.sun.corba.se.pept.transport.Connection; 34 import com.sun.corba.se.pept.transport.ContactInfo; 35 import com.sun.corba.se.pept.transport.ContactInfoList; 36 import com.sun.corba.se.pept.transport.EventHandler; 37 import com.sun.corba.se.pept.transport.InboundConnectionCache; 38 39 import com.sun.corba.se.spi.ior.IOR ; 40 import com.sun.corba.se.spi.ior.ObjectKey ; 41 import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; 42 import com.sun.corba.se.spi.logging.CORBALogDomains ; 43 import com.sun.corba.se.spi.orb.ORB; 44 import com.sun.corba.se.spi.orb.Operation ; 45 import com.sun.corba.se.spi.orb.OperationFactory ; 46 import com.sun.corba.se.spi.orb.ParserData ; 47 import com.sun.corba.se.spi.orb.ParserDataFactory ; 48 import com.sun.corba.se.spi.orb.StringPair ; 49 import com.sun.corba.se.spi.transport.CorbaContactInfoList; 50 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; 51 import com.sun.corba.se.spi.transport.CorbaTransportManager; 52 import com.sun.corba.se.spi.transport.IORToSocketInfo; 53 import com.sun.corba.se.spi.transport.ReadTimeouts; 54 import com.sun.corba.se.spi.transport.SocketInfo; 55 import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo; 56 import com.sun.corba.se.spi.transport.TransportDefault; 57 58 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; 59 import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ; 60 import com.sun.corba.se.impl.legacy.connection.USLPort ; 61 import com.sun.corba.se.impl.logging.ORBUtilSystemException ; 62 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ; 63 import com.sun.corba.se.impl.orbutil.ORBClassLoader ; 64 import com.sun.corba.se.impl.orbutil.ORBConstants ; 65 import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ; 66 import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ; 67 import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ; 68 import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl; 69 import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl; 70 71 75 public class ParserTable { 76 private static String MY_CLASS_NAME = ParserTable.class.getName() ; 77 78 private static ParserTable myInstance = new ParserTable() ; 79 80 private ORBUtilSystemException wrapper ; 81 82 public static ParserTable get() 83 { 84 return myInstance ; 85 } 86 87 private ParserData[] parserData ; 88 89 public ParserData[] getParserData() 90 { 91 return parserData ; 92 } 93 94 private ParserTable() { 95 wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ; 96 97 String codeSetTestString = 98 OSFCodeSetRegistry.ISO_8859_1_VALUE + "," + 99 OSFCodeSetRegistry.UTF_16_VALUE + "," + 100 OSFCodeSetRegistry.ISO_646_VALUE ; 101 102 String [] debugTestData = { "subcontract", "poa", "transport" } ; 103 104 USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ; 105 106 ReadTimeouts readTimeouts = 107 TransportDefault.makeReadTimeoutsFactory().create( 108 ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, 109 ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, 110 ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT, 111 ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR); 112 113 ORBInitializer [] TestORBInitializers = 114 { null, 115 new TestORBInitializer1(), 116 new TestORBInitializer2() } ; 117 StringPair[] TestORBInitData = { 118 new StringPair( "foo.bar.blech.NonExistent", "dummy" ), 119 new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ), 120 new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ; 121 122 Acceptor[] TestAcceptors = 123 { new TestAcceptor2(), 124 new TestAcceptor1(), 125 null } ; 126 StringPair[] TestAcceptorData = { 129 new StringPair( "foo.bar.blech.NonExistent", "dummy" ), 130 new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ), 131 new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ; 132 133 StringPair[] TestORBInitRefData = 134 { new StringPair( "Foo", "ior:930492049394" ), 135 new StringPair( "Bar", "ior:3453465785633576" ) } ; 136 137 URL testServicesURL = null ; 138 String testServicesString = "corbaloc::camelot/NameService" ; 139 140 try { 141 testServicesURL = new URL ( testServicesString ) ; 142 } catch (Exception exc) { 143 } 144 145 ParserData[] pd = { 150 ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY, 151 OperationFactory.listAction( ",", OperationFactory.stringAction()), 152 "debugFlags", new String [0], 153 debugTestData, "subcontract,poa,transport" ), 154 ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY, 155 OperationFactory.stringAction(), 156 "ORBInitialHost", "", 157 "Foo", "Foo" ), 158 ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, 159 OperationFactory.integerAction(), 160 "ORBInitialPort", new Integer ( ORBConstants.DEFAULT_INITIAL_PORT ), 161 new Integer ( 27314 ), "27314" ), 162 ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY, 168 OperationFactory.stringAction(), 169 "ORBServerHost", "", 170 "camelot", "camelot" ), 171 ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY, 172 OperationFactory.integerAction(), 173 "ORBServerPort", new Integer ( 0 ), 174 new Integer ( 38143 ), "38143" ), 175 ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES, 181 OperationFactory.stringAction(), 182 "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES, 183 "foo", "foo" ), 184 ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY, 185 OperationFactory.stringAction(), 186 "orbId", "", 187 "foo", "foo" ), 188 ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY, 189 OperationFactory.stringAction(), 190 "orbId", "", 191 "foo", "foo" ), 192 ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY, 193 OperationFactory.integerAction(), 194 "persistentServerId", new Integer (-1), 195 new Integer ( 1234), "1234" ), 196 ParserDataFactory.make( 197 ORBConstants.ORB_SERVER_ID_PROPERTY, 198 OperationFactory.setFlagAction(), 199 "persistentServerIdInitialized", Boolean.FALSE, 200 Boolean.TRUE, "1234" ), 201 ParserDataFactory.make( 202 ORBConstants.ORB_SERVER_ID_PROPERTY, 203 OperationFactory.setFlagAction(), 204 "orbServerIdPropertySpecified", Boolean.FALSE, 205 Boolean.TRUE, "1234" ), 206 ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY, 216 OperationFactory.integerAction(), 217 "highWaterMark", new Integer ( 240 ), 218 new Integer ( 3745 ), "3745" ), 219 ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY, 220 OperationFactory.integerAction(), 221 "lowWaterMark", new Integer ( 100 ), 222 new Integer ( 12 ), "12" ), 223 ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY, 224 OperationFactory.integerAction(), 225 "numberToReclaim", new Integer ( 5 ), 226 new Integer ( 231 ), "231" ), 227 ParserDataFactory.make( ORBConstants.GIOP_VERSION, 228 makeGVOperation(), 229 "giopVersion", GIOPVersion.DEFAULT_VERSION, 230 new GIOPVersion( 2, 3 ), "2.3" ), 231 ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE, 232 makeFSOperation(), "giopFragmentSize", 233 new Integer ( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ), 234 new Integer ( 65536 ), "65536" ), 235 ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE, 236 OperationFactory.integerAction(), 237 "giopBufferSize", new Integer ( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ), 238 new Integer ( 234000 ), "234000" ), 239 ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR, 240 makeBMGROperation(), 241 "giop11BuffMgr", new Integer ( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ), 242 new Integer ( 1 ), "CLCT" ), 243 ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR, 244 makeBMGROperation(), 245 "giop12BuffMgr", new Integer ( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ), 246 new Integer ( 0 ), "GROW" ), 247 248 ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, 252 OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ), 253 OperationFactory.convertIntegerToShort() ), 254 "giopTargetAddressPreference", 255 new Short ( ORBConstants.ADDR_DISP_HANDLE_ALL ), 256 new Short ( (short)2 ), "2" ), 257 ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, 258 makeADOperation(), 259 "giopAddressDisposition", new Short ( KeyAddr.value ), 260 new Short ( (short)2 ), "2" ), 261 ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY, 262 OperationFactory.booleanAction(), 263 "alwaysSendCodeSetCtx", Boolean.TRUE, 264 Boolean.FALSE, "false"), 265 ParserDataFactory.make( ORBConstants.USE_BOMS, 266 OperationFactory.booleanAction(), 267 "useByteOrderMarkers", 268 Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ), 269 Boolean.FALSE, "false" ), 270 ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS, 271 OperationFactory.booleanAction(), 272 "useByteOrderMarkersInEncaps", 273 Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ), 274 Boolean.FALSE, "false" ), 275 ParserDataFactory.make( ORBConstants.CHAR_CODESETS, 276 makeCSOperation(), 277 "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(), 278 CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), 279 ParserDataFactory.make( ORBConstants.WCHAR_CODESETS, 280 makeCSOperation(), 281 "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(), 282 CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), 283 ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION, 284 OperationFactory.booleanAction(), 285 "allowLocalOptimization", Boolean.FALSE, 286 Boolean.TRUE, "true" ), 287 ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY, 288 makeLegacySocketFactoryOperation(), 289 "legacySocketFactory", null, 292 new TestLegacyORBSocketFactory(), 293 MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ), 294 ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, 295 makeSocketFactoryOperation(), 296 "socketFactory", new DefaultSocketFactoryImpl(), 297 new TestORBSocketFactory(), 298 MY_CLASS_NAME + "$TestORBSocketFactory" ), 299 ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY, 300 makeUSLOperation() , 301 "userSpecifiedListenPorts", new USLPort[0], 302 USLPorts, "FOO:2701,BAR:3333" ), 303 ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY, 304 makeIORToSocketInfoOperation(), 305 "iorToSocketInfo", new DefaultIORToSocketInfoImpl(), 306 new TestIORToSocketInfo(), 307 MY_CLASS_NAME + "$TestIORToSocketInfo" ), 308 ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY, 309 makeIIOPPrimaryToContactInfoOperation(), 310 "iiopPrimaryToContactInfo", null, 311 new TestIIOPPrimaryToContactInfo(), 312 MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ), 313 ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY, 314 makeContactInfoListFactoryOperation(), 315 "corbaContactInfoListFactory", null, 316 new TestContactInfoListFactory(), 317 MY_CLASS_NAME + "$TestContactInfoListFactory" ), 318 ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, 319 OperationFactory.integerAction(), 320 "persistentServerPort", new Integer ( 0 ), 321 new Integer ( 2743 ), "2743" ), 322 ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, 323 OperationFactory.setFlagAction(), 324 "persistentPortInitialized", Boolean.FALSE, 325 Boolean.TRUE, "2743" ), 326 ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY, 327 OperationFactory.integerAction(), 328 "persistentServerId", new Integer ( 0 ), 329 new Integer ( 294 ), "294" ), 330 ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY, 331 OperationFactory.setFlagAction(), 332 "persistentServerIdInitialized", Boolean.FALSE, 333 Boolean.TRUE, "294" ), 334 ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY, 335 OperationFactory.booleanAction(), 336 "serverIsORBActivated", Boolean.FALSE, 337 Boolean.TRUE, "true" ), 338 ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY, 339 OperationFactory.classAction(), 340 "badServerIdHandlerClass", null, 341 TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ), 342 ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX, 343 makeROIOperation(), 344 "orbInitializers", new ORBInitializer [0], 345 TestORBInitializers, TestORBInitData, ORBInitializer .class ), 346 ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY, 347 makeAcceptorInstantiationOperation(), 348 "acceptors", new Acceptor[0], 349 TestAcceptors, TestAcceptorData, Acceptor.class ), 350 351 355 363 371 ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY, 372 OperationFactory.stringAction(), 373 "acceptorSocketType", ORBConstants.SOCKETCHANNEL, 374 "foo", "foo" ), 375 376 ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, 377 OperationFactory.booleanAction(), 378 "acceptorSocketUseSelectThreadToWait", Boolean.TRUE, 379 Boolean.TRUE, "true" ), 380 ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, 381 OperationFactory.booleanAction(), 382 "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE, 383 Boolean.TRUE, "true" ), 384 ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY, 385 OperationFactory.stringAction(), 386 "connectionSocketType", ORBConstants.SOCKETCHANNEL, 387 "foo", "foo" ), 388 ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, 389 OperationFactory.booleanAction(), 390 "connectionSocketUseSelectThreadToWait", Boolean.TRUE, 391 Boolean.TRUE, "true" ), 392 ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, 393 OperationFactory.booleanAction(), 394 "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE, 395 Boolean.TRUE, "true" ), 396 ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY, 397 OperationFactory.booleanAction(), 398 "disableDirectByteBufferUse", Boolean.FALSE, 399 Boolean.TRUE, "true" ), 400 ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY, 401 makeTTCPRTOperation(), 402 "readTimeouts", TransportDefault.makeReadTimeoutsFactory().create( 403 ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, 404 ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, 405 ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT, 406 ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR), 407 readTimeouts, "100:3000:300:20" ), 408 ParserDataFactory.make( 409 ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY, 410 OperationFactory.booleanAction(), 411 "enableJavaSerialization", Boolean.FALSE, 412 Boolean.FALSE, "false"), 413 ParserDataFactory.make( 414 ORBConstants.USE_REP_ID, 415 OperationFactory.booleanAction(), 416 "useRepId", Boolean.TRUE, 417 Boolean.TRUE, "true"), 418 ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY, 419 OperationFactory.identityAction(), 420 "orbInitialReferences", new StringPair[0], 421 TestORBInitRefData, TestORBInitRefData, StringPair.class ) 422 } ; 423 424 parserData = pd ; 425 } 426 427 public final class TestBadServerIdHandler implements BadServerIdHandler 428 { 429 public boolean equals( Object other ) 430 { 431 return other instanceof TestBadServerIdHandler ; 432 } 433 434 public void handle( ObjectKey objectKey ) 435 { 436 } 437 } 438 439 private Operation makeTTCPRTOperation() 440 { 441 Operation[] fourIop = { OperationFactory.integerAction(), 442 OperationFactory.integerAction(), 443 OperationFactory.integerAction(), 444 OperationFactory.integerAction() } ; 445 446 Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ; 447 448 Operation rtOp = new Operation() { 449 public Object operate(Object value) 450 { 451 Object [] values = (Object [])value ; 452 Integer initialTime = (Integer )(values[0]) ; 453 Integer maxGIOPHdrTime = (Integer )(values[1]) ; 454 Integer maxGIOPBodyTime = (Integer )(values[2]) ; 455 Integer backoffPercent = (Integer )(values[3]) ; 456 return TransportDefault.makeReadTimeoutsFactory().create( 457 initialTime.intValue(), 458 maxGIOPHdrTime.intValue(), 459 maxGIOPBodyTime.intValue(), 460 backoffPercent.intValue()); 461 } 462 } ; 463 464 Operation ttcprtOp = OperationFactory.compose(op2, rtOp); 465 return ttcprtOp; 466 } 467 468 private Operation makeUSLOperation() 469 { 470 Operation[] siop = { OperationFactory.stringAction(), 471 OperationFactory.integerAction() } ; 472 Operation op2 = OperationFactory.sequenceAction( ":", siop ) ; 473 474 Operation uslop = new Operation() { 475 public Object operate( Object value ) 476 { 477 Object [] values = (Object [])value ; 478 String type = (String )(values[0]) ; 479 Integer port = (Integer )(values[1]) ; 480 return new USLPort( type, port.intValue() ) ; 481 } 482 } ; 483 484 Operation op3 = OperationFactory.compose( op2, uslop ) ; 485 Operation listenop = OperationFactory.listAction( ",", op3 ) ; 486 return listenop ; 487 } 488 489 public static final class TestLegacyORBSocketFactory 490 implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory 491 { 492 public boolean equals( Object other ) 493 { 494 return other instanceof TestLegacyORBSocketFactory ; 495 } 496 497 public ServerSocket createServerSocket( String type, int port ) 498 { 499 return null ; 500 } 501 502 public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb, 503 IOR ior, SocketInfo socketInfo ) 504 { 505 return null ; 506 } 507 508 public Socket createSocket( SocketInfo socketInfo ) 509 { 510 return null ; 511 } 512 } 513 514 public static final class TestORBSocketFactory 515 implements com.sun.corba.se.spi.transport.ORBSocketFactory 516 { 517 public boolean equals( Object other ) 518 { 519 return other instanceof TestORBSocketFactory ; 520 } 521 522 public void setORB(ORB orb) 523 { 524 } 525 526 public ServerSocket createServerSocket( String type, InetSocketAddress a ) 527 { 528 return null ; 529 } 530 531 public Socket createSocket( String type, InetSocketAddress a ) 532 { 533 return null ; 534 } 535 536 public void setAcceptedSocketOptions(Acceptor acceptor, 537 ServerSocket serverSocket, 538 Socket socket) 539 { 540 } 541 } 542 543 public static final class TestIORToSocketInfo 544 implements IORToSocketInfo 545 { 546 public boolean equals( Object other ) 547 { 548 return other instanceof TestIORToSocketInfo; 549 } 550 551 public List getSocketInfo(IOR ior) 552 { 553 return null; 554 } 555 } 556 557 public static final class TestIIOPPrimaryToContactInfo 558 implements IIOPPrimaryToContactInfo 559 { 560 public void reset(ContactInfo primary) 561 { 562 } 563 564 public boolean hasNext(ContactInfo primary, 565 ContactInfo previous, 566 List contactInfos) 567 { 568 return true; 569 } 570 571 public ContactInfo next(ContactInfo primary, 572 ContactInfo previous, 573 List contactInfos) 574 { 575 return null; 576 } 577 } 578 579 public static final class TestContactInfoListFactory 580 implements CorbaContactInfoListFactory 581 { 582 public boolean equals( Object other ) 583 { 584 return other instanceof TestContactInfoListFactory; 585 } 586 587 public void setORB(ORB orb) { } 588 589 public CorbaContactInfoList create( IOR ior ) { return null; } 590 } 591 592 private Operation makeMapOperation( final Map map ) 593 { 594 return new Operation() { 595 public Object operate( Object value ) 596 { 597 return map.get( value ) ; 598 } 599 } ; 600 } 601 602 private Operation makeBMGROperation() 603 { 604 Map map = new HashMap () ; 605 map.put( "GROW", new Integer (0) ) ; 606 map.put( "CLCT", new Integer (1) ) ; 607 map.put( "STRM", new Integer (2) ) ; 608 return makeMapOperation( map ) ; 609 } 610 611 private Operation makeLegacySocketFactoryOperation() 612 { 613 Operation sfop = new Operation() { 614 public Object operate( Object value ) 615 { 616 String param = (String )value ; 617 618 try { 619 Class legacySocketFactoryClass = 620 ORBClassLoader.loadClass(param); 621 if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) { 625 return legacySocketFactoryClass.newInstance(); 626 } else { 627 throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ; 628 } 629 } catch (Exception ex) { 630 throw wrapper.badCustomSocketFactory( ex, param ) ; 634 } 635 } 636 } ; 637 638 return sfop ; 639 } 640 641 private Operation makeSocketFactoryOperation() 642 { 643 Operation sfop = new Operation() { 644 public Object operate( Object value ) 645 { 646 String param = (String )value ; 647 648 try { 649 Class socketFactoryClass = ORBClassLoader.loadClass(param); 650 if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) { 654 return socketFactoryClass.newInstance(); 655 } else { 656 throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ; 657 } 658 } catch (Exception ex) { 659 throw wrapper.badCustomSocketFactory( ex, param ) ; 663 } 664 } 665 } ; 666 667 return sfop ; 668 } 669 670 private Operation makeIORToSocketInfoOperation() 671 { 672 Operation op = new Operation() { 673 public Object operate( Object value ) 674 { 675 String param = (String )value ; 676 677 try { 678 Class iorToSocketInfoClass = ORBClassLoader.loadClass(param); 679 if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) { 683 return iorToSocketInfoClass.newInstance(); 684 } else { 685 throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ; 686 } 687 } catch (Exception ex) { 688 throw wrapper.badCustomIorToSocketInfo( ex, param ) ; 692 } 693 } 694 } ; 695 696 return op ; 697 } 698 699 private Operation makeIIOPPrimaryToContactInfoOperation() 700 { 701 Operation op = new Operation() { 702 public Object operate( Object value ) 703 { 704 String param = (String )value ; 705 706 try { 707 Class iiopPrimaryToContactInfoClass = ORBClassLoader.loadClass(param); 708 if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) { 712 return iiopPrimaryToContactInfoClass.newInstance(); 713 } else { 714 throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ; 715 } 716 } catch (Exception ex) { 717 throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ; 721 } 722 } 723 } ; 724 725 return op ; 726 } 727 728 private Operation makeContactInfoListFactoryOperation() 729 { 730 Operation op = new Operation() { 731 public Object operate( Object value ) 732 { 733 String param = (String )value ; 734 735 try { 736 Class contactInfoListFactoryClass = 737 ORBClassLoader.loadClass(param); 738 if (CorbaContactInfoListFactory.class.isAssignableFrom( 742 contactInfoListFactoryClass)) { 743 return contactInfoListFactoryClass.newInstance(); 744 } else { 745 throw wrapper.illegalContactInfoListFactoryType( 746 contactInfoListFactoryClass.toString() ) ; 747 } 748 } catch (Exception ex) { 749 throw wrapper.badContactInfoListFactory( ex, param ) ; 753 } 754 } 755 } ; 756 757 return op ; 758 } 759 760 private Operation makeCSOperation() 761 { 762 Operation csop = new Operation() { 763 public Object operate( Object value ) 764 { 765 String val = (String )value ; 766 return CodeSetComponentInfo.createFromString( val ) ; 767 } 768 } ; 769 770 return csop ; 771 } 772 773 private Operation makeADOperation() 774 { 775 Operation admap = new Operation() { 776 private Integer [] map = { 777 new Integer ( KeyAddr.value ), 778 new Integer ( ProfileAddr.value ), 779 new Integer ( ReferenceAddr.value ), 780 new Integer ( KeyAddr.value ) } ; 781 782 public Object operate( Object value ) 783 { 784 int val = ((Integer )value).intValue() ; 785 return map[val] ; 786 } 787 } ; 788 789 Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ; 790 Operation op1 = OperationFactory.compose( rangeop, admap ) ; 791 Operation result = OperationFactory.compose( op1, OperationFactory.convertIntegerToShort() ) ; 792 return result ; 793 } 794 795 private Operation makeFSOperation() { 796 Operation fschecker = new Operation() { 797 public Object operate( Object value ) 798 { 799 int giopFragmentSize = ((Integer )value).intValue() ; 800 if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){ 801 throw wrapper.fragmentSizeMinimum( new Integer ( giopFragmentSize ), 802 new Integer ( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ; 803 } 804 805 if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0) 806 throw wrapper.fragmentSizeDiv( new Integer ( giopFragmentSize ), 807 new Integer ( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ; 808 809 return value ; 810 } 811 } ; 812 813 Operation result = OperationFactory.compose( OperationFactory.integerAction(), 814 fschecker ) ; 815 return result ; 816 } 817 818 private Operation makeGVOperation() { 819 Operation gvHelper = OperationFactory.listAction( ".", 820 OperationFactory.integerAction() ) ; 821 Operation gvMain = new Operation() { 822 public Object operate( Object value ) 823 { 824 Object [] nums = (Object [])value ; 825 int major = ((Integer )(nums[0])).intValue() ; 826 int minor = ((Integer )(nums[1])).intValue() ; 827 828 return new GIOPVersion( major, minor ) ; 829 } 830 } ; 831 832 Operation result = OperationFactory.compose( gvHelper, gvMain ); 833 return result ; 834 } 835 836 public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject 837 implements ORBInitializer 838 { 839 public boolean equals( Object other ) 840 { 841 return other instanceof TestORBInitializer1 ; 842 } 843 844 public void pre_init( ORBInitInfo info ) 845 { 846 } 847 848 public void post_init( ORBInitInfo info ) 849 { 850 } 851 } 852 853 public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject 854 implements ORBInitializer 855 { 856 public boolean equals( Object other ) 857 { 858 return other instanceof TestORBInitializer2 ; 859 } 860 861 public void pre_init( ORBInitInfo info ) 862 { 863 } 864 865 public void post_init( ORBInitInfo info ) 866 { 867 } 868 } 869 870 private Operation makeROIOperation() { 871 Operation clsop = OperationFactory.classAction() ; 872 Operation indexOp = OperationFactory.suffixAction() ; 873 Operation op1 = OperationFactory.compose( indexOp, clsop ) ; 874 Operation mop = OperationFactory.maskErrorAction( op1 ) ; 875 876 Operation mkinst = new Operation() { 877 public Object operate( Object value ) 878 { 879 final Class initClass = (Class )value ; 880 if (initClass == null) 881 return null ; 882 883 if( org.omg.PortableInterceptor.ORBInitializer .class.isAssignableFrom( 887 initClass ) ) { 888 ORBInitializer initializer = null ; 891 892 try { 893 initializer = (ORBInitializer )AccessController.doPrivileged( 894 new PrivilegedExceptionAction () { 895 public Object run() 896 throws InstantiationException , IllegalAccessException 897 { 898 return initClass.newInstance() ; 899 } 900 } 901 ) ; 902 } catch (PrivilegedActionException exc) { 903 throw wrapper.orbInitializerFailure( exc.getException(), 905 initClass.getName() ) ; 906 } catch (Exception exc) { 907 throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ; 908 } 909 910 return initializer ; 911 } else { 912 throw wrapper.orbInitializerType( initClass.getName() ) ; 913 } 914 } 915 } ; 916 917 Operation result = OperationFactory.compose( mop, mkinst ) ; 918 919 return result ; 920 } 921 922 public static final class TestAcceptor1 923 implements Acceptor 924 { 925 public boolean equals( Object other ) 926 { 927 return other instanceof TestAcceptor1 ; 928 } 929 public boolean initialize() { return true; } 930 public boolean initialized() { return true; } 931 public String getConnectionCacheType() { return "FOO"; } 932 public void setConnectionCache(InboundConnectionCache connectionCache){} 933 public InboundConnectionCache getConnectionCache() { return null; } 934 public boolean shouldRegisterAcceptEvent() { return true; } 935 public void setUseSelectThreadForConnections(boolean x) { } 936 public boolean shouldUseSelectThreadForConnections() { return true; } 937 public void setUseWorkerThreadForConnections(boolean x) { } 938 public boolean shouldUseWorkerThreadForConnections() { return true; } 939 public void accept() { } 940 public void close() { } 941 public EventHandler getEventHandler() { return null; } 942 public MessageMediator createMessageMediator( 943 Broker xbroker, Connection xconnection) { return null; } 944 public MessageMediator finishCreatingMessageMediator( 945 Broker xbroker, Connection xconnection, 946 MessageMediator messageMediator) { return null; } 947 public InputObject createInputObject( 948 Broker broker, MessageMediator messageMediator) { return null; } 949 public OutputObject createOutputObject( 950 Broker broker, MessageMediator messageMediator) { return null; } 951 } 952 953 public static final class TestAcceptor2 954 implements Acceptor 955 { 956 public boolean equals( Object other ) 957 { 958 return other instanceof TestAcceptor2 ; 959 } 960 public boolean initialize() { return true; } 961 public boolean initialized() { return true; } 962 public String getConnectionCacheType() { return "FOO"; } 963 public void setConnectionCache(InboundConnectionCache connectionCache){} 964 public InboundConnectionCache getConnectionCache() { return null; } 965 public boolean shouldRegisterAcceptEvent() { return true; } 966 public void setUseSelectThreadForConnections(boolean x) { } 967 public boolean shouldUseSelectThreadForConnections() { return true; } 968 public void setUseWorkerThreadForConnections(boolean x) { } 969 public boolean shouldUseWorkerThreadForConnections() { return true; } 970 public void accept() { } 971 public void close() { } 972 public EventHandler getEventHandler() { return null; } 973 public MessageMediator createMessageMediator( 974 Broker xbroker, Connection xconnection) { return null; } 975 public MessageMediator finishCreatingMessageMediator( 976 Broker xbroker, Connection xconnection, 977 MessageMediator messageMediator) { return null; } 978 public InputObject createInputObject( 979 Broker broker, MessageMediator messageMediator) { return null; } 980 public OutputObject createOutputObject( 981 Broker broker, MessageMediator messageMediator) { return null; } 982 } 983 984 private Operation makeAcceptorInstantiationOperation() { 986 Operation clsop = OperationFactory.classAction() ; 987 Operation indexOp = OperationFactory.suffixAction() ; 988 Operation op1 = OperationFactory.compose( indexOp, clsop ) ; 989 Operation mop = OperationFactory.maskErrorAction( op1 ) ; 990 991 Operation mkinst = new Operation() { 992 public Object operate( Object value ) 993 { 994 final Class initClass = (Class )value ; 995 if (initClass == null) 996 return null ; 997 998 if( Acceptor.class.isAssignableFrom( initClass ) ) { 1002 Acceptor acceptor = null ; 1005 1006 try { 1007 acceptor = (Acceptor)AccessController.doPrivileged( 1008 new PrivilegedExceptionAction () { 1009 public Object run() 1010 throws InstantiationException , IllegalAccessException 1011 { 1012 return initClass.newInstance() ; 1013 } 1014 } 1015 ) ; 1016 } catch (PrivilegedActionException exc) { 1017 throw wrapper.acceptorInstantiationFailure( exc.getException(), 1019 initClass.getName() ) ; 1020 } catch (Exception exc) { 1021 throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ; 1022 } 1023 1024 return acceptor ; 1025 } else { 1026 throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ; 1027 } 1028 } 1029 } ; 1030 1031 Operation result = OperationFactory.compose( mop, mkinst ) ; 1032 1033 return result ; 1034 } 1035 1036 private Operation makeInitRefOperation() { 1037 return new Operation() { 1038 public Object operate( Object value ) 1039 { 1040 String [] values = (String [])value ; 1042 if (values.length != 2) 1043 throw wrapper.orbInitialreferenceSyntax() ; 1044 1045 return values[0] + "=" + values[1] ; 1046 } 1047 } ; 1048 } 1049} 1050 1051 | Popular Tags |