1. /*
  2. * @(#)_PolicyStub.java 1.5 00/02/02
  3. *
  4. * Copyright 1999, 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. /**
  12. * org/omg/CORBA/_PolicyStub.java
  13. * Generated by the IDL-to-Java compiler (portable), version "3.0"
  14. * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl.
  15. * Saturday, July 17, 1999 12:26:20 AM PDT
  16. */
  17. public class _PolicyStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Policy
  18. {
  19. /** Constructors
  20. * NOTE: If the default constructor is used, the
  21. * object is useless until _set_delegate (...)
  22. * is called.
  23. */
  24. public _PolicyStub ()
  25. {
  26. super ();
  27. }
  28. /** Constructs a <code>_PolicyStub</code> object initialized
  29. * with the given <code>Delegate</code> object.
  30. *
  31. * @param delegate a Delegate Object
  32. */
  33. public _PolicyStub (org.omg.CORBA.portable.Delegate delegate)
  34. {
  35. super ();
  36. _set_delegate (delegate);
  37. }
  38. /** Returns the constant value that corresponds to the
  39. * type of the policy object. The values of
  40. * the polivy objectys are allocated by the OMG.
  41. * New values for PolicyType should be obtained from the OMG by
  42. * sending mail to request@omg.org. In general the constant
  43. * values that are allocated are defined in conjunction with
  44. * the definition of the corresponding policy object.
  45. * @return the constant value that corresponds to the type of
  46. * the policy object.
  47. */
  48. public int policy_type ()
  49. {
  50. org.omg.CORBA.portable.InputStream _in = null;
  51. try {
  52. org.omg.CORBA.portable.OutputStream _out = _request ("_get_policy_type", true);
  53. _in = _invoke (_out);
  54. int __result = org.omg.CORBA.PolicyTypeHelper.read (_in);
  55. return __result;
  56. } catch (org.omg.CORBA.portable.ApplicationException _ex) {
  57. _in = _ex.getInputStream ();
  58. String _id = _ex.getId ();
  59. throw new org.omg.CORBA.MARSHAL (_id);
  60. } catch (org.omg.CORBA.portable.RemarshalException _rm) {
  61. return policy_type ();
  62. } finally {
  63. _releaseReply (_in);
  64. }
  65. } // policy_type
  66. /** Copies the policy object. The copy does not retain any
  67. * relationships that the policy had with any domain or object.
  68. * @return the copy of the policy object.
  69. */
  70. public org.omg.CORBA.Policy copy ()
  71. {
  72. org.omg.CORBA.portable.InputStream _in = null;
  73. try {
  74. org.omg.CORBA.portable.OutputStream _out = _request ("copy", true);
  75. _in = _invoke (_out);
  76. org.omg.CORBA.Policy __result = org.omg.CORBA.PolicyHelper.read (_in);
  77. return __result;
  78. } catch (org.omg.CORBA.portable.ApplicationException _ex) {
  79. _in = _ex.getInputStream ();
  80. String _id = _ex.getId ();
  81. throw new org.omg.CORBA.MARSHAL (_id);
  82. } catch (org.omg.CORBA.portable.RemarshalException _rm) {
  83. return copy ();
  84. } finally {
  85. _releaseReply (_in);
  86. }
  87. } // copy
  88. /** Destroys the policy object. It is the responsibility of
  89. * the policy object to determine whether it can be destroyed.
  90. */
  91. public void destroy ()
  92. {
  93. org.omg.CORBA.portable.InputStream _in = null;
  94. try {
  95. org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true);
  96. _in = _invoke (_out);
  97. } catch (org.omg.CORBA.portable.ApplicationException _ex) {
  98. _in = _ex.getInputStream ();
  99. String _id = _ex.getId ();
  100. throw new org.omg.CORBA.MARSHAL (_id);
  101. } catch (org.omg.CORBA.portable.RemarshalException _rm) {
  102. destroy ();
  103. } finally {
  104. _releaseReply (_in);
  105. }
  106. } // destroy
  107. // Type-specific CORBA::Object operations
  108. private static String[] __ids = {
  109. "IDL:omg.org/CORBA/Policy:1.0"};
  110. public String[] _ids ()
  111. {
  112. return (String[])__ids.clone ();
  113. }
  114. private void readObject (java.io.ObjectInputStream s)
  115. {
  116. try
  117. {
  118. String str = s.readUTF ();
  119. org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str);
  120. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
  121. _set_delegate (delegate);
  122. } catch (java.io.IOException e) {}
  123. }
  124. private void writeObject (java.io.ObjectOutputStream s)
  125. {
  126. try
  127. {
  128. String str = org.omg.CORBA.ORB.init ().object_to_string (this);
  129. s.writeUTF (str);
  130. } catch (java.io.IOException e) {}
  131. }
  132. } // class _PolicyStub