1. /*
  2. * @(#)ORB.java 1.90 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package org.omg.CORBA;
  8. import org.omg.CORBA.portable.*;
  9. import org.omg.CORBA.ORBPackage.InvalidName;
  10. import java.util.Properties;
  11. import java.applet.Applet;
  12. import java.io.File;
  13. import java.io.FileInputStream;
  14. import java.security.AccessController; // JDK1.2
  15. import java.security.PrivilegedAction; // JDK1.2
  16. /**
  17. * A class providing APIs for the CORBA Object Request Broker
  18. * features. The <code>ORB</code> class also provides
  19. * "pluggable ORB implementation" APIs that allow another vendor's ORB
  20. * implementation to be used.
  21. * <P>
  22. * An ORB makes it possible for CORBA objects to communicate
  23. * with each other by connecting objects making requests (clients) with
  24. * objects servicing requests (servers).
  25. * <P>
  26. *
  27. * The <code>ORB</code> class, which
  28. * encapsulates generic CORBA functionality, does the following:
  29. * (Note that items 5 and 6, which include most of the methods in
  30. * the class <code>ORB</code>, are typically used with the <code>Dynamic Invocation
  31. * Interface</code> (DII) and the <code>Dynamic Skeleton Interface</code>
  32. * (DSI).
  33. * These interfaces may be used by a developer directly, but
  34. * most commonly they are used by the ORB internally and are
  35. * not seen by the general programmer.)
  36. * <OL>
  37. * <li> initializes the ORB implementation by supplying values for
  38. * predefined properties and environmental parameters
  39. * <li> obtains initial object references to services such as
  40. * the NameService using the method <code>resolve_initial_references</code>
  41. * <li> converts object references to strings and back
  42. * <li> connects the ORB to a servant (an instance of a CORBA object
  43. * implementation) and disconnects the ORB from a servant
  44. * <li> creates objects such as
  45. * <ul>
  46. * <li><code>TypeCode</code>
  47. * <li><code>Any</code>
  48. * <li><code>NamedValue</code>
  49. * <li><code>Context</code>
  50. * <li><code>Environment</code>
  51. * <li>lists (such as <code>NVList</code>) containing these objects
  52. * </ul>
  53. * <li> sends multiple messages in the DII
  54. * </OL>
  55. *
  56. * <P>
  57. * The <code>ORB</code> class can be used to obtain references to objects
  58. * implemented anywhere on the network.
  59. * <P>
  60. * An application or applet gains access to the CORBA environment
  61. * by initializing itself into an <code>ORB</code> using one of
  62. * three <code>init</code> methods. Two of the three methods use the properties
  63. * (associations of a name with a value) shown in the
  64. * table below.<BR>
  65. * <TABLE BORDER>
  66. * <TR><TH>Property Name</TH> <TH>Property Value</TH></TR>
  67. * <CAPTION>Standard Java CORBA Properties:</CAPTION>
  68. * <TR><TD>org.omg.CORBA.ORBClass</TD>
  69. * <TD>class name of an ORB implementation</TD></TR>
  70. * <TR><TD>org.omg.CORBA.ORBSingletonClass</TD>
  71. * <TD>class name of the ORB returned by <code>init()</code></TD></TR>
  72. * </TABLE>
  73. * <P>
  74. * These properties allow a different vendor's <code>ORB</code>
  75. * implementation to be "plugged in."
  76. * <P>
  77. * When an ORB instance is being created, the class name of the ORB
  78. * implementation is located using
  79. * the following standard search order:<P>
  80. *
  81. * <OL>
  82. * <LI>check in Applet parameter or application string array, if any
  83. *
  84. * <LI>check in properties parameter, if any
  85. *
  86. * <LI>check in the System properties
  87. *
  88. * <LI>check in the orb.properties file located in the java.home/lib
  89. * directory
  90. *
  91. * <LI>fall back on a hardcoded default behavior (use the Java IDL
  92. * implementation)
  93. * </OL>
  94. * <P>
  95. * Note that Java IDL provides a default implementation for the
  96. * fully-functional ORB and for the Singleton ORB. When the method
  97. * <code>init</code> is given no parameters, the default Singleton
  98. * ORB is returned. When the method <code>init</code> is given parameters
  99. * but no ORB class is specified, the Java IDL ORB implementation
  100. * is returned.
  101. * <P>
  102. * The following code fragment creates an <code>ORB</code> object
  103. * initialized with the default ORB Singleton.
  104. * This ORB has a
  105. * restricted implementation to prevent malicious applets from doing
  106. * anything beyond creating typecodes.
  107. * It is called a singleton
  108. * because there is only one instance for an entire virtual machine.
  109. * <PRE>
  110. * ORB orb = ORB.init();
  111. * </PRE>
  112. * <P>
  113. * The following code fragment creates an <code>ORB</code> object
  114. * for an application. The parameter <code>args</code>
  115. * represents the arguments supplied to the application's <code>main</code>
  116. * method. Since the property specifies the ORB class to be
  117. * "SomeORBImplementation", the new ORB will be initialized with
  118. * that ORB implementation. If p had been null,
  119. * and the arguments had not specified an ORB class,
  120. * the new ORB would have been
  121. * initialized with the default Java IDL implementation.
  122. * <PRE>
  123. * Properties p = new Properties();
  124. * p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation");
  125. * ORB orb = ORB.init(args, p);
  126. * </PRE>
  127. * <P>
  128. * The following code fragment creates an <code>ORB</code> object
  129. * for the applet supplied as the first parameter. If the given
  130. * applet does not specify an ORB class, the new ORB will be
  131. * initialized with the default Java IDL implementation.
  132. * <PRE>
  133. * ORB orb = ORB.init(myApplet, null);
  134. * </PRE>
  135. * <P>
  136. * An application or applet can be initialized in one or more ORBs.
  137. * ORB initialization is a bootstrap call into the CORBA world.
  138. * @version 1.70, 09/09/97
  139. * @since JDK1.2
  140. */
  141. abstract public class ORB {
  142. //
  143. // This is the ORB implementation used when nothing else is specified.
  144. // Whoever provides this class customizes this string to
  145. // point at their ORB implementation.
  146. //
  147. private static final String ORBClassKey = "org.omg.CORBA.ORBClass";
  148. private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
  149. //
  150. // The last resort fallback ORB implementation classes in case
  151. // no ORB implementation class is dynamically configured through
  152. // properties or applet parameters. Change these values to
  153. // vendor-specific class names.
  154. //
  155. private static final String defaultORB = "com.sun.CORBA.iiop.ORB";
  156. private static final String defaultORBSingleton = "com.sun.CORBA.idl.ORBSingleton";
  157. //
  158. // The global instance of the singleton ORB implementation which
  159. // acts as a factory for typecodes for generated Helper classes.
  160. // TypeCodes should be immutable since they may be shared across
  161. // different security contexts (applets). There should be no way to
  162. // use a TypeCode as a storage depot for illicitly passing
  163. // information or Java objects between different security contexts.
  164. //
  165. static private ORB singleton;
  166. private static Class thisClass = ORB.class;
  167. static {
  168. String className;
  169. className = getSystemProperty(ORBSingletonClassKey);
  170. if (className == null)
  171. className = getPropertyFromFile(ORBSingletonClassKey);
  172. if (className == null)
  173. className = defaultORBSingleton;
  174. // For JDK 1.1.x
  175. // singleton = create_impl(className, null);
  176. // For JDK1.2
  177. // Dont use the ContextClassLoader because it would potentially
  178. // allow an untrusted applet to install the shared singleton ORB.
  179. // ClassLoader cl = Thread.currentThread().getContextClassLoader();
  180. ClassLoader cl = ClassLoader.getSystemClassLoader();
  181. singleton = create_impl(className, cl);
  182. }
  183. // Get System property
  184. private static String getSystemProperty(final String name) {
  185. // JDK1.2 only
  186. // This will not throw a SecurityException because this
  187. // class was loaded from rt.jar using the bootstrap classloader.
  188. String propValue = (String) AccessController.doPrivileged(
  189. new PrivilegedAction() {
  190. public java.lang.Object run() {
  191. return System.getProperty(name);
  192. }
  193. }
  194. );
  195. return propValue;
  196. }
  197. // Get property from <java-home>/lib/orb.properties file
  198. private static String getPropertyFromFile(final String name) {
  199. // JDK1.2 only
  200. // This will not throw a SecurityException because this
  201. // class was loaded from rt.jar using the bootstrap classloader.
  202. String propValue = (String) AccessController.doPrivileged(
  203. new PrivilegedAction() {
  204. public java.lang.Object run() {
  205. Properties props = new Properties();
  206. try {
  207. // Check if orb.properties exists
  208. String javaHome = System.getProperty("java.home");
  209. File propFile = new File(javaHome + File.separator
  210. + "lib" + File.separator
  211. + "orb.properties");
  212. if ( !propFile.exists() )
  213. return null;
  214. // Load properties from orb.properties
  215. FileInputStream fis = new FileInputStream(propFile);
  216. props.load(fis);
  217. fis.close();
  218. } catch ( Exception ex ) {
  219. return null;
  220. }
  221. return props.getProperty(name);
  222. }
  223. }
  224. );
  225. return propValue;
  226. }
  227. /**
  228. * Returns the <code>ORB</code> singleton object. This method always returns the
  229. * same ORB instance, which is an instance of the class described by the
  230. * <code>org.omg.CORBA.ORBSingletonClass</code> system property.
  231. * <P>
  232. * This no-argument version of the method <code>init</code> is used primarily
  233. * as a factory for <code>TypeCode</code> objects, which are used by
  234. * <code>Helper</code> classes to implement the method <code>type</code>.
  235. * It is also used to create <code>Any</code> objects that are used to
  236. * describe <code>union</code> labels (as part of creating a <code>
  237. * TypeCode</code> object for a <code>union</code>).
  238. * <P>
  239. * This method is not intended to be used by applets, and in the event
  240. * that it is called in an applet environment, the ORB it returns
  241. * is restricted so that it can be used only as a factory for
  242. * <code>TypeCode</code> objects. Any <code>TypeCode</code> objects
  243. * it produces can be safely shared among untrusted applets.
  244. * <P>
  245. * If an ORB is created using this method from an applet,
  246. * a system exception will be thrown if
  247. * methods other than those for
  248. * creating <code>TypeCode</code> objects are invoked.
  249. *
  250. * @return the singleton ORB
  251. */
  252. public static ORB init() {
  253. return singleton;
  254. }
  255. private static ORB create_impl(String className, ClassLoader cl) {
  256. try {
  257. return (ORB) Class.forName(className).newInstance();
  258. } catch (ClassNotFoundException ex) {
  259. // Eat the exception and try again below...
  260. } catch (Exception ex) {
  261. throw new INITIALIZE(
  262. "can't instantiate default ORB implementation " + className);
  263. }
  264. try {
  265. // For JDK1.1.x
  266. // return (ORB) cl.loadClass(className).newInstance();
  267. return (ORB) Class.forName(className, true, cl).newInstance();
  268. } catch (Exception ex) {
  269. throw new INITIALIZE(
  270. "can't instantiate default ORB implementation " + className);
  271. }
  272. }
  273. /**
  274. * Creates a new <code>ORB</code> instance for a standalone
  275. * application. This method may be called from applications
  276. * only and returns a new fully functional <code>ORB</code> object
  277. * each time it is called.
  278. * @param args command-line arguments for the application's <code>main</code>
  279. * method; may be <code>null</code>
  280. * @param props application-specific properties; may be <code>null</code>
  281. * @return the newly-created ORB instance
  282. */
  283. public static ORB init(String[] args, Properties props) {
  284. //
  285. // Note that there is no standard command-line argument for
  286. // specifying the default ORB implementation. For an
  287. // application you can choose an implementation either by
  288. // setting the CLASSPATH to pick a different org.omg.CORBA
  289. // and it's baked-in ORB implementation default or by
  290. // setting an entry in the properties object or in the
  291. // system properties.
  292. //
  293. String className = null;
  294. ORB orb;
  295. if (props != null)
  296. className = props.getProperty(ORBClassKey);
  297. if (className == null)
  298. className = getSystemProperty(ORBClassKey);
  299. if (className == null)
  300. className = getPropertyFromFile(ORBClassKey);
  301. if (className == null)
  302. className = defaultORB;
  303. // For JDK1.1.x
  304. // ClassLoader cl = null;
  305. // Begin JDK1.2
  306. ClassLoader cl = Thread.currentThread().getContextClassLoader();
  307. if (cl == null)
  308. cl = ClassLoader.getSystemClassLoader();
  309. // End JDK1.2
  310. orb = create_impl(className, cl);
  311. orb.set_parameters(args, props);
  312. return orb;
  313. }
  314. /**
  315. * Creates a new <code>ORB</code> instance for an applet. This
  316. * method may be called from applets only and returns a new
  317. * fully-functional <code>ORB</code> object each time it is called.
  318. * @param app the applet; may be <code>null</code>
  319. * @param props applet-specific properties; may be <code>null</code>
  320. * @return the newly-created ORB instance
  321. */
  322. public static ORB init(Applet app, Properties props) {
  323. String className;
  324. ORB orb;
  325. ClassLoader cl = null;
  326. className = app.getParameter(ORBClassKey);
  327. if (className == null && props != null)
  328. className = props.getProperty(ORBClassKey);
  329. if (className == null)
  330. className = getSystemProperty(ORBClassKey);
  331. if (className == null)
  332. className = getPropertyFromFile(ORBClassKey);
  333. if (className == null)
  334. className = defaultORB;
  335. if (app != null)
  336. cl = app.getClass().getClassLoader();
  337. // Begin JDK1.2
  338. else
  339. cl = Thread.currentThread().getContextClassLoader();
  340. if (cl == null)
  341. cl = ClassLoader.getSystemClassLoader();
  342. // End JDK1.2
  343. orb = create_impl(className, cl);
  344. orb.set_parameters(app, props);
  345. return orb;
  346. }
  347. /**
  348. * Allows the ORB implementation to be initialized with the given
  349. * parameters and properties. This method, used in applications only,
  350. * is implemented by subclass ORB implementations and called
  351. * by the appropriate <code>init</code> method to pass in its parameters.
  352. *
  353. * @param args command-line arguments for the application's <code>main</code>
  354. * method; may be <code>null</code>
  355. * @param props application-specific properties; may be <code>null</code>
  356. */
  357. abstract protected void set_parameters(String[] args, Properties props);
  358. /**
  359. * Allows the ORB implementation to be initialized with the given
  360. * applet and parameters. This method, used in applets only,
  361. * is implemented by subclass ORB implementations and called
  362. * by the appropriate <code>init</code> method to pass in its parameters.
  363. *
  364. * @param app the applet; may be <code>null</code>
  365. * @param props applet-specific properties; may be <code>null</code>
  366. */
  367. abstract protected void set_parameters(Applet app, Properties props);
  368. /**
  369. * Connects the given servant object (a Java object that is
  370. * an instance of the server implementation class)
  371. * to the ORB. The servant class must
  372. * extend the <code>ImplBase</code> class corresponding to the interface that is
  373. * supported by the server. The servant must thus be a CORBA object
  374. * reference, and inherit from <code>org.omg.CORBA.Object</code>.
  375. * Servants created by the user can start receiving remote invocations
  376. * after the method <code>connect</code> has been called. A servant may also be
  377. * automatically and implicitly connected to the ORB if it is passed as
  378. * an IDL parameter in an IDL method invocation on a non-local object,
  379. * that is, if the servant object has to be marshalled and sent outside of the
  380. * process address space.
  381. * <P>
  382. * Calling the method <code>connect</code> has no effect
  383. * when the servant object is already connected to the ORB.
  384. * <P>
  385. * Deprecated by the OMG in favor of the Portable Object Adapter APIs.
  386. *
  387. * @param obj the servant object reference
  388. */
  389. public void connect(org.omg.CORBA.Object obj) {
  390. throw new NO_IMPLEMENT();
  391. }
  392. /**
  393. * Disconnects the given servant object from the ORB. After this method returns,
  394. * the ORB will reject incoming remote requests for the disconnected
  395. * servant and will send the exception
  396. * <code>org.omg.CORBA.OBJECT_NOT_EXIST</code> back to the
  397. * remote client. Thus the object appears to be destroyed from the
  398. * point of view of remote clients. Note, however, that local requests issued
  399. * using the servant directly do not
  400. * pass through the ORB; hence, they will continue to be processed by the
  401. * servant.
  402. * <P>
  403. * Calling the method <code>disconnect</code> has no effect
  404. * if the servant is not connected to the ORB.
  405. * <P>
  406. * Deprecated by the OMG in favor of the Portable Object Adapter APIs.
  407. *
  408. * @param obj The servant object to be disconnected from the ORB
  409. */
  410. public void disconnect(org.omg.CORBA.Object obj) {
  411. throw new NO_IMPLEMENT();
  412. }
  413. //
  414. // ORB method implementations.
  415. //
  416. // We are trying to accomplish 2 things at once in this class.
  417. // It can act as a default ORB implementation front-end,
  418. // creating an actual ORB implementation object which is a
  419. // subclass of this ORB class and then delegating the method
  420. // implementations.
  421. //
  422. // To accomplish the delegation model, the 'delegate' private instance
  423. // variable is set if an instance of this class is created directly.
  424. //
  425. /**
  426. * Returns a list of the initially available CORBA object references,
  427. * such as "NameService" and "InterfaceRepository".
  428. *
  429. * @return an array of <code>String</code> objects that represent
  430. * the object references for CORBA services
  431. * that are initially available with this ORB
  432. */
  433. abstract public String[] list_initial_services();
  434. /**
  435. * Resolves a specific object reference from the set of available
  436. * initial service names.
  437. *
  438. * @param name the name of the initial service as a string
  439. * @return the object reference associated with the given name
  440. * @exception InvalidName if the given name is not associated with a
  441. * known service
  442. */
  443. abstract public org.omg.CORBA.Object resolve_initial_references(String object_name)
  444. throws InvalidName;
  445. /**
  446. * Converts the given CORBA object reference to a string.
  447. * Note that the format of this string is predefined by IIOP, allowing
  448. * strings generated by a different ORB to be converted back into an object
  449. * reference.
  450. * <P>
  451. * The resulting <code>String</code> object may be stored or communicated
  452. * in any way that a <code>String</code> object can be manipulated.
  453. *
  454. * @param obj the object reference to stringify
  455. * @return the string representing the object reference
  456. */
  457. abstract public String object_to_string(org.omg.CORBA.Object obj);
  458. /**
  459. * Converts a string produced by the method <code>object_to_string</code>
  460. * back to a CORBA object reference.
  461. *
  462. * @param str the string to be converted back to an object reference. It must
  463. * be the result of converting an object reference to a string using the
  464. * method <code>object_to_string</code>.
  465. * @return the object reference
  466. */
  467. abstract public org.omg.CORBA.Object string_to_object(String str);
  468. /**
  469. * Allocates an <code>NVList</code> with (probably) enough
  470. * space for the specified number of <code>NamedValue</code> objects.
  471. * Note that the specified size is only a hint to help with
  472. * storage allocation and does not imply the maximum size of the list.
  473. *
  474. * @param count suggested number of <code>NamedValue</code> objects for
  475. * which to allocate space
  476. * @return the newly-created <code>NVList</code>
  477. *
  478. * @see NVList
  479. */
  480. abstract public NVList create_list(int count);
  481. /**
  482. * Creates an <code>NVList</code> initialized with argument
  483. * descriptions for the operation described in the given
  484. * <code>OperationDef</code> object. This <code>OperationDef</code> object
  485. * is obtained from an Interface Repository. The arguments in the
  486. * returned <code>NVList</code> object are in the same order as in the
  487. * original IDL operation definition, which makes it possible for the list
  488. * to be used in dynamic invocation requests.
  489. *
  490. * @param oper the <code>OperationDef</code> object to use to create the list
  491. * @return a newly-created <code>NVList</code> object containing
  492. * descriptions of the arguments to the method described in the given
  493. * <code>OperationDef</code> object
  494. *
  495. * @see NVList
  496. */
  497. public NVList create_operation_list(org.omg.CORBA.Object oper)
  498. {
  499. // If we came here, it means that the actual ORB implementation
  500. // did not have a create_operation_list(...CORBA.Object oper) method,
  501. // so lets check if it has a create_operation_list(OperationDef oper)
  502. // method.
  503. try {
  504. // First try to load the OperationDef class
  505. String opDefClassName = "org.omg.CORBA.OperationDef";
  506. Class opDefClass = null;
  507. // For JDK1.1 do this Class.forName. For JDK1.2 OperationDef
  508. // will never be available from boot classloader so there is
  509. // no need to do this Class.forName.
  510. // opDefClass = Class.forName(opDefClassName);
  511. // For JDK1.2
  512. ClassLoader cl = Thread.currentThread().getContextClassLoader();
  513. if ( cl == null )
  514. cl = ClassLoader.getSystemClassLoader();
  515. // if this throws a ClassNotFoundException, it will be caught below.
  516. opDefClass = Class.forName(opDefClassName, true, cl);
  517. // OK, we loaded OperationDef. Now try to get the
  518. // create_operation_list(OperationDef oper) method.
  519. Class[] argc = { opDefClass };
  520. java.lang.reflect.Method meth =
  521. this.getClass().getMethod("create_operation_list", argc);
  522. // OK, the method exists, so invoke it and be happy.
  523. Object[] argx = { oper };
  524. return (org.omg.CORBA.NVList)meth.invoke(this, argx);
  525. }
  526. catch( java.lang.reflect.InvocationTargetException exs ) {
  527. Throwable t = exs.getTargetException();
  528. if (t instanceof Error) {
  529. throw (Error) t;
  530. }
  531. else if (t instanceof RuntimeException) {
  532. throw (RuntimeException) t;
  533. }
  534. else {
  535. throw new org.omg.CORBA.NO_IMPLEMENT();
  536. }
  537. }
  538. catch( RuntimeException ex ) {
  539. throw ex;
  540. }
  541. catch( Exception exr ) {
  542. throw new org.omg.CORBA.NO_IMPLEMENT();
  543. }
  544. }
  545. /**
  546. * Creates a <code>NamedValue</code> object
  547. * using the given name, value, and argument mode flags.
  548. * <P>
  549. * A <code>NamedValue</code> object serves as (1) a parameter or return
  550. * value or (2) a context property.
  551. * It may be used by itself or
  552. * as an element in an <code>NVList</code> object.
  553. *
  554. * @param s the name of the <code>NamedValue</code> object
  555. * @param any the <code>Any</code> value to be inserted into the
  556. * <code>NamedValue</code> object
  557. * @param flags the argument mode flags for the <code>NamedValue</code>: one of
  558. * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>,
  559. * or <code>ARG_INOUT.value</code>.
  560. *
  561. * @return the newly-created <code>NamedValue</code> object
  562. * @see NamedValue
  563. */
  564. abstract public NamedValue create_named_value(String s, Any any, int flags);
  565. /**
  566. * Creates an empty <code>ExceptionList</code> object.
  567. *
  568. * @return the newly-created <code>ExceptionList</code> object
  569. */
  570. abstract public ExceptionList create_exception_list();
  571. /**
  572. * Creates an empty <code>ContextList</code> object.
  573. *
  574. * @return the newly-created <code>ContextList</code> object
  575. * @see ContextList
  576. * @see Context
  577. */
  578. abstract public ContextList create_context_list();
  579. /**
  580. * Gets the default <code>Context</code> object.
  581. *
  582. * @return the default <code>Context</code> object
  583. * @see Context
  584. */
  585. abstract public Context get_default_context();
  586. /**
  587. * Creates an <code>Environment</code> object.
  588. *
  589. * @return the newly-created <code>Environment</code> object
  590. * @see Environment
  591. */
  592. abstract public Environment create_environment();
  593. /**
  594. * Creates a new <code>org.omg.CORBA.portable.OutputStream</code> into which
  595. * IDL method parameters can be marshalled during method invocation.
  596. * @return the newly-created
  597. * <code>org.omg.CORBA.portable.OutputStream</code> object
  598. */
  599. abstract public org.omg.CORBA.portable.OutputStream create_output_stream();
  600. /**
  601. * Sends multiple dynamic (DII) requests asynchronously without expecting
  602. * any responses. Note that oneway invocations are not guaranteed to
  603. * reach the server.
  604. *
  605. * @param req an array of request objects
  606. */
  607. abstract public void send_multiple_requests_oneway(Request[] req);
  608. /**
  609. * Sends multiple dynamic (DII) requests asynchronously.
  610. *
  611. * @param req an array of <code>Request</code> objects
  612. */
  613. abstract public void send_multiple_requests_deferred(Request[] req);
  614. /**
  615. * Finds out if any of the deferred (asynchronous) invocations have
  616. * a response yet.
  617. * @return <code>true</code> if there is a response available;
  618. * <code> false</code> otherwise
  619. */
  620. abstract public boolean poll_next_response();
  621. /**
  622. * Gets the next <code>Request</code> instance for which a response
  623. * has been received.
  624. *
  625. * @return the next <code>Request</code> object ready with a response
  626. * @exception WrongTransaction if the method <code>get_next_response</code>
  627. * is called from a transaction scope different
  628. * from the one from which the original request was sent. See the
  629. * OMG Transaction Service specification for details.
  630. */
  631. abstract public Request get_next_response() throws WrongTransaction;
  632. /**
  633. * Retrieves the <code>TypeCode</code> object that represents
  634. * the given primitive IDL type.
  635. *
  636. * @param tcKind the <code>TCKind</code> instance corresponding to the
  637. * desired primitive type
  638. * @return the requested <code>TypeCode</code> object
  639. */
  640. abstract public TypeCode get_primitive_tc(TCKind tcKind);
  641. /**
  642. * Creates a <code>TypeCode</code> object representing an IDL <code>struct</code>.
  643. * The <code>TypeCode</code> object is initialized with the given id,
  644. * name, and members.
  645. *
  646. * @param id the repository id for the <code>struct</code>
  647. * @param name the name of the <code>struct</code>
  648. * @param members an array describing the members of the <code>struct</code>
  649. * @return a newly-created <code>TypeCode</code> object describing
  650. * an IDL <code>struct</code>
  651. */
  652. abstract public TypeCode create_struct_tc(String id, String name,
  653. StructMember[] members);
  654. /**
  655. * Creates a <code>TypeCode</code> object representing an IDL <code>union</code>.
  656. * The <code>TypeCode</code> object is initialized with the given id,
  657. * name, discriminator type, and members.
  658. *
  659. * @param id the repository id of the <code>union</code>
  660. * @param name the name of the <code>union</code>
  661. * @param discriminator_type the type of the <code>union</code> discriminator
  662. * @param members an array describing the members of the <code>union</code>
  663. * @return a newly-created <code>TypeCode</code> object describing
  664. * an IDL <code>union</code>
  665. */
  666. abstract public TypeCode create_union_tc(String id, String name,
  667. TypeCode discriminator_type,
  668. UnionMember[] members);
  669. /**
  670. * Creates a <code>TypeCode</code> object representing an IDL <code>enum</code>.
  671. * The <code>TypeCode</code> object is initialized with the given id,
  672. * name, and members.
  673. *
  674. * @param id the repository id for the <code>enum</code>
  675. * @param name the name for the <code>enum</code>
  676. * @param members an array describing the members of the <code>enum</code>
  677. * @return a newly-created <code>TypeCode</code> object describing
  678. * an IDL <code>enum</code>
  679. */
  680. abstract public TypeCode create_enum_tc(String id, String name, String[] members);
  681. /**
  682. * Creates a <code>TypeCode</code> object representing an IDL <code>alias</code>
  683. * (<code>typedef</code>).
  684. * The <code>TypeCode</code> object is initialized with the given id,
  685. * name, and original type.
  686. *
  687. * @param id the repository id for the alias
  688. * @param name the name for the alias
  689. * @param original_type
  690. * the <code>TypeCode</code> object describing the original type
  691. * for which this is an alias
  692. * @return a newly-created <code>TypeCode</code> object describing
  693. * an IDL <code>alias</code>
  694. */
  695. abstract public TypeCode create_alias_tc(String id, String name,
  696. TypeCode original_type);
  697. /**
  698. * Creates a <code>TypeCode</code> object representing an IDL <code>exception</code>.
  699. * The <code>TypeCode</code> object is initialized with the given id,
  700. * name, and members.
  701. *
  702. * @param id the repository id for the <code>exception</code>
  703. * @param name the name for the <code>exception</code>
  704. * @param members an array describing the members of the <code>exception</code>
  705. * @return a newly-created <code>TypeCode</code> object describing
  706. * an IDL <code>exception</code>
  707. */
  708. abstract public TypeCode create_exception_tc(String id, String name,
  709. StructMember[] members);
  710. /**
  711. * Creates a <code>TypeCode</code> object representing an IDL <code>interface</code>.
  712. * The <code>TypeCode</code> object is initialized with the given id
  713. * and name.
  714. *
  715. * @param id the repository id for the interface
  716. * @param name the name for the interface
  717. * @return a newly-created <code>TypeCode</code> object describing
  718. * an IDL <code>interface</code>
  719. */
  720. abstract public TypeCode create_interface_tc(String id, String name);
  721. /**
  722. * Creates a <code>TypeCode</code> object representing a bounded IDL
  723. * <code>string</code>.
  724. * The <code>TypeCode</code> object is initialized with the given bound,
  725. * which represents the maximum length of the string. Zero indicates
  726. * that the string described by this type code is unbounded.
  727. *
  728. * @param bound the bound for the <code>string</code> cannot be zero
  729. * @return a newly-created <code>TypeCode</code> object describing
  730. * a bounded IDL <code>string</code>
  731. * @exception BAD_PARAM if zero is supplied as a parameter
  732. */
  733. abstract public TypeCode create_string_tc(int bound);
  734. /**
  735. * Creates a <code>TypeCode</code> object representing a bounded IDL
  736. * <code>wstring</code> (wide string).
  737. * The <code>TypeCode</code> object is initialized with the given bound,
  738. * which represents the maximum length of the wide string.
  739. *
  740. * @param bound the bound for the <code>wstring</code> cannot be zero
  741. * @return a newly-created <code>TypeCode</code> object describing
  742. * a bounded IDL <code>wstring</code>
  743. * @exception BAD_PARAM if zero is supplied as a parameter
  744. */
  745. abstract public TypeCode create_wstring_tc(int bound);
  746. /**
  747. * Creates a <code>TypeCode</code> object representing an IDL <code>sequence</code>.
  748. * The <code>TypeCode</code> object is initialized with the given bound and
  749. * element type.
  750. *
  751. * @param bound the bound for the <code>sequence</code>
  752. * @param element_type
  753. * the <code>TypeCode</code> object describing the elements
  754. * contained in the <code>sequence</code>
  755. * @return a newly-created <code>TypeCode</code> object describing
  756. * an IDL <code>sequence</code>
  757. */
  758. abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type);
  759. /**
  760. * Creates a <code>TypeCode</code> object representing a
  761. * a recursive IDL <code>sequence</code>.
  762. * <P>
  763. * For the IDL <code>struct</code> Foo in following code fragment,
  764. * the offset parameter for creating its sequence would be 1:
  765. * <PRE>
  766. * Struct Foo {
  767. * long value;
  768. * Sequence <Foo> Chain;
  769. * };
  770. * </PRE>
  771. *
  772. * @param bound the bound for the sequence
  773. * @param offset the index to the enclosing <code>TypeCode</code> object
  774. * that describes the elements of this sequence
  775. * @return a newly-created <code>TypeCode</code> object describing
  776. * a recursive sequence
  777. * @deprecated
  778. */
  779. abstract public TypeCode create_recursive_sequence_tc(int bound, int offset);
  780. /**
  781. * Creates a <code>TypeCode</code> object representing an IDL <code>array</code>.
  782. * The <code>TypeCode</code> object is initialized with the given length and
  783. * element type.
  784. *
  785. * @param length the length of the <code>array</code>
  786. * @param element_type a <code>TypeCode</code> object describing the type
  787. * of element contained in the <code>array</code>
  788. * @return a newly-created <code>TypeCode</code> object describing
  789. * an IDL <code>array</code>
  790. */
  791. abstract public TypeCode create_array_tc(int length, TypeCode element_type);
  792. /**
  793. * Create a <code>TypeCode</code> object for an IDL native type.
  794. *
  795. * @param id the logical id for the native type.
  796. * @param name the name of the native type.
  797. * @return the requested TypeCode.
  798. */
  799. public org.omg.CORBA.TypeCode create_native_tc(String id,
  800. String name)
  801. {
  802. throw new org.omg.CORBA.NO_IMPLEMENT();
  803. }
  804. /**
  805. * Create a <code>TypeCode</code> object for an IDL abstract interface.
  806. *
  807. * @param id the logical id for the abstract interface type.
  808. * @param name the name of the abstract interface type.
  809. * @return the requested TypeCode.
  810. */
  811. public org.omg.CORBA.TypeCode create_abstract_interface_tc(
  812. String id,
  813. String name)
  814. {
  815. throw new org.omg.CORBA.NO_IMPLEMENT();
  816. }
  817. /**
  818. * Create a <code>TypeCode</code> object for an IDL fixed type.
  819. *
  820. * @param digits specifies the total number of decimal digits in the number
  821. * and must be from 1 to 31 inclusive.
  822. * @param scale specifies the position of the decimal point.
  823. * @return the requested TypeCode.
  824. */
  825. public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale)
  826. {
  827. throw new org.omg.CORBA.NO_IMPLEMENT();
  828. }
  829. // orbos 98-01-18: Objects By Value -- begin
  830. /**
  831. * Create a <code>TypeCode</code> object for an IDL value type.
  832. * The concrete_base parameter is the TypeCode for the immediate
  833. * concrete valuetype base of the valuetype for which the TypeCode
  834. * is being created.
  835. * It may be null if the valuetype does not have a concrete base.
  836. *
  837. * @param id the logical id for the value type.
  838. * @param name the name of the value type.
  839. * @param type_modifier one of the value type modifier constants
  840. VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE
  841. * @param concrete_base a <code>TypeCode</code> object
  842. * describing the concrete valuetype base
  843. * @return the requested TypeCode.
  844. */
  845. public org.omg.CORBA.TypeCode create_value_tc(String id,
  846. String name,
  847. short type_modifier,
  848. TypeCode concrete_base,
  849. ValueMember[] members)
  850. {
  851. throw new org.omg.CORBA.NO_IMPLEMENT();
  852. }
  853. /**
  854. * Create a recursive <code>TypeCode</code> object which
  855. * serves as a placeholder for a concrete TypeCode during the process of creating
  856. * TypeCodes which contain recursion. The id parameter specifies the repository id of
  857. * the type for which the recursive TypeCode is serving as a placeholder. Once the
  858. * recursive TypeCode has been properly embedded in the enclosing TypeCode which
  859. * corresponds to the specified repository id, it will function as a normal TypeCode.
  860. * Invoking operations on the recursive TypeCode before it has been embedded in the
  861. * enclosing TypeCode will result in undefined behavior.
  862. * <P>
  863. * For example, the following
  864. * IDL type declarations contain recursion:
  865. * <PRE>
  866. * Struct Foo {
  867. * long value;
  868. * Sequence <Foo> Chain;
  869. * };
  870. * Struct Bar {
  871. * public Bar member;
  872. * };
  873. * </PRE>
  874. * <P>
  875. * To create a TypeCode for struct Bar, you would invoke the TypeCode creation
  876. * operations as shown below:
  877. * <PRE>
  878. * String barID = "IDL:Bar:1.0";
  879. * TypeCode recursiveTC = orb.create_recursive_tc(barID);
  880. * StructMember[] members = { new StructMember("member", recursiveTC, null) };
  881. * TypeCode structBarTC = orb.create_struct_tc(barID, "Bar", members);
  882. * </PRE>
  883. * @param id the logical id of the referenced type.
  884. * @return the requested TypeCode.
  885. */
  886. public org.omg.CORBA.TypeCode create_recursive_tc(String id) {
  887. throw new org.omg.CORBA.NO_IMPLEMENT();
  888. }
  889. /**
  890. * Create a <code>TypeCode</code> object for an IDL value type.
  891. * The concrete_base parameter is the TypeCode for the immediate
  892. * concrete valuetype base of the valuetype for which the TypeCode
  893. * is being created.
  894. * It may be null if the valuetype does not have a concrete base.
  895. *
  896. * @param id the logical id for the value type.
  897. * @param name the name of the value type.
  898. * @return the requested TypeCode.
  899. */
  900. public org.omg.CORBA.TypeCode create_value_box_tc(String id,
  901. String name,
  902. TypeCode boxed_type)
  903. {
  904. throw new org.omg.CORBA.NO_IMPLEMENT();
  905. }
  906. // orbos 98-01-18: Objects By Value -- end
  907. /**
  908. * Creates an IDL <code>Any</code> object initialized to
  909. * contain a <code>Typecode</code> object whose <code>kind</code> field
  910. * is set to <code>TCKind.tc_null</code>.
  911. *
  912. * @return a newly-created <code>Any</code> object
  913. */
  914. abstract public Any create_any();
  915. /**
  916. * Retrieves a <code>Current</code> object.
  917. * The <code>Current</code> interface is used to manage thread-specific
  918. * information for use by services such as transactions and security.
  919. *
  920. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  921. * comments for unimplemented features</a>
  922. *
  923. * @return a newly-created <code>Current</code> object
  924. * @deprecated use resolve_initial_references.
  925. */
  926. public org.omg.CORBA.Current get_current()
  927. {
  928. throw new org.omg.CORBA.NO_IMPLEMENT();
  929. }
  930. /**
  931. * This operation returns when the ORB has shutdown. If called by
  932. * the main thread, it enables the ORB to perform work using the
  933. * main thread. Otherwise it simply waits until the ORB has shutdown.
  934. *
  935. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  936. * comments for unimplemented features</a>
  937. */
  938. public void run()
  939. {
  940. throw new org.omg.CORBA.NO_IMPLEMENT();
  941. }
  942. /**
  943. * Instructs the ORB to shut down, which causes all
  944. * object adapters to shut down. If the <code>wait_for_completion</code>
  945. * parameter
  946. * is true, this operation blocks until all ORB processing (including
  947. * processing of currently executing requests, object deactivation,
  948. * and other object adapter operations) has completed.
  949. * The <code>ORB.run</code> method will return after
  950. * <code>shutdown</code> has been called.
  951. *
  952. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  953. * comments for unimplemented features</a>
  954. */
  955. public void shutdown(boolean wait_for_completion)
  956. {
  957. throw new org.omg.CORBA.NO_IMPLEMENT();
  958. }
  959. /**
  960. * Returns <code>true</code> if the ORB needs the main thread to
  961. * perform some work, and <code>false</code> if the ORB does not
  962. * need the main thread.
  963. *
  964. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  965. * comments for unimplemented features</a>
  966. */
  967. public boolean work_pending()
  968. {
  969. throw new org.omg.CORBA.NO_IMPLEMENT();
  970. }
  971. /**
  972. * Performs an implementation-dependent unit of work if called
  973. * by the main thread. Otherwise it does nothing.
  974. * The methods <code>work_pending</code> and <code>perform_work</code>
  975. * can be used in
  976. * conjunction to implement a simple polling loop that multiplexes
  977. * the main thread among the ORB and other activities.
  978. *
  979. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  980. * comments for unimplemented features</a>
  981. */
  982. public void perform_work()
  983. {
  984. throw new org.omg.CORBA.NO_IMPLEMENT();
  985. }
  986. /**
  987. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  988. * comments for unimplemented features</a>
  989. */
  990. public boolean get_service_information(short service_type,
  991. ServiceInformationHolder service_info)
  992. {
  993. throw new org.omg.CORBA.NO_IMPLEMENT();
  994. }
  995. // orbos 98-01-18: Objects By Value -- begin
  996. /**
  997. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  998. * comments for unimplemented features</a>
  999. */
  1000. public org.omg.CORBA.DynAny create_dyn_any(org.omg.CORBA.Any value)
  1001. {
  1002. throw new org.omg.CORBA.NO_IMPLEMENT();
  1003. }
  1004. /**
  1005. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1006. * comments for unimplemented features</a>
  1007. */
  1008. public org.omg.CORBA.DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1009. {
  1010. throw new org.omg.CORBA.NO_IMPLEMENT();
  1011. }
  1012. /**
  1013. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1014. * comments for unimplemented features</a>
  1015. */
  1016. public org.omg.CORBA.DynStruct create_dyn_struct(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1017. {
  1018. throw new org.omg.CORBA.NO_IMPLEMENT();
  1019. }
  1020. /**
  1021. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1022. * comments for unimplemented features</a>
  1023. */
  1024. public org.omg.CORBA.DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1025. {
  1026. throw new org.omg.CORBA.NO_IMPLEMENT();
  1027. }
  1028. /**
  1029. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1030. * comments for unimplemented features</a>
  1031. */
  1032. public org.omg.CORBA.DynArray create_dyn_array(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1033. {
  1034. throw new org.omg.CORBA.NO_IMPLEMENT();
  1035. }
  1036. /**
  1037. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1038. * comments for unimplemented features</a>
  1039. */
  1040. public org.omg.CORBA.DynUnion create_dyn_union(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1041. {
  1042. throw new org.omg.CORBA.NO_IMPLEMENT();
  1043. }
  1044. /**
  1045. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1046. * comments for unimplemented features</a>
  1047. */
  1048. public org.omg.CORBA.DynEnum create_dyn_enum(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
  1049. {
  1050. throw new org.omg.CORBA.NO_IMPLEMENT();
  1051. }
  1052. /**
  1053. * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
  1054. * comments for unimplemented features</a>
  1055. */
  1056. public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
  1057. throws org.omg.CORBA.PolicyError
  1058. {
  1059. throw new org.omg.CORBA.NO_IMPLEMENT();
  1060. }
  1061. }