1 /*
   2  * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package org.omg.CORBA;
  26 
  27 
  28 /**
  29 * The Stub for {@code Policy}. For more information on
  30 * Stub files, see <a href="doc-files/generatedfiles.html#stub">
  31 * "Generated Files: Stubs"</a>.<P>
  32 * org/omg/CORBA/_PolicyStub.java
  33 * Generated by the IDL-to-Java compiler (portable), version "3.0"
  34 * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl.
  35 * Saturday, July 17, 1999 12:26:20 AM PDT
  36 */
  37 
  38 public class _PolicyStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Policy
  39 {
  40   /** Constructors
  41    * NOTE:  If the default constructor is used, the
  42    *        object is useless until _set_delegate (...)
  43    *        is called.
  44    */
  45   public _PolicyStub ()
  46   {
  47     super ();
  48   }
  49 
  50   /** Constructs a {@code _PolicyStub} object initialized
  51    * with the given {@code Delegate} object.
  52    *
  53    * @param delegate a Delegate Object
  54    */
  55   public _PolicyStub (org.omg.CORBA.portable.Delegate delegate)
  56   {
  57     super ();
  58     _set_delegate (delegate);
  59   }
  60 
  61 
  62   /** Returns the constant value that corresponds to the
  63                 * type of the policy object.  The values of
  64                 * the polivy objectys are allocated by the OMG.
  65                 * New values for PolicyType should be obtained from the OMG by
  66                 * sending mail to request@omg.org.  In general the constant
  67                 * values that are allocated are defined in conjunction with
  68                 * the definition of the corresponding policy object.
  69                 * @return the constant value that corresponds to the type of
  70                 * the policy object.
  71                 */
  72   public int policy_type ()
  73   {
  74     org.omg.CORBA.portable.InputStream _in = null;
  75     try {
  76        org.omg.CORBA.portable.OutputStream _out = _request ("_get_policy_type", true);
  77        _in = _invoke (_out);
  78        int __result = org.omg.CORBA.PolicyTypeHelper.read (_in);
  79        return __result;
  80     } catch (org.omg.CORBA.portable.ApplicationException _ex) {
  81        _in = _ex.getInputStream ();
  82        String _id = _ex.getId ();
  83        throw new org.omg.CORBA.MARSHAL (_id);
  84     } catch (org.omg.CORBA.portable.RemarshalException _rm) {
  85        return policy_type ();
  86     } finally {
  87         _releaseReply (_in);
  88     }
  89   } // policy_type
  90 
  91 
  92   /** Copies the policy object. The copy does not retain any
  93                 * relationships that the policy had with any domain or object.
  94                 * @return the copy of the policy object.
  95                 */
  96   public org.omg.CORBA.Policy copy ()
  97   {
  98     org.omg.CORBA.portable.InputStream _in = null;
  99     try {
 100        org.omg.CORBA.portable.OutputStream _out = _request ("copy", true);
 101        _in = _invoke (_out);
 102        org.omg.CORBA.Policy __result = org.omg.CORBA.PolicyHelper.read (_in);
 103        return __result;
 104     } catch (org.omg.CORBA.portable.ApplicationException _ex) {
 105        _in = _ex.getInputStream ();
 106        String _id = _ex.getId ();
 107        throw new org.omg.CORBA.MARSHAL (_id);
 108     } catch (org.omg.CORBA.portable.RemarshalException _rm) {
 109        return copy ();
 110     } finally {
 111         _releaseReply (_in);
 112     }
 113   } // copy
 114 
 115 
 116   /** Destroys the policy object.  It is the responsibility of
 117                 * the policy object to determine whether it can be destroyed.
 118                 */
 119   public void destroy ()
 120   {
 121     org.omg.CORBA.portable.InputStream _in = null;
 122     try {
 123        org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true);
 124        _in = _invoke (_out);
 125     } catch (org.omg.CORBA.portable.ApplicationException _ex) {
 126        _in = _ex.getInputStream ();
 127        String _id = _ex.getId ();
 128        throw new org.omg.CORBA.MARSHAL (_id);
 129     } catch (org.omg.CORBA.portable.RemarshalException _rm) {
 130        destroy ();
 131     } finally {
 132         _releaseReply (_in);
 133     }
 134   } // destroy
 135 
 136   // Type-specific CORBA::Object operations
 137   private static String[] __ids = {
 138     "IDL:omg.org/CORBA/Policy:1.0"};
 139 
 140   public String[] _ids ()
 141   {
 142     return (String[])__ids.clone ();
 143   }
 144 
 145   private void readObject (java.io.ObjectInputStream s)
 146   {
 147      try
 148      {
 149        String str = s.readUTF ();
 150        org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str);
 151        org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
 152        _set_delegate (delegate);
 153      } catch (java.io.IOException e) {}
 154   }
 155 
 156   private void writeObject (java.io.ObjectOutputStream s)
 157   {
 158      try
 159      {
 160        String str = org.omg.CORBA.ORB.init ().object_to_string (this);
 161        s.writeUTF (str);
 162      } catch (java.io.IOException e) {}
 163   }
 164 } // class _PolicyStub