23 * questions. 24 */ 25 26 package org.omg.CORBA; 27 28 import org.omg.CORBA.portable.*; 29 import org.omg.CORBA.ORBPackage.InvalidName; 30 31 import java.util.Properties; 32 import java.applet.Applet; 33 import java.io.File; 34 import java.io.FileInputStream; 35 36 import java.security.AccessController; 37 import java.security.PrivilegedAction; 38 39 import sun.reflect.misc.ReflectUtil; 40 41 /** 42 * A class providing APIs for the CORBA Object Request Broker 43 * features. The <code>ORB</code> class also provides 44 * "pluggable ORB implementation" APIs that allow another vendor's ORB 45 * implementation to be used. 46 * <P> 47 * An ORB makes it possible for CORBA objects to communicate 48 * with each other by connecting objects making requests (clients) with 49 * objects servicing requests (servers). 50 * <P> 51 * 52 * The <code>ORB</code> class, which 53 * encapsulates generic CORBA functionality, does the following: 54 * (Note that items 5 and 6, which include most of the methods in 55 * the class <code>ORB</code>, are typically used with the <code>Dynamic Invocation 56 * Interface</code> (DII) and the <code>Dynamic Skeleton Interface</code> 57 * (DSI). 58 * These interfaces may be used by a developer directly, but 59 * most commonly they are used by the ORB internally and are 60 * not seen by the general programmer.) 61 * <OL> 62 * <li> initializes the ORB implementation by supplying values for 63 * predefined properties and environmental parameters 64 * <li> obtains initial object references to services such as 65 * the NameService using the method <code>resolve_initial_references</code> 66 * <li> converts object references to strings and back 67 * <li> connects the ORB to a servant (an instance of a CORBA object 68 * implementation) and disconnects the ORB from a servant 69 * <li> creates objects such as 70 * <ul> 71 * <li><code>TypeCode</code> 72 * <li><code>Any</code> 73 * <li><code>NamedValue</code> 74 * <li><code>Context</code> 75 * <li><code>Environment</code> 76 * <li>lists (such as <code>NVList</code>) containing these objects 77 * </ul> 78 * <li> sends multiple messages in the DII 79 * </OL> 80 * 81 * <P> 82 * The <code>ORB</code> class can be used to obtain references to objects 83 * implemented anywhere on the network. 84 * <P> 85 * An application or applet gains access to the CORBA environment 86 * by initializing itself into an <code>ORB</code> using one of 87 * three <code>init</code> methods. Two of the three methods use the properties 88 * (associations of a name with a value) shown in the 89 * table below.<BR> 90 * <TABLE BORDER=1 SUMMARY="Standard Java CORBA Properties"> 91 * <TR><TH>Property Name</TH> <TH>Property Value</TH></TR> 92 * <CAPTION>Standard Java CORBA Properties:</CAPTION> 93 * <TR><TD>org.omg.CORBA.ORBClass</TD> 94 * <TD>class name of an ORB implementation</TD></TR> 95 * <TR><TD>org.omg.CORBA.ORBSingletonClass</TD> 96 * <TD>class name of the ORB returned by <code>init()</code></TD></TR> 97 * </TABLE> 98 * <P> 99 * These properties allow a different vendor's <code>ORB</code> 100 * implementation to be "plugged in." 101 * <P> 102 * When an ORB instance is being created, the class name of the ORB 103 * implementation is located using 104 * the following standard search order: 105 * 106 * <OL> 107 * <LI>check in Applet parameter or application string array, if any 108 * 109 * <LI>check in properties parameter, if any 110 * 111 * <LI>check in the System properties 112 * 113 * <LI>check in the orb.properties file located in the user.home 114 * directory (if any) 115 * 116 * <LI>check in the orb.properties file located in the java.home/lib 117 * directory (if any) 118 * 119 * <LI>fall back on a hardcoded default behavior (use the Java IDL 120 * implementation) 121 * </OL> 122 * <P> 123 * Note that Java IDL provides a default implementation for the 124 * fully-functional ORB and for the Singleton ORB. When the method 125 * <code>init</code> is given no parameters, the default Singleton 126 * ORB is returned. When the method <code>init</code> is given parameters 127 * but no ORB class is specified, the Java IDL ORB implementation 128 * is returned. 129 * <P> 130 * The following code fragment creates an <code>ORB</code> object 131 * initialized with the default ORB Singleton. 132 * This ORB has a 133 * restricted implementation to prevent malicious applets from doing 134 * anything beyond creating typecodes. 135 * It is called a singleton 136 * because there is only one instance for an entire virtual machine. 137 * <PRE> 138 * ORB orb = ORB.init(); 139 * </PRE> 140 * <P> 141 * The following code fragment creates an <code>ORB</code> object 142 * for an application. The parameter <code>args</code> 143 * represents the arguments supplied to the application's <code>main</code> 144 * method. Since the property specifies the ORB class to be 145 * "SomeORBImplementation", the new ORB will be initialized with 146 * that ORB implementation. If p had been null, 147 * and the arguments had not specified an ORB class, 148 * the new ORB would have been 149 * initialized with the default Java IDL implementation. 150 * <PRE> 151 * Properties p = new Properties(); 152 * p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation"); 153 * ORB orb = ORB.init(args, p); 154 * </PRE> 155 * <P> 156 * The following code fragment creates an <code>ORB</code> object 157 * for the applet supplied as the first parameter. If the given 158 * applet does not specify an ORB class, the new ORB will be 159 * initialized with the default Java IDL implementation. 160 * <PRE> 161 * ORB orb = ORB.init(myApplet, null); 162 * </PRE> 163 * <P> 164 * An application or applet can be initialized in one or more ORBs. 165 * ORB initialization is a bootstrap call into the CORBA world. 166 * 167 * 168 * @implNote 169 * When a singleton ORB is configured via the system property, 170 * or orb.properties, it will be 171 * located, and loaded via the system class loader. 172 * Thus, where appropriate, it is necessary that 173 * the classes for this alternative ORBSingleton are available on the application's class path. 174 * It should be noted that the singleton ORB is system wide. 175 * 176 * When a per-application ORB is created via the 2-arg init methods, 254 return value ; 255 } 256 257 String javaHome = System.getProperty("java.home"); 258 fileName = javaHome + File.separator 259 + "lib" + File.separator + "orb.properties"; 260 props = getFileProperties( fileName ) ; 261 262 if (props == null) 263 return null ; 264 else 265 return props.getProperty( name ) ; 266 } 267 } 268 ); 269 270 return propValue; 271 } 272 273 /** 274 * Returns the <code>ORB</code> singleton object. This method always returns the 275 * same ORB instance, which is an instance of the class described by the 276 * <code>org.omg.CORBA.ORBSingletonClass</code> system property. 277 * <P> 278 * This no-argument version of the method <code>init</code> is used primarily 279 * as a factory for <code>TypeCode</code> objects, which are used by 280 * <code>Helper</code> classes to implement the method <code>type</code>. 281 * It is also used to create <code>Any</code> objects that are used to 282 * describe <code>union</code> labels (as part of creating a <code> 283 * TypeCode</code> object for a <code>union</code>). 284 * <P> 285 * This method is not intended to be used by applets, and in the event 286 * that it is called in an applet environment, the ORB it returns 287 * is restricted so that it can be used only as a factory for 288 * <code>TypeCode</code> objects. Any <code>TypeCode</code> objects 289 * it produces can be safely shared among untrusted applets. 290 * <P> 291 * If an ORB is created using this method from an applet, 292 * a system exception will be thrown if 293 * methods other than those for 294 * creating <code>TypeCode</code> objects are invoked. 295 * 296 * @return the singleton ORB 297 * 298 * @implNote 299 * When configured via the system property, or orb.properties, 300 * the system-wide singleton ORB is located via the 301 * system class loader. 302 */ 303 public static synchronized ORB init() { 304 if (singleton == null) { 305 String className = getSystemProperty(ORBSingletonClassKey); 306 if (className == null) 307 className = getPropertyFromFile(ORBSingletonClassKey); 308 if ((className == null) || 309 (className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) { 310 singleton = new com.sun.corba.se.impl.orb.ORBSingleton(); 311 } else { 312 singleton = create_impl_with_systemclassloader(className); 313 } 314 } 333 334 private static ORB create_impl(String className) { 335 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 336 if (cl == null) 337 cl = ClassLoader.getSystemClassLoader(); 338 339 try { 340 ReflectUtil.checkPackageAccess(className); 341 Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class; 342 Class<?> orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); 343 return (ORB)orbClass.newInstance(); 344 } catch (Throwable ex) { 345 SystemException systemException = new INITIALIZE( 346 "can't instantiate default ORB implementation " + className); 347 systemException.initCause(ex); 348 throw systemException; 349 } 350 } 351 352 /** 353 * Creates a new <code>ORB</code> instance for a standalone 354 * application. This method may be called from applications 355 * only and returns a new fully functional <code>ORB</code> object 356 * each time it is called. 357 * @param args command-line arguments for the application's <code>main</code> 358 * method; may be <code>null</code> 359 * @param props application-specific properties; may be <code>null</code> 360 * @return the newly-created ORB instance 361 * 362 * @implNote 363 * When configured via the system property, or orb.properties, 364 * the ORB is located via the thread context class loader. 365 */ 366 public static ORB init(String[] args, Properties props) { 367 // 368 // Note that there is no standard command-line argument for 369 // specifying the default ORB implementation. For an 370 // application you can choose an implementation either by 371 // setting the CLASSPATH to pick a different org.omg.CORBA 372 // and it's baked-in ORB implementation default or by 373 // setting an entry in the properties object or in the 374 // system properties. 375 // 376 String className = null; 377 ORB orb; 378 379 if (props != null) 380 className = props.getProperty(ORBClassKey); 381 if (className == null) 382 className = getSystemProperty(ORBClassKey); 383 if (className == null) 384 className = getPropertyFromFile(ORBClassKey); 385 if ((className == null) || 386 (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { 387 orb = new com.sun.corba.se.impl.orb.ORBImpl(); 388 } else { 389 orb = create_impl(className); 390 } 391 orb.set_parameters(args, props); 392 return orb; 393 } 394 395 396 /** 397 * Creates a new <code>ORB</code> instance for an applet. This 398 * method may be called from applets only and returns a new 399 * fully-functional <code>ORB</code> object each time it is called. 400 * @param app the applet; may be <code>null</code> 401 * @param props applet-specific properties; may be <code>null</code> 402 * @return the newly-created ORB instance 403 * 404 * @implNote 405 * When configured via the system property, or orb.properties, 406 * the ORB is located via the thread context class loader. 407 */ 408 public static ORB init(Applet app, Properties props) { 409 String className; 410 ORB orb; 411 412 className = app.getParameter(ORBClassKey); 413 if (className == null && props != null) 414 className = props.getProperty(ORBClassKey); 415 if (className == null) 416 className = getSystemProperty(ORBClassKey); 417 if (className == null) 418 className = getPropertyFromFile(ORBClassKey); 419 if ((className == null) || 420 (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { 421 orb = new com.sun.corba.se.impl.orb.ORBImpl(); 422 } else { 423 orb = create_impl(className); 424 } 425 orb.set_parameters(app, props); 426 return orb; 427 } 428 429 /** 430 * Allows the ORB implementation to be initialized with the given 431 * parameters and properties. This method, used in applications only, 432 * is implemented by subclass ORB implementations and called 433 * by the appropriate <code>init</code> method to pass in its parameters. 434 * 435 * @param args command-line arguments for the application's <code>main</code> 436 * method; may be <code>null</code> 437 * @param props application-specific properties; may be <code>null</code> 438 */ 439 abstract protected void set_parameters(String[] args, Properties props); 440 441 /** 442 * Allows the ORB implementation to be initialized with the given 443 * applet and parameters. This method, used in applets only, 444 * is implemented by subclass ORB implementations and called 445 * by the appropriate <code>init</code> method to pass in its parameters. 446 * 447 * @param app the applet; may be <code>null</code> 448 * @param props applet-specific properties; may be <code>null</code> 449 */ 450 abstract protected void set_parameters(Applet app, Properties props); 451 452 /** 453 * Connects the given servant object (a Java object that is 454 * an instance of the server implementation class) 455 * to the ORB. The servant class must 456 * extend the <code>ImplBase</code> class corresponding to the interface that is 457 * supported by the server. The servant must thus be a CORBA object 458 * reference, and inherit from <code>org.omg.CORBA.Object</code>. 459 * Servants created by the user can start receiving remote invocations 460 * after the method <code>connect</code> has been called. A servant may also be 461 * automatically and implicitly connected to the ORB if it is passed as 462 * an IDL parameter in an IDL method invocation on a non-local object, 463 * that is, if the servant object has to be marshalled and sent outside of the 464 * process address space. 465 * <P> 466 * Calling the method <code>connect</code> has no effect 467 * when the servant object is already connected to the ORB. 468 * <P> 469 * Deprecated by the OMG in favor of the Portable Object Adapter APIs. 470 * 471 * @param obj The servant object reference 472 */ 473 public void connect(org.omg.CORBA.Object obj) { 474 throw new NO_IMPLEMENT(); 475 } 476 477 /** 478 * Destroys the ORB so that its resources can be reclaimed. 479 * Any operation invoked on a destroyed ORB reference will throw the 480 * <code>OBJECT_NOT_EXIST</code> exception. 481 * Once an ORB has been destroyed, another call to <code>init</code> 482 * with the same ORBid will return a reference to a newly constructed ORB.<p> 483 * If <code>destroy</code> is called on an ORB that has not been shut down, 484 * it will start the shut down process and block until the ORB has shut down 485 * before it destroys the ORB.<br> 486 * If an application calls <code>destroy</code> in a thread that is currently servicing 487 * an invocation, the <code>BAD_INV_ORDER</code> system exception will be thrown 488 * with the OMG minor code 3, since blocking would result in a deadlock.<p> 489 * For maximum portability and to avoid resource leaks, an application should 490 * always call <code>shutdown</code> and <code>destroy</code> 491 * on all ORB instances before exiting. 492 * 493 * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing an invocation 494 */ 495 public void destroy( ) { 496 throw new NO_IMPLEMENT(); 497 } 498 499 /** 500 * Disconnects the given servant object from the ORB. After this method returns, 501 * the ORB will reject incoming remote requests for the disconnected 502 * servant and will send the exception 503 * <code>org.omg.CORBA.OBJECT_NOT_EXIST</code> back to the 504 * remote client. Thus the object appears to be destroyed from the 505 * point of view of remote clients. Note, however, that local requests issued 506 * using the servant directly do not 507 * pass through the ORB; hence, they will continue to be processed by the 508 * servant. 509 * <P> 510 * Calling the method <code>disconnect</code> has no effect 511 * if the servant is not connected to the ORB. 512 * <P> 513 * Deprecated by the OMG in favor of the Portable Object Adapter APIs. 514 * 515 * @param obj The servant object to be disconnected from the ORB 516 */ 517 public void disconnect(org.omg.CORBA.Object obj) { 518 throw new NO_IMPLEMENT(); 519 } 520 521 // 522 // ORB method implementations. 523 // 524 // We are trying to accomplish 2 things at once in this class. 525 // It can act as a default ORB implementation front-end, 526 // creating an actual ORB implementation object which is a 527 // subclass of this ORB class and then delegating the method 528 // implementations. 529 // 530 // To accomplish the delegation model, the 'delegate' private instance 531 // variable is set if an instance of this class is created directly. 532 // 533 534 /** 535 * Returns a list of the initially available CORBA object references, 536 * such as "NameService" and "InterfaceRepository". 537 * 538 * @return an array of <code>String</code> objects that represent 539 * the object references for CORBA services 540 * that are initially available with this ORB 541 */ 542 abstract public String[] list_initial_services(); 543 544 /** 545 * Resolves a specific object reference from the set of available 546 * initial service names. 547 * 548 * @param object_name the name of the initial service as a string 549 * @return the object reference associated with the given name 550 * @exception InvalidName if the given name is not associated with a 551 * known service 552 */ 553 abstract public org.omg.CORBA.Object resolve_initial_references(String object_name) 554 throws InvalidName; 555 556 /** 557 * Converts the given CORBA object reference to a string. 558 * Note that the format of this string is predefined by IIOP, allowing 559 * strings generated by a different ORB to be converted back into an object 560 * reference. 561 * <P> 562 * The resulting <code>String</code> object may be stored or communicated 563 * in any way that a <code>String</code> object can be manipulated. 564 * 565 * @param obj the object reference to stringify 566 * @return the string representing the object reference 567 */ 568 abstract public String object_to_string(org.omg.CORBA.Object obj); 569 570 /** 571 * Converts a string produced by the method <code>object_to_string</code> 572 * back to a CORBA object reference. 573 * 574 * @param str the string to be converted back to an object reference. It must 575 * be the result of converting an object reference to a string using the 576 * method <code>object_to_string</code>. 577 * @return the object reference 578 */ 579 abstract public org.omg.CORBA.Object string_to_object(String str); 580 581 /** 582 * Allocates an <code>NVList</code> with (probably) enough 583 * space for the specified number of <code>NamedValue</code> objects. 584 * Note that the specified size is only a hint to help with 585 * storage allocation and does not imply the maximum size of the list. 586 * 587 * @param count suggested number of <code>NamedValue</code> objects for 588 * which to allocate space 589 * @return the newly-created <code>NVList</code> 590 * 591 * @see NVList 592 */ 593 abstract public NVList create_list(int count); 594 595 /** 596 * Creates an <code>NVList</code> initialized with argument 597 * descriptions for the operation described in the given 598 * <code>OperationDef</code> object. This <code>OperationDef</code> object 599 * is obtained from an Interface Repository. The arguments in the 600 * returned <code>NVList</code> object are in the same order as in the 601 * original IDL operation definition, which makes it possible for the list 602 * to be used in dynamic invocation requests. 603 * 604 * @param oper the <code>OperationDef</code> object to use to create the list 605 * @return a newly-created <code>NVList</code> object containing 606 * descriptions of the arguments to the method described in the given 607 * <code>OperationDef</code> object 608 * 609 * @see NVList 610 */ 611 public NVList create_operation_list(org.omg.CORBA.Object oper) 612 { 613 // If we came here, it means that the actual ORB implementation 614 // did not have a create_operation_list(...CORBA.Object oper) method, 615 // so lets check if it has a create_operation_list(OperationDef oper) 616 // method. 617 try { 618 // First try to load the OperationDef class 619 String opDefClassName = "org.omg.CORBA.OperationDef"; 620 Class<?> opDefClass = null; 621 622 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 623 if ( cl == null ) 624 cl = ClassLoader.getSystemClassLoader(); 625 // if this throws a ClassNotFoundException, it will be caught below. 626 opDefClass = Class.forName(opDefClassName, true, cl); 627 640 if (t instanceof Error) { 641 throw (Error) t; 642 } 643 else if (t instanceof RuntimeException) { 644 throw (RuntimeException) t; 645 } 646 else { 647 throw new org.omg.CORBA.NO_IMPLEMENT(); 648 } 649 } 650 catch( RuntimeException ex ) { 651 throw ex; 652 } 653 catch( Exception exr ) { 654 throw new org.omg.CORBA.NO_IMPLEMENT(); 655 } 656 } 657 658 659 /** 660 * Creates a <code>NamedValue</code> object 661 * using the given name, value, and argument mode flags. 662 * <P> 663 * A <code>NamedValue</code> object serves as (1) a parameter or return 664 * value or (2) a context property. 665 * It may be used by itself or 666 * as an element in an <code>NVList</code> object. 667 * 668 * @param s the name of the <code>NamedValue</code> object 669 * @param any the <code>Any</code> value to be inserted into the 670 * <code>NamedValue</code> object 671 * @param flags the argument mode flags for the <code>NamedValue</code>: one of 672 * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, 673 * or <code>ARG_INOUT.value</code>. 674 * 675 * @return the newly-created <code>NamedValue</code> object 676 * @see NamedValue 677 */ 678 abstract public NamedValue create_named_value(String s, Any any, int flags); 679 680 /** 681 * Creates an empty <code>ExceptionList</code> object. 682 * 683 * @return the newly-created <code>ExceptionList</code> object 684 */ 685 abstract public ExceptionList create_exception_list(); 686 687 /** 688 * Creates an empty <code>ContextList</code> object. 689 * 690 * @return the newly-created <code>ContextList</code> object 691 * @see ContextList 692 * @see Context 693 */ 694 abstract public ContextList create_context_list(); 695 696 /** 697 * Gets the default <code>Context</code> object. 698 * 699 * @return the default <code>Context</code> object 700 * @see Context 701 */ 702 abstract public Context get_default_context(); 703 704 /** 705 * Creates an <code>Environment</code> object. 706 * 707 * @return the newly-created <code>Environment</code> object 708 * @see Environment 709 */ 710 abstract public Environment create_environment(); 711 712 /** 713 * Creates a new <code>org.omg.CORBA.portable.OutputStream</code> into which 714 * IDL method parameters can be marshalled during method invocation. 715 * @return the newly-created 716 * <code>org.omg.CORBA.portable.OutputStream</code> object 717 */ 718 abstract public org.omg.CORBA.portable.OutputStream create_output_stream(); 719 720 /** 721 * Sends multiple dynamic (DII) requests asynchronously without expecting 722 * any responses. Note that oneway invocations are not guaranteed to 723 * reach the server. 724 * 725 * @param req an array of request objects 726 */ 727 abstract public void send_multiple_requests_oneway(Request[] req); 728 729 /** 730 * Sends multiple dynamic (DII) requests asynchronously. 731 * 732 * @param req an array of <code>Request</code> objects 733 */ 734 abstract public void send_multiple_requests_deferred(Request[] req); 735 736 /** 737 * Finds out if any of the deferred (asynchronous) invocations have 738 * a response yet. 739 * @return <code>true</code> if there is a response available; 740 * <code> false</code> otherwise 741 */ 742 abstract public boolean poll_next_response(); 743 744 /** 745 * Gets the next <code>Request</code> instance for which a response 746 * has been received. 747 * 748 * @return the next <code>Request</code> object ready with a response 749 * @exception WrongTransaction if the method <code>get_next_response</code> 750 * is called from a transaction scope different 751 * from the one from which the original request was sent. See the 752 * OMG Transaction Service specification for details. 753 */ 754 abstract public Request get_next_response() throws WrongTransaction; 755 756 /** 757 * Retrieves the <code>TypeCode</code> object that represents 758 * the given primitive IDL type. 759 * 760 * @param tcKind the <code>TCKind</code> instance corresponding to the 761 * desired primitive type 762 * @return the requested <code>TypeCode</code> object 763 */ 764 abstract public TypeCode get_primitive_tc(TCKind tcKind); 765 766 /** 767 * Creates a <code>TypeCode</code> object representing an IDL <code>struct</code>. 768 * The <code>TypeCode</code> object is initialized with the given id, 769 * name, and members. 770 * 771 * @param id the repository id for the <code>struct</code> 772 * @param name the name of the <code>struct</code> 773 * @param members an array describing the members of the <code>struct</code> 774 * @return a newly-created <code>TypeCode</code> object describing 775 * an IDL <code>struct</code> 776 */ 777 abstract public TypeCode create_struct_tc(String id, String name, 778 StructMember[] members); 779 780 /** 781 * Creates a <code>TypeCode</code> object representing an IDL <code>union</code>. 782 * The <code>TypeCode</code> object is initialized with the given id, 783 * name, discriminator type, and members. 784 * 785 * @param id the repository id of the <code>union</code> 786 * @param name the name of the <code>union</code> 787 * @param discriminator_type the type of the <code>union</code> discriminator 788 * @param members an array describing the members of the <code>union</code> 789 * @return a newly-created <code>TypeCode</code> object describing 790 * an IDL <code>union</code> 791 */ 792 abstract public TypeCode create_union_tc(String id, String name, 793 TypeCode discriminator_type, 794 UnionMember[] members); 795 796 /** 797 * Creates a <code>TypeCode</code> object representing an IDL <code>enum</code>. 798 * The <code>TypeCode</code> object is initialized with the given id, 799 * name, and members. 800 * 801 * @param id the repository id for the <code>enum</code> 802 * @param name the name for the <code>enum</code> 803 * @param members an array describing the members of the <code>enum</code> 804 * @return a newly-created <code>TypeCode</code> object describing 805 * an IDL <code>enum</code> 806 */ 807 abstract public TypeCode create_enum_tc(String id, String name, String[] members); 808 809 /** 810 * Creates a <code>TypeCode</code> object representing an IDL <code>alias</code> 811 * (<code>typedef</code>). 812 * The <code>TypeCode</code> object is initialized with the given id, 813 * name, and original type. 814 * 815 * @param id the repository id for the alias 816 * @param name the name for the alias 817 * @param original_type 818 * the <code>TypeCode</code> object describing the original type 819 * for which this is an alias 820 * @return a newly-created <code>TypeCode</code> object describing 821 * an IDL <code>alias</code> 822 */ 823 abstract public TypeCode create_alias_tc(String id, String name, 824 TypeCode original_type); 825 826 /** 827 * Creates a <code>TypeCode</code> object representing an IDL <code>exception</code>. 828 * The <code>TypeCode</code> object is initialized with the given id, 829 * name, and members. 830 * 831 * @param id the repository id for the <code>exception</code> 832 * @param name the name for the <code>exception</code> 833 * @param members an array describing the members of the <code>exception</code> 834 * @return a newly-created <code>TypeCode</code> object describing 835 * an IDL <code>exception</code> 836 */ 837 abstract public TypeCode create_exception_tc(String id, String name, 838 StructMember[] members); 839 840 /** 841 * Creates a <code>TypeCode</code> object representing an IDL <code>interface</code>. 842 * The <code>TypeCode</code> object is initialized with the given id 843 * and name. 844 * 845 * @param id the repository id for the interface 846 * @param name the name for the interface 847 * @return a newly-created <code>TypeCode</code> object describing 848 * an IDL <code>interface</code> 849 */ 850 851 abstract public TypeCode create_interface_tc(String id, String name); 852 853 /** 854 * Creates a <code>TypeCode</code> object representing a bounded IDL 855 * <code>string</code>. 856 * The <code>TypeCode</code> object is initialized with the given bound, 857 * which represents the maximum length of the string. Zero indicates 858 * that the string described by this type code is unbounded. 859 * 860 * @param bound the bound for the <code>string</code>; cannot be negative 861 * @return a newly-created <code>TypeCode</code> object describing 862 * a bounded IDL <code>string</code> 863 * @exception BAD_PARAM if bound is a negative value 864 */ 865 866 abstract public TypeCode create_string_tc(int bound); 867 868 /** 869 * Creates a <code>TypeCode</code> object representing a bounded IDL 870 * <code>wstring</code> (wide string). 871 * The <code>TypeCode</code> object is initialized with the given bound, 872 * which represents the maximum length of the wide string. Zero indicates 873 * that the string described by this type code is unbounded. 874 * 875 * @param bound the bound for the <code>wstring</code>; cannot be negative 876 * @return a newly-created <code>TypeCode</code> object describing 877 * a bounded IDL <code>wstring</code> 878 * @exception BAD_PARAM if bound is a negative value 879 */ 880 abstract public TypeCode create_wstring_tc(int bound); 881 882 /** 883 * Creates a <code>TypeCode</code> object representing an IDL <code>sequence</code>. 884 * The <code>TypeCode</code> object is initialized with the given bound and 885 * element type. 886 * 887 * @param bound the bound for the <code>sequence</code>, 0 if unbounded 888 * @param element_type 889 * the <code>TypeCode</code> object describing the elements 890 * contained in the <code>sequence</code> 891 * @return a newly-created <code>TypeCode</code> object describing 892 * an IDL <code>sequence</code> 893 */ 894 abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type); 895 896 /** 897 * Creates a <code>TypeCode</code> object representing a 898 * a recursive IDL <code>sequence</code>. 899 * <P> 900 * For the IDL <code>struct</code> Node in following code fragment, 901 * the offset parameter for creating its sequence would be 1: 902 * <PRE> 903 * Struct Node { 904 * long value; 905 * Sequence <Node> subnodes; 906 * }; 907 * </PRE> 908 * 909 * @param bound the bound for the sequence, 0 if unbounded 910 * @param offset the index to the enclosing <code>TypeCode</code> object 911 * that describes the elements of this sequence 912 * @return a newly-created <code>TypeCode</code> object describing 913 * a recursive sequence 914 * @deprecated Use a combination of create_recursive_tc and create_sequence_tc instead 915 * @see #create_recursive_tc(String) create_recursive_tc 916 * @see #create_sequence_tc(int, TypeCode) create_sequence_tc 917 */ 918 @Deprecated 919 abstract public TypeCode create_recursive_sequence_tc(int bound, int offset); 920 921 /** 922 * Creates a <code>TypeCode</code> object representing an IDL <code>array</code>. 923 * The <code>TypeCode</code> object is initialized with the given length and 924 * element type. 925 * 926 * @param length the length of the <code>array</code> 927 * @param element_type a <code>TypeCode</code> object describing the type 928 * of element contained in the <code>array</code> 929 * @return a newly-created <code>TypeCode</code> object describing 930 * an IDL <code>array</code> 931 */ 932 abstract public TypeCode create_array_tc(int length, TypeCode element_type); 933 934 /** 935 * Create a <code>TypeCode</code> object for an IDL native type. 936 * 937 * @param id the logical id for the native type. 938 * @param name the name of the native type. 939 * @return the requested TypeCode. 940 */ 941 public org.omg.CORBA.TypeCode create_native_tc(String id, 942 String name) 943 { 944 throw new org.omg.CORBA.NO_IMPLEMENT(); 945 } 946 947 /** 948 * Create a <code>TypeCode</code> object for an IDL abstract interface. 949 * 950 * @param id the logical id for the abstract interface type. 951 * @param name the name of the abstract interface type. 952 * @return the requested TypeCode. 953 */ 954 public org.omg.CORBA.TypeCode create_abstract_interface_tc( 955 String id, 956 String name) 957 { 958 throw new org.omg.CORBA.NO_IMPLEMENT(); 959 } 960 961 962 /** 963 * Create a <code>TypeCode</code> object for an IDL fixed type. 964 * 965 * @param digits specifies the total number of decimal digits in the number 966 * and must be from 1 to 31 inclusive. 967 * @param scale specifies the position of the decimal point. 968 * @return the requested TypeCode. 969 */ 970 public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) 971 { 972 throw new org.omg.CORBA.NO_IMPLEMENT(); 973 } 974 975 976 // orbos 98-01-18: Objects By Value -- begin 977 978 979 /** 980 * Create a <code>TypeCode</code> object for an IDL value type. 981 * The concrete_base parameter is the TypeCode for the immediate 982 * concrete valuetype base of the valuetype for which the TypeCode 983 * is being created. 984 * It may be null if the valuetype does not have a concrete base. 985 * 986 * @param id the logical id for the value type. 987 * @param name the name of the value type. 988 * @param type_modifier one of the value type modifier constants: 989 * VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE 990 * @param concrete_base a <code>TypeCode</code> object 991 * describing the concrete valuetype base 992 * @param members an array containing the members of the value type 993 * @return the requested TypeCode 994 */ 995 public org.omg.CORBA.TypeCode create_value_tc(String id, 996 String name, 997 short type_modifier, 998 TypeCode concrete_base, 999 ValueMember[] members) 1000 { 1001 throw new org.omg.CORBA.NO_IMPLEMENT(); 1002 } 1003 1004 /** 1005 * Create a recursive <code>TypeCode</code> object which 1006 * serves as a placeholder for a concrete TypeCode during the process of creating 1007 * TypeCodes which contain recursion. The id parameter specifies the repository id of 1008 * the type for which the recursive TypeCode is serving as a placeholder. Once the 1009 * recursive TypeCode has been properly embedded in the enclosing TypeCode which 1010 * corresponds to the specified repository id, it will function as a normal TypeCode. 1011 * Invoking operations on the recursive TypeCode before it has been embedded in the 1012 * enclosing TypeCode will result in a <code>BAD_TYPECODE</code> exception. 1013 * <P> 1014 * For example, the following IDL type declaration contains recursion: 1015 * <PRE> 1016 * Struct Node { 1017 * Sequence<Node> subnodes; 1018 * }; 1019 * </PRE> 1020 * <P> 1021 * To create a TypeCode for struct Node, you would invoke the TypeCode creation 1022 * operations as shown below: 1023 * <PRE> 1024 * String nodeID = "IDL:Node:1.0"; 1025 * TypeCode recursiveSeqTC = orb.create_sequence_tc(0, orb.create_recursive_tc(nodeID)); 1026 * StructMember[] members = { new StructMember("subnodes", recursiveSeqTC, null) }; 1027 * TypeCode structNodeTC = orb.create_struct_tc(nodeID, "Node", members); 1028 * </PRE> 1029 * <P> 1030 * Also note that the following is an illegal IDL type declaration: 1031 * <PRE> 1032 * Struct Node { 1033 * Node next; 1034 * }; 1035 * </PRE> 1036 * <P> 1037 * Recursive types can only appear within sequences which can be empty. 1038 * That way marshaling problems, when transmitting the struct in an Any, are avoided. 1039 * 1040 * @param id the logical id of the referenced type 1041 * @return the requested TypeCode 1042 */ 1043 public org.omg.CORBA.TypeCode create_recursive_tc(String id) { 1044 // implemented in subclass 1045 throw new org.omg.CORBA.NO_IMPLEMENT(); 1046 } 1047 1048 /** 1049 * Creates a <code>TypeCode</code> object for an IDL value box. 1050 * 1051 * @param id the logical id for the value type 1052 * @param name the name of the value type 1053 * @param boxed_type the TypeCode for the type 1054 * @return the requested TypeCode 1055 */ 1056 public org.omg.CORBA.TypeCode create_value_box_tc(String id, 1057 String name, 1058 TypeCode boxed_type) 1059 { 1060 // implemented in subclass 1061 throw new org.omg.CORBA.NO_IMPLEMENT(); 1062 } 1063 1064 // orbos 98-01-18: Objects By Value -- end 1065 1066 /** 1067 * Creates an IDL <code>Any</code> object initialized to 1068 * contain a <code>Typecode</code> object whose <code>kind</code> field 1069 * is set to <code>TCKind.tc_null</code>. 1070 * 1071 * @return a newly-created <code>Any</code> object 1072 */ 1073 abstract public Any create_any(); 1074 1075 1076 1077 1078 /** 1079 * Retrieves a <code>Current</code> object. 1080 * The <code>Current</code> interface is used to manage thread-specific 1081 * information for use by services such as transactions and security. 1082 * 1083 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1084 * comments for unimplemented features</a> 1085 * 1086 * @return a newly-created <code>Current</code> object 1087 * @deprecated use <code>resolve_initial_references</code>. 1088 */ 1089 @Deprecated 1090 public org.omg.CORBA.Current get_current() 1091 { 1092 throw new org.omg.CORBA.NO_IMPLEMENT(); 1093 } 1094 1095 /** 1096 * This operation blocks the current thread until the ORB has 1097 * completed the shutdown process, initiated when some thread calls 1098 * <code>shutdown</code>. It may be used by multiple threads which 1099 * get all notified when the ORB shuts down. 1100 * 1101 */ 1102 public void run() 1103 { 1104 throw new org.omg.CORBA.NO_IMPLEMENT(); 1105 } 1106 1107 /** 1108 * Instructs the ORB to shut down, which causes all 1109 * object adapters to shut down, in preparation for destruction.<br> 1110 * If the <code>wait_for_completion</code> parameter 1111 * is true, this operation blocks until all ORB processing (including 1112 * processing of currently executing requests, object deactivation, 1113 * and other object adapter operations) has completed. 1114 * If an application does this in a thread that is currently servicing 1115 * an invocation, the <code>BAD_INV_ORDER</code> system exception 1116 * will be thrown with the OMG minor code 3, 1117 * since blocking would result in a deadlock.<br> 1118 * If the <code>wait_for_completion</code> parameter is <code>FALSE</code>, 1119 * then shutdown may not have completed upon return.<p> 1120 * While the ORB is in the process of shutting down, the ORB operates as normal, 1121 * servicing incoming and outgoing requests until all requests have been completed. 1122 * Once an ORB has shutdown, only object reference management operations 1123 * may be invoked on the ORB or any object reference obtained from it. 1124 * An application may also invoke the <code>destroy</code> operation on the ORB itself. 1125 * Invoking any other operation will throw the <code>BAD_INV_ORDER</code> 1126 * system exception with the OMG minor code 4.<p> 1127 * The <code>ORB.run</code> method will return after 1128 * <code>shutdown</code> has been called. 1129 * 1130 * @param wait_for_completion <code>true</code> if the call 1131 * should block until the shutdown is complete; 1132 * <code>false</code> if it should return immediately 1133 * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing 1134 * an invocation 1135 */ 1136 public void shutdown(boolean wait_for_completion) 1137 { 1138 throw new org.omg.CORBA.NO_IMPLEMENT(); 1139 } 1140 1141 /** 1142 * Returns <code>true</code> if the ORB needs the main thread to 1143 * perform some work, and <code>false</code> if the ORB does not 1144 * need the main thread. 1145 * 1146 * @return <code>true</code> if there is work pending, meaning that the ORB 1147 * needs the main thread to perform some work; <code>false</code> 1148 * if there is no work pending and thus the ORB does not need the 1149 * main thread 1150 * 1151 */ 1152 public boolean work_pending() 1153 { 1154 throw new org.omg.CORBA.NO_IMPLEMENT(); 1155 } 1156 1157 /** 1158 * Performs an implementation-dependent unit of work if called 1159 * by the main thread. Otherwise it does nothing. 1160 * The methods <code>work_pending</code> and <code>perform_work</code> 1161 * can be used in 1162 * conjunction to implement a simple polling loop that multiplexes 1163 * the main thread among the ORB and other activities. 1164 * 1165 */ 1166 public void perform_work() 1167 { 1168 throw new org.omg.CORBA.NO_IMPLEMENT(); 1169 } 1170 1171 /** 1172 * Used to obtain information about CORBA facilities and services 1173 * that are supported by this ORB. The service type for which 1174 * information is being requested is passed in as the in 1175 * parameter <tt>service_type</tt>, the values defined by 1176 * constants in the CORBA module. If service information is 1177 * available for that type, that is returned in the out parameter 1178 * <tt>service_info</tt>, and the operation returns the 1179 * value <tt>true</tt>. If no information for the requested 1180 * services type is available, the operation returns <tt>false</tt> 1181 * (i.e., the service is not supported by this ORB). 1182 * 1183 * @param service_type a <code>short</code> indicating the 1184 * service type for which information is being requested 1185 * @param service_info a <code>ServiceInformationHolder</code> object 1186 * that will hold the <code>ServiceInformation</code> object 1187 * produced by this method 1188 * @return <code>true</code> if service information is available 1189 * for the <tt>service_type</tt>; 1190 * <tt>false</tt> if no information for the 1191 * requested services type is available 1192 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1193 * comments for unimplemented features</a> 1194 */ 1195 public boolean get_service_information(short service_type, 1196 ServiceInformationHolder service_info) 1197 { 1198 throw new org.omg.CORBA.NO_IMPLEMENT(); 1199 } 1200 1201 // orbos 98-01-18: Objects By Value -- begin 1202 1203 /** 1204 * Creates a new <code>DynAny</code> object from the given 1205 * <code>Any</code> object. 1206 * 1207 * @param value the <code>Any</code> object from which to create a new 1208 * <code>DynAny</code> object 1209 * @return the new <code>DynAny</code> object created from the given 1210 * <code>Any</code> object 1211 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1212 * comments for unimplemented features</a> 1213 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1214 */ 1215 @Deprecated 1216 public org.omg.CORBA.DynAny create_dyn_any(org.omg.CORBA.Any value) 1217 { 1218 throw new org.omg.CORBA.NO_IMPLEMENT(); 1219 } 1220 1221 /** 1222 * Creates a basic <code>DynAny</code> object from the given 1223 * <code>TypeCode</code> object. 1224 * 1225 * @param type the <code>TypeCode</code> object from which to create a new 1226 * <code>DynAny</code> object 1227 * @return the new <code>DynAny</code> object created from the given 1228 * <code>TypeCode</code> object 1229 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1230 * <code>TypeCode</code> object is not consistent with the operation. 1231 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1232 * comments for unimplemented features</a> 1233 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1234 */ 1235 @Deprecated 1236 public org.omg.CORBA.DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1237 { 1238 throw new org.omg.CORBA.NO_IMPLEMENT(); 1239 } 1240 1241 /** 1242 * Creates a new <code>DynStruct</code> object from the given 1243 * <code>TypeCode</code> object. 1244 * 1245 * @param type the <code>TypeCode</code> object from which to create a new 1246 * <code>DynStruct</code> object 1247 * @return the new <code>DynStruct</code> object created from the given 1248 * <code>TypeCode</code> object 1249 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1250 * <code>TypeCode</code> object is not consistent with the operation. 1251 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1252 * comments for unimplemented features</a> 1253 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1254 */ 1255 @Deprecated 1256 public org.omg.CORBA.DynStruct create_dyn_struct(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1257 { 1258 throw new org.omg.CORBA.NO_IMPLEMENT(); 1259 } 1260 1261 /** 1262 * Creates a new <code>DynSequence</code> object from the given 1263 * <code>TypeCode</code> object. 1264 * 1265 * @param type the <code>TypeCode</code> object from which to create a new 1266 * <code>DynSequence</code> object 1267 * @return the new <code>DynSequence</code> object created from the given 1268 * <code>TypeCode</code> object 1269 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1270 * <code>TypeCode</code> object is not consistent with the operation. 1271 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1272 * comments for unimplemented features</a> 1273 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1274 */ 1275 @Deprecated 1276 public org.omg.CORBA.DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1277 { 1278 throw new org.omg.CORBA.NO_IMPLEMENT(); 1279 } 1280 1281 1282 /** 1283 * Creates a new <code>DynArray</code> object from the given 1284 * <code>TypeCode</code> object. 1285 * 1286 * @param type the <code>TypeCode</code> object from which to create a new 1287 * <code>DynArray</code> object 1288 * @return the new <code>DynArray</code> object created from the given 1289 * <code>TypeCode</code> object 1290 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1291 * <code>TypeCode</code> object is not consistent with the operation. 1292 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1293 * comments for unimplemented features</a> 1294 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1295 */ 1296 @Deprecated 1297 public org.omg.CORBA.DynArray create_dyn_array(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1298 { 1299 throw new org.omg.CORBA.NO_IMPLEMENT(); 1300 } 1301 1302 /** 1303 * Creates a new <code>DynUnion</code> object from the given 1304 * <code>TypeCode</code> object. 1305 * 1306 * @param type the <code>TypeCode</code> object from which to create a new 1307 * <code>DynUnion</code> object 1308 * @return the new <code>DynUnion</code> object created from the given 1309 * <code>TypeCode</code> object 1310 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1311 * <code>TypeCode</code> object is not consistent with the operation. 1312 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1313 * comments for unimplemented features</a> 1314 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1315 */ 1316 @Deprecated 1317 public org.omg.CORBA.DynUnion create_dyn_union(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1318 { 1319 throw new org.omg.CORBA.NO_IMPLEMENT(); 1320 } 1321 1322 /** 1323 * Creates a new <code>DynEnum</code> object from the given 1324 * <code>TypeCode</code> object. 1325 * 1326 * @param type the <code>TypeCode</code> object from which to create a new 1327 * <code>DynEnum</code> object 1328 * @return the new <code>DynEnum</code> object created from the given 1329 * <code>TypeCode</code> object 1330 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1331 * <code>TypeCode</code> object is not consistent with the operation. 1332 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1333 * comments for unimplemented features</a> 1334 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1335 */ 1336 @Deprecated 1337 public org.omg.CORBA.DynEnum create_dyn_enum(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1338 { 1339 throw new org.omg.CORBA.NO_IMPLEMENT(); 1340 } 1341 1342 /** 1343 * Can be invoked to create new instances of policy objects 1344 * of a specific type with specified initial state. If 1345 * <tt>create_policy</tt> fails to instantiate a new Policy 1346 * object due to its inability to interpret the requested type 1347 * and content of the policy, it raises the <tt>PolicyError</tt> 1348 * exception with the appropriate reason. 1349 * @param type the <tt>PolicyType</tt> of the policy object to 1350 * be created 1351 * @param val the value that will be used to set the initial 1352 * state of the <tt>Policy</tt> object that is created 1353 * @return Reference to a newly created <tt>Policy</tt> object 1354 * of type specified by the <tt>type</tt> parameter and 1355 * initialized to a state specified by the <tt>val</tt> 1356 * parameter 1357 * @throws <tt>org.omg.CORBA.PolicyError</tt> when the requested 1358 * policy is not supported or a requested initial state 1359 * for the policy is not supported. 1360 */ 1361 public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) 1362 throws org.omg.CORBA.PolicyError 1363 { 1364 // Currently not implemented until PIORB. 1365 throw new org.omg.CORBA.NO_IMPLEMENT(); 1366 } 1367 } | 23 * questions. 24 */ 25 26 package org.omg.CORBA; 27 28 import org.omg.CORBA.portable.*; 29 import org.omg.CORBA.ORBPackage.InvalidName; 30 31 import java.util.Properties; 32 import java.applet.Applet; 33 import java.io.File; 34 import java.io.FileInputStream; 35 36 import java.security.AccessController; 37 import java.security.PrivilegedAction; 38 39 import sun.reflect.misc.ReflectUtil; 40 41 /** 42 * A class providing APIs for the CORBA Object Request Broker 43 * features. The {@code ORB} class also provides 44 * "pluggable ORB implementation" APIs that allow another vendor's ORB 45 * implementation to be used. 46 * <P> 47 * An ORB makes it possible for CORBA objects to communicate 48 * with each other by connecting objects making requests (clients) with 49 * objects servicing requests (servers). 50 * <P> 51 * 52 * The {@code ORB} class, which 53 * encapsulates generic CORBA functionality, does the following: 54 * (Note that items 5 and 6, which include most of the methods in 55 * the class {@code ORB}, are typically used with the 56 * {@code Dynamic Invocation Interface} (DII) and 57 * the {@code Dynamic Skeleton Interface} (DSI). 58 * These interfaces may be used by a developer directly, but 59 * most commonly they are used by the ORB internally and are 60 * not seen by the general programmer.) 61 * <OL> 62 * <li> initializes the ORB implementation by supplying values for 63 * predefined properties and environmental parameters 64 * <li> obtains initial object references to services such as 65 * the NameService using the method {@code resolve_initial_references} 66 * <li> converts object references to strings and back 67 * <li> connects the ORB to a servant (an instance of a CORBA object 68 * implementation) and disconnects the ORB from a servant 69 * <li> creates objects such as 70 * <ul> 71 * <li>{@code TypeCode} 72 * <li>{@code Any} 73 * <li>{@code NamedValue} 74 * <li>{@code Context} 75 * <li>{@code Environment} 76 * <li>lists (such as {@code NVList}) containing these objects 77 * </ul> 78 * <li> sends multiple messages in the DII 79 * </OL> 80 * 81 * <P> 82 * The {@code ORB} class can be used to obtain references to objects 83 * implemented anywhere on the network. 84 * <P> 85 * An application or applet gains access to the CORBA environment 86 * by initializing itself into an {@code ORB} using one of 87 * three {@code init} methods. Two of the three methods use the properties 88 * (associations of a name with a value) shown in the 89 * table below.<BR> 90 * <TABLE BORDER=1 SUMMARY="Standard Java CORBA Properties"> 91 * <TR><TH>Property Name</TH> <TH>Property Value</TH></TR> 92 * <CAPTION>Standard Java CORBA Properties:</CAPTION> 93 * <TR><TD>org.omg.CORBA.ORBClass</TD> 94 * <TD>class name of an ORB implementation</TD></TR> 95 * <TR><TD>org.omg.CORBA.ORBSingletonClass</TD> 96 * <TD>class name of the ORB returned by {@code init()}</TD></TR> 97 * </TABLE> 98 * <P> 99 * These properties allow a different vendor's {@code ORB} 100 * implementation to be "plugged in." 101 * <P> 102 * When an ORB instance is being created, the class name of the ORB 103 * implementation is located using 104 * the following standard search order: 105 * 106 * <OL> 107 * <LI>check in Applet parameter or application string array, if any 108 * 109 * <LI>check in properties parameter, if any 110 * 111 * <LI>check in the System properties 112 * 113 * <LI>check in the orb.properties file located in the user.home 114 * directory (if any) 115 * 116 * <LI>check in the orb.properties file located in the java.home/lib 117 * directory (if any) 118 * 119 * <LI>fall back on a hardcoded default behavior (use the Java IDL 120 * implementation) 121 * </OL> 122 * <P> 123 * Note that Java IDL provides a default implementation for the 124 * fully-functional ORB and for the Singleton ORB. When the method 125 * {@code init} is given no parameters, the default Singleton 126 * ORB is returned. When the method {@code init} is given parameters 127 * but no ORB class is specified, the Java IDL ORB implementation 128 * is returned. 129 * <P> 130 * The following code fragment creates an {@code ORB} object 131 * initialized with the default ORB Singleton. 132 * This ORB has a 133 * restricted implementation to prevent malicious applets from doing 134 * anything beyond creating typecodes. 135 * It is called a singleton 136 * because there is only one instance for an entire virtual machine. 137 * <PRE> 138 * ORB orb = ORB.init(); 139 * </PRE> 140 * <P> 141 * The following code fragment creates an {@code ORB} object 142 * for an application. The parameter {@code args} 143 * represents the arguments supplied to the application's {@code main} 144 * method. Since the property specifies the ORB class to be 145 * "SomeORBImplementation", the new ORB will be initialized with 146 * that ORB implementation. If p had been null, 147 * and the arguments had not specified an ORB class, 148 * the new ORB would have been 149 * initialized with the default Java IDL implementation. 150 * <PRE> 151 * Properties p = new Properties(); 152 * p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation"); 153 * ORB orb = ORB.init(args, p); 154 * </PRE> 155 * <P> 156 * The following code fragment creates an {@code ORB} object 157 * for the applet supplied as the first parameter. If the given 158 * applet does not specify an ORB class, the new ORB will be 159 * initialized with the default Java IDL implementation. 160 * <PRE> 161 * ORB orb = ORB.init(myApplet, null); 162 * </PRE> 163 * <P> 164 * An application or applet can be initialized in one or more ORBs. 165 * ORB initialization is a bootstrap call into the CORBA world. 166 * 167 * 168 * @implNote 169 * When a singleton ORB is configured via the system property, 170 * or orb.properties, it will be 171 * located, and loaded via the system class loader. 172 * Thus, where appropriate, it is necessary that 173 * the classes for this alternative ORBSingleton are available on the application's class path. 174 * It should be noted that the singleton ORB is system wide. 175 * 176 * When a per-application ORB is created via the 2-arg init methods, 254 return value ; 255 } 256 257 String javaHome = System.getProperty("java.home"); 258 fileName = javaHome + File.separator 259 + "lib" + File.separator + "orb.properties"; 260 props = getFileProperties( fileName ) ; 261 262 if (props == null) 263 return null ; 264 else 265 return props.getProperty( name ) ; 266 } 267 } 268 ); 269 270 return propValue; 271 } 272 273 /** 274 * Returns the {@code ORB} singleton object. This method always returns the 275 * same ORB instance, which is an instance of the class described by the 276 * {@code org.omg.CORBA.ORBSingletonClass} system property. 277 * <P> 278 * This no-argument version of the method {@code init} is used primarily 279 * as a factory for {@code TypeCode} objects, which are used by 280 * {@code Helper} classes to implement the method {@code type}. 281 * It is also used to create {@code Any} objects that are used to 282 * describe {@code union} labels (as part of creating a 283 * {@code TypeCode} object for a {@code union}). 284 * <P> 285 * This method is not intended to be used by applets, and in the event 286 * that it is called in an applet environment, the ORB it returns 287 * is restricted so that it can be used only as a factory for 288 * {@code TypeCode} objects. Any {@code TypeCode} objects 289 * it produces can be safely shared among untrusted applets. 290 * <P> 291 * If an ORB is created using this method from an applet, 292 * a system exception will be thrown if 293 * methods other than those for 294 * creating {@code TypeCode} objects are invoked. 295 * 296 * @return the singleton ORB 297 * 298 * @implNote 299 * When configured via the system property, or orb.properties, 300 * the system-wide singleton ORB is located via the 301 * system class loader. 302 */ 303 public static synchronized ORB init() { 304 if (singleton == null) { 305 String className = getSystemProperty(ORBSingletonClassKey); 306 if (className == null) 307 className = getPropertyFromFile(ORBSingletonClassKey); 308 if ((className == null) || 309 (className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) { 310 singleton = new com.sun.corba.se.impl.orb.ORBSingleton(); 311 } else { 312 singleton = create_impl_with_systemclassloader(className); 313 } 314 } 333 334 private static ORB create_impl(String className) { 335 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 336 if (cl == null) 337 cl = ClassLoader.getSystemClassLoader(); 338 339 try { 340 ReflectUtil.checkPackageAccess(className); 341 Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class; 342 Class<?> orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); 343 return (ORB)orbClass.newInstance(); 344 } catch (Throwable ex) { 345 SystemException systemException = new INITIALIZE( 346 "can't instantiate default ORB implementation " + className); 347 systemException.initCause(ex); 348 throw systemException; 349 } 350 } 351 352 /** 353 * Creates a new {@code ORB} instance for a standalone 354 * application. This method may be called from applications 355 * only and returns a new fully functional {@code ORB} object 356 * each time it is called. 357 * @param args command-line arguments for the application's {@code main} 358 * method; may be {@code null} 359 * @param props application-specific properties; may be {@code null} 360 * @return the newly-created ORB instance 361 * 362 * @implNote 363 * When configured via the system property, or orb.properties, 364 * the ORB is located via the thread context class loader. 365 */ 366 public static ORB init(String[] args, Properties props) { 367 // 368 // Note that there is no standard command-line argument for 369 // specifying the default ORB implementation. For an 370 // application you can choose an implementation either by 371 // setting the CLASSPATH to pick a different org.omg.CORBA 372 // and it's baked-in ORB implementation default or by 373 // setting an entry in the properties object or in the 374 // system properties. 375 // 376 String className = null; 377 ORB orb; 378 379 if (props != null) 380 className = props.getProperty(ORBClassKey); 381 if (className == null) 382 className = getSystemProperty(ORBClassKey); 383 if (className == null) 384 className = getPropertyFromFile(ORBClassKey); 385 if ((className == null) || 386 (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { 387 orb = new com.sun.corba.se.impl.orb.ORBImpl(); 388 } else { 389 orb = create_impl(className); 390 } 391 orb.set_parameters(args, props); 392 return orb; 393 } 394 395 396 /** 397 * Creates a new {@code ORB} instance for an applet. This 398 * method may be called from applets only and returns a new 399 * fully-functional {@code ORB} object each time it is called. 400 * @param app the applet; may be {@code null} 401 * @param props applet-specific properties; may be {@code null} 402 * @return the newly-created ORB instance 403 * 404 * @implNote 405 * When configured via the system property, or orb.properties, 406 * the ORB is located via the thread context class loader. 407 */ 408 public static ORB init(Applet app, Properties props) { 409 String className; 410 ORB orb; 411 412 className = app.getParameter(ORBClassKey); 413 if (className == null && props != null) 414 className = props.getProperty(ORBClassKey); 415 if (className == null) 416 className = getSystemProperty(ORBClassKey); 417 if (className == null) 418 className = getPropertyFromFile(ORBClassKey); 419 if ((className == null) || 420 (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { 421 orb = new com.sun.corba.se.impl.orb.ORBImpl(); 422 } else { 423 orb = create_impl(className); 424 } 425 orb.set_parameters(app, props); 426 return orb; 427 } 428 429 /** 430 * Allows the ORB implementation to be initialized with the given 431 * parameters and properties. This method, used in applications only, 432 * is implemented by subclass ORB implementations and called 433 * by the appropriate {@code init} method to pass in its parameters. 434 * 435 * @param args command-line arguments for the application's {@code main} 436 * method; may be {@code null} 437 * @param props application-specific properties; may be {@code null} 438 */ 439 abstract protected void set_parameters(String[] args, Properties props); 440 441 /** 442 * Allows the ORB implementation to be initialized with the given 443 * applet and parameters. This method, used in applets only, 444 * is implemented by subclass ORB implementations and called 445 * by the appropriate {@code init} method to pass in its parameters. 446 * 447 * @param app the applet; may be {@code null} 448 * @param props applet-specific properties; may be {@code null} 449 */ 450 abstract protected void set_parameters(Applet app, Properties props); 451 452 /** 453 * Connects the given servant object (a Java object that is 454 * an instance of the server implementation class) 455 * to the ORB. The servant class must 456 * extend the {@code ImplBase} class corresponding to the interface that is 457 * supported by the server. The servant must thus be a CORBA object 458 * reference, and inherit from {@code org.omg.CORBA.Object}. 459 * Servants created by the user can start receiving remote invocations 460 * after the method {@code connect} has been called. A servant may also be 461 * automatically and implicitly connected to the ORB if it is passed as 462 * an IDL parameter in an IDL method invocation on a non-local object, 463 * that is, if the servant object has to be marshalled and sent outside of the 464 * process address space. 465 * <P> 466 * Calling the method {@code connect} has no effect 467 * when the servant object is already connected to the ORB. 468 * <P> 469 * Deprecated by the OMG in favor of the Portable Object Adapter APIs. 470 * 471 * @param obj The servant object reference 472 */ 473 public void connect(org.omg.CORBA.Object obj) { 474 throw new NO_IMPLEMENT(); 475 } 476 477 /** 478 * Destroys the ORB so that its resources can be reclaimed. 479 * Any operation invoked on a destroyed ORB reference will throw the 480 * {@code OBJECT_NOT_EXIST} exception. 481 * Once an ORB has been destroyed, another call to {@code init} 482 * with the same ORBid will return a reference to a newly constructed ORB.<p> 483 * If {@code destroy} is called on an ORB that has not been shut down, 484 * it will start the shut down process and block until the ORB has shut down 485 * before it destroys the ORB.<br> 486 * If an application calls {@code destroy} in a thread that is currently servicing 487 * an invocation, the {@code BAD_INV_ORDER} system exception will be thrown 488 * with the OMG minor code 3, since blocking would result in a deadlock.<p> 489 * For maximum portability and to avoid resource leaks, an application should 490 * always call {@code shutdown} and {@code destroy} 491 * on all ORB instances before exiting. 492 * 493 * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing an invocation 494 */ 495 public void destroy( ) { 496 throw new NO_IMPLEMENT(); 497 } 498 499 /** 500 * Disconnects the given servant object from the ORB. After this method returns, 501 * the ORB will reject incoming remote requests for the disconnected 502 * servant and will send the exception 503 * {@code org.omg.CORBA.OBJECT_NOT_EXIST} back to the 504 * remote client. Thus the object appears to be destroyed from the 505 * point of view of remote clients. Note, however, that local requests issued 506 * using the servant directly do not 507 * pass through the ORB; hence, they will continue to be processed by the 508 * servant. 509 * <P> 510 * Calling the method {@code disconnect} has no effect 511 * if the servant is not connected to the ORB. 512 * <P> 513 * Deprecated by the OMG in favor of the Portable Object Adapter APIs. 514 * 515 * @param obj The servant object to be disconnected from the ORB 516 */ 517 public void disconnect(org.omg.CORBA.Object obj) { 518 throw new NO_IMPLEMENT(); 519 } 520 521 // 522 // ORB method implementations. 523 // 524 // We are trying to accomplish 2 things at once in this class. 525 // It can act as a default ORB implementation front-end, 526 // creating an actual ORB implementation object which is a 527 // subclass of this ORB class and then delegating the method 528 // implementations. 529 // 530 // To accomplish the delegation model, the 'delegate' private instance 531 // variable is set if an instance of this class is created directly. 532 // 533 534 /** 535 * Returns a list of the initially available CORBA object references, 536 * such as "NameService" and "InterfaceRepository". 537 * 538 * @return an array of {@code String} objects that represent 539 * the object references for CORBA services 540 * that are initially available with this ORB 541 */ 542 abstract public String[] list_initial_services(); 543 544 /** 545 * Resolves a specific object reference from the set of available 546 * initial service names. 547 * 548 * @param object_name the name of the initial service as a string 549 * @return the object reference associated with the given name 550 * @exception InvalidName if the given name is not associated with a 551 * known service 552 */ 553 abstract public org.omg.CORBA.Object resolve_initial_references(String object_name) 554 throws InvalidName; 555 556 /** 557 * Converts the given CORBA object reference to a string. 558 * Note that the format of this string is predefined by IIOP, allowing 559 * strings generated by a different ORB to be converted back into an object 560 * reference. 561 * <P> 562 * The resulting {@code String} object may be stored or communicated 563 * in any way that a {@code String} object can be manipulated. 564 * 565 * @param obj the object reference to stringify 566 * @return the string representing the object reference 567 */ 568 abstract public String object_to_string(org.omg.CORBA.Object obj); 569 570 /** 571 * Converts a string produced by the method {@code object_to_string} 572 * back to a CORBA object reference. 573 * 574 * @param str the string to be converted back to an object reference. It must 575 * be the result of converting an object reference to a string using the 576 * method {@code object_to_string}. 577 * @return the object reference 578 */ 579 abstract public org.omg.CORBA.Object string_to_object(String str); 580 581 /** 582 * Allocates an {@code NVList} with (probably) enough 583 * space for the specified number of {@code NamedValue} objects. 584 * Note that the specified size is only a hint to help with 585 * storage allocation and does not imply the maximum size of the list. 586 * 587 * @param count suggested number of {@code NamedValue} objects for 588 * which to allocate space 589 * @return the newly-created {@code NVList} 590 * 591 * @see NVList 592 */ 593 abstract public NVList create_list(int count); 594 595 /** 596 * Creates an {@code NVList} initialized with argument 597 * descriptions for the operation described in the given 598 * {@code OperationDef} object. This {@code OperationDef} object 599 * is obtained from an Interface Repository. The arguments in the 600 * returned {@code NVList} object are in the same order as in the 601 * original IDL operation definition, which makes it possible for the list 602 * to be used in dynamic invocation requests. 603 * 604 * @param oper the {@code OperationDef} object to use to create the list 605 * @return a newly-created {@code NVList} object containing 606 * descriptions of the arguments to the method described in the given 607 * {@code OperationDef} object 608 * 609 * @see NVList 610 */ 611 public NVList create_operation_list(org.omg.CORBA.Object oper) 612 { 613 // If we came here, it means that the actual ORB implementation 614 // did not have a create_operation_list(...CORBA.Object oper) method, 615 // so lets check if it has a create_operation_list(OperationDef oper) 616 // method. 617 try { 618 // First try to load the OperationDef class 619 String opDefClassName = "org.omg.CORBA.OperationDef"; 620 Class<?> opDefClass = null; 621 622 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 623 if ( cl == null ) 624 cl = ClassLoader.getSystemClassLoader(); 625 // if this throws a ClassNotFoundException, it will be caught below. 626 opDefClass = Class.forName(opDefClassName, true, cl); 627 640 if (t instanceof Error) { 641 throw (Error) t; 642 } 643 else if (t instanceof RuntimeException) { 644 throw (RuntimeException) t; 645 } 646 else { 647 throw new org.omg.CORBA.NO_IMPLEMENT(); 648 } 649 } 650 catch( RuntimeException ex ) { 651 throw ex; 652 } 653 catch( Exception exr ) { 654 throw new org.omg.CORBA.NO_IMPLEMENT(); 655 } 656 } 657 658 659 /** 660 * Creates a {@code NamedValue} object 661 * using the given name, value, and argument mode flags. 662 * <P> 663 * A {@code NamedValue} object serves as (1) a parameter or return 664 * value or (2) a context property. 665 * It may be used by itself or 666 * as an element in an {@code NVList} object. 667 * 668 * @param s the name of the {@code NamedValue} object 669 * @param any the {@code Any} value to be inserted into the 670 * {@code NamedValue} object 671 * @param flags the argument mode flags for the {@code NamedValue}: one of 672 * {@code ARG_IN.value}, {@code ARG_OUT.value}, 673 * or {@code ARG_INOUT.value}. 674 * 675 * @return the newly-created {@code NamedValue} object 676 * @see NamedValue 677 */ 678 abstract public NamedValue create_named_value(String s, Any any, int flags); 679 680 /** 681 * Creates an empty {@code ExceptionList} object. 682 * 683 * @return the newly-created {@code ExceptionList} object 684 */ 685 abstract public ExceptionList create_exception_list(); 686 687 /** 688 * Creates an empty {@code ContextList} object. 689 * 690 * @return the newly-created {@code ContextList} object 691 * @see ContextList 692 * @see Context 693 */ 694 abstract public ContextList create_context_list(); 695 696 /** 697 * Gets the default {@code Context} object. 698 * 699 * @return the default {@code Context} object 700 * @see Context 701 */ 702 abstract public Context get_default_context(); 703 704 /** 705 * Creates an {@code Environment} object. 706 * 707 * @return the newly-created {@code Environment} object 708 * @see Environment 709 */ 710 abstract public Environment create_environment(); 711 712 /** 713 * Creates a new {@code org.omg.CORBA.portable.OutputStream} into which 714 * IDL method parameters can be marshalled during method invocation. 715 * @return the newly-created 716 * {@code org.omg.CORBA.portable.OutputStream} object 717 */ 718 abstract public org.omg.CORBA.portable.OutputStream create_output_stream(); 719 720 /** 721 * Sends multiple dynamic (DII) requests asynchronously without expecting 722 * any responses. Note that oneway invocations are not guaranteed to 723 * reach the server. 724 * 725 * @param req an array of request objects 726 */ 727 abstract public void send_multiple_requests_oneway(Request[] req); 728 729 /** 730 * Sends multiple dynamic (DII) requests asynchronously. 731 * 732 * @param req an array of {@code Request} objects 733 */ 734 abstract public void send_multiple_requests_deferred(Request[] req); 735 736 /** 737 * Finds out if any of the deferred (asynchronous) invocations have 738 * a response yet. 739 * @return {@code true} if there is a response available; 740 * {@code false} otherwise 741 */ 742 abstract public boolean poll_next_response(); 743 744 /** 745 * Gets the next {@code Request} instance for which a response 746 * has been received. 747 * 748 * @return the next {@code Request} object ready with a response 749 * @exception WrongTransaction if the method {@code get_next_response} 750 * is called from a transaction scope different 751 * from the one from which the original request was sent. See the 752 * OMG Transaction Service specification for details. 753 */ 754 abstract public Request get_next_response() throws WrongTransaction; 755 756 /** 757 * Retrieves the {@code TypeCode} object that represents 758 * the given primitive IDL type. 759 * 760 * @param tcKind the {@code TCKind} instance corresponding to the 761 * desired primitive type 762 * @return the requested {@code TypeCode} object 763 */ 764 abstract public TypeCode get_primitive_tc(TCKind tcKind); 765 766 /** 767 * Creates a {@code TypeCode} object representing an IDL {@code struct}. 768 * The {@code TypeCode} object is initialized with the given id, 769 * name, and members. 770 * 771 * @param id the repository id for the {@code struct} 772 * @param name the name of the {@code struct} 773 * @param members an array describing the members of the {@code struct} 774 * @return a newly-created {@code TypeCode} object describing 775 * an IDL {@code struct} 776 */ 777 abstract public TypeCode create_struct_tc(String id, String name, 778 StructMember[] members); 779 780 /** 781 * Creates a {@code TypeCode} object representing an IDL {@code union}. 782 * The {@code TypeCode} object is initialized with the given id, 783 * name, discriminator type, and members. 784 * 785 * @param id the repository id of the {@code union} 786 * @param name the name of the {@code union} 787 * @param discriminator_type the type of the {@code union} discriminator 788 * @param members an array describing the members of the {@code union} 789 * @return a newly-created {@code TypeCode} object describing 790 * an IDL {@code union} 791 */ 792 abstract public TypeCode create_union_tc(String id, String name, 793 TypeCode discriminator_type, 794 UnionMember[] members); 795 796 /** 797 * Creates a {@code TypeCode} object representing an IDL {@code enum}. 798 * The {@code TypeCode} object is initialized with the given id, 799 * name, and members. 800 * 801 * @param id the repository id for the {@code enum} 802 * @param name the name for the {@code enum} 803 * @param members an array describing the members of the {@code enum} 804 * @return a newly-created {@code TypeCode} object describing 805 * an IDL {@code enum} 806 */ 807 abstract public TypeCode create_enum_tc(String id, String name, String[] members); 808 809 /** 810 * Creates a {@code TypeCode} object representing an IDL {@code alias} 811 * ({@code typedef}). 812 * The {@code TypeCode} object is initialized with the given id, 813 * name, and original type. 814 * 815 * @param id the repository id for the alias 816 * @param name the name for the alias 817 * @param original_type 818 * the {@code TypeCode} object describing the original type 819 * for which this is an alias 820 * @return a newly-created {@code TypeCode} object describing 821 * an IDL {@code alias} 822 */ 823 abstract public TypeCode create_alias_tc(String id, String name, 824 TypeCode original_type); 825 826 /** 827 * Creates a {@code TypeCode} object representing an IDL {@code exception}. 828 * The {@code TypeCode} object is initialized with the given id, 829 * name, and members. 830 * 831 * @param id the repository id for the {@code exception} 832 * @param name the name for the {@code exception} 833 * @param members an array describing the members of the {@code exception} 834 * @return a newly-created {@code TypeCode} object describing 835 * an IDL {@code exception} 836 */ 837 abstract public TypeCode create_exception_tc(String id, String name, 838 StructMember[] members); 839 840 /** 841 * Creates a {@code TypeCode} object representing an IDL {@code interface}. 842 * The {@code TypeCode} object is initialized with the given id 843 * and name. 844 * 845 * @param id the repository id for the interface 846 * @param name the name for the interface 847 * @return a newly-created {@code TypeCode} object describing 848 * an IDL {@code interface} 849 */ 850 851 abstract public TypeCode create_interface_tc(String id, String name); 852 853 /** 854 * Creates a {@code TypeCode} object representing a bounded IDL 855 * {@code string}. 856 * The {@code TypeCode} object is initialized with the given bound, 857 * which represents the maximum length of the string. Zero indicates 858 * that the string described by this type code is unbounded. 859 * 860 * @param bound the bound for the {@code string}; cannot be negative 861 * @return a newly-created {@code TypeCode} object describing 862 * a bounded IDL {@code string} 863 * @exception BAD_PARAM if bound is a negative value 864 */ 865 866 abstract public TypeCode create_string_tc(int bound); 867 868 /** 869 * Creates a {@code TypeCode} object representing a bounded IDL 870 * {@code wstring} (wide string). 871 * The {@code TypeCode} object is initialized with the given bound, 872 * which represents the maximum length of the wide string. Zero indicates 873 * that the string described by this type code is unbounded. 874 * 875 * @param bound the bound for the {@code wstring}; cannot be negative 876 * @return a newly-created {@code TypeCode} object describing 877 * a bounded IDL {@code wstring} 878 * @exception BAD_PARAM if bound is a negative value 879 */ 880 abstract public TypeCode create_wstring_tc(int bound); 881 882 /** 883 * Creates a {@code TypeCode} object representing an IDL {@code sequence}. 884 * The {@code TypeCode} object is initialized with the given bound and 885 * element type. 886 * 887 * @param bound the bound for the {@code sequence}, 0 if unbounded 888 * @param element_type the {@code TypeCode} object describing 889 * the elements contained in the {@code sequence} 890 * 891 * @return a newly-created {@code TypeCode} object describing 892 * an IDL {@code sequence} 893 */ 894 abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type); 895 896 /** 897 * Creates a {@code TypeCode} object representing a 898 * a recursive IDL {@code sequence}. 899 * <P> 900 * For the IDL {@code struct} Node in following code fragment, 901 * the offset parameter for creating its sequence would be 1: 902 * <PRE> 903 * Struct Node { 904 * long value; 905 * Sequence <Node> subnodes; 906 * }; 907 * </PRE> 908 * 909 * @param bound the bound for the sequence, 0 if unbounded 910 * @param offset the index to the enclosing {@code TypeCode} object 911 * that describes the elements of this sequence 912 * @return a newly-created {@code TypeCode} object describing 913 * a recursive sequence 914 * @deprecated Use a combination of create_recursive_tc and create_sequence_tc instead 915 * @see #create_recursive_tc(String) create_recursive_tc 916 * @see #create_sequence_tc(int, TypeCode) create_sequence_tc 917 */ 918 @Deprecated 919 abstract public TypeCode create_recursive_sequence_tc(int bound, int offset); 920 921 /** 922 * Creates a {@code TypeCode} object representing an IDL {@code array}. 923 * The {@code TypeCode} object is initialized with the given length and 924 * element type. 925 * 926 * @param length the length of the {@code array} 927 * @param element_type a {@code TypeCode} object describing the type 928 * of element contained in the {@code array} 929 * @return a newly-created {@code TypeCode} object describing 930 * an IDL {@code array} 931 */ 932 abstract public TypeCode create_array_tc(int length, TypeCode element_type); 933 934 /** 935 * Create a {@code TypeCode} object for an IDL native type. 936 * 937 * @param id the logical id for the native type. 938 * @param name the name of the native type. 939 * @return the requested TypeCode. 940 */ 941 public org.omg.CORBA.TypeCode create_native_tc(String id, 942 String name) 943 { 944 throw new org.omg.CORBA.NO_IMPLEMENT(); 945 } 946 947 /** 948 * Create a {@code TypeCode} object for an IDL abstract interface. 949 * 950 * @param id the logical id for the abstract interface type. 951 * @param name the name of the abstract interface type. 952 * @return the requested TypeCode. 953 */ 954 public org.omg.CORBA.TypeCode create_abstract_interface_tc( 955 String id, 956 String name) 957 { 958 throw new org.omg.CORBA.NO_IMPLEMENT(); 959 } 960 961 962 /** 963 * Create a {@code TypeCode} object for an IDL fixed type. 964 * 965 * @param digits specifies the total number of decimal digits in the number 966 * and must be from 1 to 31 inclusive. 967 * @param scale specifies the position of the decimal point. 968 * @return the requested TypeCode. 969 */ 970 public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) 971 { 972 throw new org.omg.CORBA.NO_IMPLEMENT(); 973 } 974 975 976 // orbos 98-01-18: Objects By Value -- begin 977 978 979 /** 980 * Create a {@code TypeCode} object for an IDL value type. 981 * The concrete_base parameter is the TypeCode for the immediate 982 * concrete valuetype base of the valuetype for which the TypeCode 983 * is being created. 984 * It may be null if the valuetype does not have a concrete base. 985 * 986 * @param id the logical id for the value type. 987 * @param name the name of the value type. 988 * @param type_modifier one of the value type modifier constants: 989 * VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE 990 * @param concrete_base a {@code TypeCode} object 991 * describing the concrete valuetype base 992 * @param members an array containing the members of the value type 993 * @return the requested TypeCode 994 */ 995 public org.omg.CORBA.TypeCode create_value_tc(String id, 996 String name, 997 short type_modifier, 998 TypeCode concrete_base, 999 ValueMember[] members) 1000 { 1001 throw new org.omg.CORBA.NO_IMPLEMENT(); 1002 } 1003 1004 /** 1005 * Create a recursive {@code TypeCode} object which 1006 * serves as a placeholder for a concrete TypeCode during the process of creating 1007 * TypeCodes which contain recursion. The id parameter specifies the repository id of 1008 * the type for which the recursive TypeCode is serving as a placeholder. Once the 1009 * recursive TypeCode has been properly embedded in the enclosing TypeCode which 1010 * corresponds to the specified repository id, it will function as a normal TypeCode. 1011 * Invoking operations on the recursive TypeCode before it has been embedded in the 1012 * enclosing TypeCode will result in a {@code BAD_TYPECODE} exception. 1013 * <P> 1014 * For example, the following IDL type declaration contains recursion: 1015 * <PRE> 1016 * Struct Node { 1017 * Sequence<Node> subnodes; 1018 * }; 1019 * </PRE> 1020 * <P> 1021 * To create a TypeCode for struct Node, you would invoke the TypeCode creation 1022 * operations as shown below: 1023 * <PRE> 1024 * String nodeID = "IDL:Node:1.0"; 1025 * TypeCode recursiveSeqTC = orb.create_sequence_tc(0, orb.create_recursive_tc(nodeID)); 1026 * StructMember[] members = { new StructMember("subnodes", recursiveSeqTC, null) }; 1027 * TypeCode structNodeTC = orb.create_struct_tc(nodeID, "Node", members); 1028 * </PRE> 1029 * <P> 1030 * Also note that the following is an illegal IDL type declaration: 1031 * <PRE> 1032 * Struct Node { 1033 * Node next; 1034 * }; 1035 * </PRE> 1036 * <P> 1037 * Recursive types can only appear within sequences which can be empty. 1038 * That way marshaling problems, when transmitting the struct in an Any, are avoided. 1039 * 1040 * @param id the logical id of the referenced type 1041 * @return the requested TypeCode 1042 */ 1043 public org.omg.CORBA.TypeCode create_recursive_tc(String id) { 1044 // implemented in subclass 1045 throw new org.omg.CORBA.NO_IMPLEMENT(); 1046 } 1047 1048 /** 1049 * Creates a {@code TypeCode} object for an IDL value box. 1050 * 1051 * @param id the logical id for the value type 1052 * @param name the name of the value type 1053 * @param boxed_type the TypeCode for the type 1054 * @return the requested TypeCode 1055 */ 1056 public org.omg.CORBA.TypeCode create_value_box_tc(String id, 1057 String name, 1058 TypeCode boxed_type) 1059 { 1060 // implemented in subclass 1061 throw new org.omg.CORBA.NO_IMPLEMENT(); 1062 } 1063 1064 // orbos 98-01-18: Objects By Value -- end 1065 1066 /** 1067 * Creates an IDL {@code Any} object initialized to 1068 * contain a {@code Typecode} object whose {@code kind} field 1069 * is set to {@code TCKind.tc_null}. 1070 * 1071 * @return a newly-created {@code Any} object 1072 */ 1073 abstract public Any create_any(); 1074 1075 1076 1077 1078 /** 1079 * Retrieves a {@code Current} object. 1080 * The {@code Current} interface is used to manage thread-specific 1081 * information for use by services such as transactions and security. 1082 * 1083 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1084 * comments for unimplemented features</a> 1085 * 1086 * @return a newly-created {@code Current} object 1087 * @deprecated use {@code resolve_initial_references}. 1088 */ 1089 @Deprecated 1090 public org.omg.CORBA.Current get_current() 1091 { 1092 throw new org.omg.CORBA.NO_IMPLEMENT(); 1093 } 1094 1095 /** 1096 * This operation blocks the current thread until the ORB has 1097 * completed the shutdown process, initiated when some thread calls 1098 * {@code shutdown}. It may be used by multiple threads which 1099 * get all notified when the ORB shuts down. 1100 * 1101 */ 1102 public void run() 1103 { 1104 throw new org.omg.CORBA.NO_IMPLEMENT(); 1105 } 1106 1107 /** 1108 * Instructs the ORB to shut down, which causes all 1109 * object adapters to shut down, in preparation for destruction.<br> 1110 * If the {@code wait_for_completion} parameter 1111 * is true, this operation blocks until all ORB processing (including 1112 * processing of currently executing requests, object deactivation, 1113 * and other object adapter operations) has completed. 1114 * If an application does this in a thread that is currently servicing 1115 * an invocation, the {@code BAD_INV_ORDER} system exception 1116 * will be thrown with the OMG minor code 3, 1117 * since blocking would result in a deadlock.<br> 1118 * If the {@code wait_for_completion} parameter is {@code FALSE}, 1119 * then shutdown may not have completed upon return.<p> 1120 * While the ORB is in the process of shutting down, the ORB operates as normal, 1121 * servicing incoming and outgoing requests until all requests have been completed. 1122 * Once an ORB has shutdown, only object reference management operations 1123 * may be invoked on the ORB or any object reference obtained from it. 1124 * An application may also invoke the {@code destroy} operation on the ORB itself. 1125 * Invoking any other operation will throw the {@code BAD_INV_ORDER} 1126 * system exception with the OMG minor code 4.<p> 1127 * The {@code ORB.run} method will return after 1128 * {@code shutdown} has been called. 1129 * 1130 * @param wait_for_completion {@code true} if the call 1131 * should block until the shutdown is complete; 1132 * {@code false} if it should return immediately 1133 * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing 1134 * an invocation 1135 */ 1136 public void shutdown(boolean wait_for_completion) 1137 { 1138 throw new org.omg.CORBA.NO_IMPLEMENT(); 1139 } 1140 1141 /** 1142 * Returns {@code true} if the ORB needs the main thread to 1143 * perform some work, and {@code false} if the ORB does not 1144 * need the main thread. 1145 * 1146 * @return {@code true} if there is work pending, meaning that the ORB 1147 * needs the main thread to perform some work; {@code false} 1148 * if there is no work pending and thus the ORB does not need the 1149 * main thread 1150 * 1151 */ 1152 public boolean work_pending() 1153 { 1154 throw new org.omg.CORBA.NO_IMPLEMENT(); 1155 } 1156 1157 /** 1158 * Performs an implementation-dependent unit of work if called 1159 * by the main thread. Otherwise it does nothing. 1160 * The methods {@code work_pending} and {@code perform_work} 1161 * can be used in 1162 * conjunction to implement a simple polling loop that multiplexes 1163 * the main thread among the ORB and other activities. 1164 * 1165 */ 1166 public void perform_work() 1167 { 1168 throw new org.omg.CORBA.NO_IMPLEMENT(); 1169 } 1170 1171 /** 1172 * Used to obtain information about CORBA facilities and services 1173 * that are supported by this ORB. The service type for which 1174 * information is being requested is passed in as the in 1175 * parameter {@code service_type}, the values defined by 1176 * constants in the CORBA module. If service information is 1177 * available for that type, that is returned in the out parameter 1178 * {@code service_info}, and the operation returns the 1179 * value {@code true}. If no information for the requested 1180 * services type is available, the operation returns {@code false} 1181 * (i.e., the service is not supported by this ORB). 1182 * 1183 * @param service_type a {@code short} indicating the 1184 * service type for which information is being requested 1185 * @param service_info a {@code ServiceInformationHolder} object 1186 * that will hold the {@code ServiceInformation} object 1187 * produced by this method 1188 * @return {@code true} if service information is available 1189 * for the {@code service_type}; 1190 * {@code false} if no information for the 1191 * requested services type is available 1192 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1193 * comments for unimplemented features</a> 1194 */ 1195 public boolean get_service_information(short service_type, 1196 ServiceInformationHolder service_info) 1197 { 1198 throw new org.omg.CORBA.NO_IMPLEMENT(); 1199 } 1200 1201 // orbos 98-01-18: Objects By Value -- begin 1202 1203 /** 1204 * Creates a new {@code DynAny} object from the given 1205 * {@code Any} object. 1206 * 1207 * @param value the {@code Any} object from which to create a new 1208 * {@code DynAny} object 1209 * @return the new {@code DynAny} object created from the given 1210 * {@code Any} object 1211 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1212 * comments for unimplemented features</a> 1213 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1214 */ 1215 @Deprecated 1216 public org.omg.CORBA.DynAny create_dyn_any(org.omg.CORBA.Any value) 1217 { 1218 throw new org.omg.CORBA.NO_IMPLEMENT(); 1219 } 1220 1221 /** 1222 * Creates a basic {@code DynAny} object from the given 1223 * {@code TypeCode} object. 1224 * 1225 * @param type the {@code TypeCode} object from which to create a new 1226 * {@code DynAny} object 1227 * @return the new {@code DynAny} object created from the given 1228 * {@code TypeCode} object 1229 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1230 * {@code TypeCode} object is not consistent with the operation. 1231 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1232 * comments for unimplemented features</a> 1233 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1234 */ 1235 @Deprecated 1236 public org.omg.CORBA.DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1237 { 1238 throw new org.omg.CORBA.NO_IMPLEMENT(); 1239 } 1240 1241 /** 1242 * Creates a new {@code DynStruct} object from the given 1243 * {@code TypeCode} object. 1244 * 1245 * @param type the {@code TypeCode} object from which to create a new 1246 * {@code DynStruct} object 1247 * @return the new {@code DynStruct} object created from the given 1248 * {@code TypeCode} object 1249 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1250 * {@code TypeCode} object is not consistent with the operation. 1251 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1252 * comments for unimplemented features</a> 1253 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1254 */ 1255 @Deprecated 1256 public org.omg.CORBA.DynStruct create_dyn_struct(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1257 { 1258 throw new org.omg.CORBA.NO_IMPLEMENT(); 1259 } 1260 1261 /** 1262 * Creates a new {@code DynSequence} object from the given 1263 * {@code TypeCode} object. 1264 * 1265 * @param type the {@code TypeCode} object from which to create a new 1266 * {@code DynSequence} object 1267 * @return the new {@code DynSequence} object created from the given 1268 * {@code TypeCode} object 1269 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1270 * {@code TypeCode} object is not consistent with the operation. 1271 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1272 * comments for unimplemented features</a> 1273 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1274 */ 1275 @Deprecated 1276 public org.omg.CORBA.DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1277 { 1278 throw new org.omg.CORBA.NO_IMPLEMENT(); 1279 } 1280 1281 1282 /** 1283 * Creates a new {@code DynArray} object from the given 1284 * {@code TypeCode} object. 1285 * 1286 * @param type the {@code TypeCode} object from which to create a new 1287 * {@code DynArray} object 1288 * @return the new {@code DynArray} object created from the given 1289 * {@code TypeCode} object 1290 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1291 * {@code TypeCode} object is not consistent with the operation. 1292 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1293 * comments for unimplemented features</a> 1294 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1295 */ 1296 @Deprecated 1297 public org.omg.CORBA.DynArray create_dyn_array(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1298 { 1299 throw new org.omg.CORBA.NO_IMPLEMENT(); 1300 } 1301 1302 /** 1303 * Creates a new {@code DynUnion} object from the given 1304 * {@code TypeCode} object. 1305 * 1306 * @param type the {@code TypeCode} object from which to create a new 1307 * {@code DynUnion} object 1308 * @return the new {@code DynUnion} object created from the given 1309 * {@code TypeCode} object 1310 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1311 * {@code TypeCode} object is not consistent with the operation. 1312 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1313 * comments for unimplemented features</a> 1314 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1315 */ 1316 @Deprecated 1317 public org.omg.CORBA.DynUnion create_dyn_union(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1318 { 1319 throw new org.omg.CORBA.NO_IMPLEMENT(); 1320 } 1321 1322 /** 1323 * Creates a new {@code DynEnum} object from the given 1324 * {@code TypeCode} object. 1325 * 1326 * @param type the {@code TypeCode} object from which to create a new 1327 * {@code DynEnum} object 1328 * @return the new {@code DynEnum} object created from the given 1329 * {@code TypeCode} object 1330 * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given 1331 * {@code TypeCode} object is not consistent with the operation. 1332 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 1333 * comments for unimplemented features</a> 1334 * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead 1335 */ 1336 @Deprecated 1337 public org.omg.CORBA.DynEnum create_dyn_enum(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode 1338 { 1339 throw new org.omg.CORBA.NO_IMPLEMENT(); 1340 } 1341 1342 /** 1343 * Can be invoked to create new instances of policy objects 1344 * of a specific type with specified initial state. If 1345 * {@code create_policy} fails to instantiate a new Policy 1346 * object due to its inability to interpret the requested type 1347 * and content of the policy, it raises the {@code PolicyError} 1348 * exception with the appropriate reason. 1349 * @param type the {@code PolicyType} of the policy object to 1350 * be created 1351 * @param val the value that will be used to set the initial 1352 * state of the {@code Policy} object that is created 1353 * @return Reference to a newly created {@code Policy} object 1354 * of type specified by the {@code type} parameter and 1355 * initialized to a state specified by the {@code val} 1356 * parameter 1357 * @throws org.omg.CORBA.PolicyError when the requested 1358 * policy is not supported or a requested initial state 1359 * for the policy is not supported. 1360 */ 1361 public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) 1362 throws org.omg.CORBA.PolicyError 1363 { 1364 // Currently not implemented until PIORB. 1365 throw new org.omg.CORBA.NO_IMPLEMENT(); 1366 } 1367 } |