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