package primativeAnyTest;

/**
 * <ul>
 * <li> <b>IDL Source</b>    "primativeAnyTest.idl"
 * <li> <b>IDL Name</b>      ::primativeAnyTest::pat
 * <li> <b>Repository Id</b> IDL:primativeAnyTest/pat:1.0
 * </ul>
 * <b>IDL definition:</b>
 * <pre>
 * interface pat {
  ...
};
 * </pre>
 */
public class _patStub extends com.inprise.vbroker.CORBA.portable.ObjectImpl implements primativeAnyTest.pat {
  final public static java.lang.Class _opsClass = primativeAnyTest.patOperations.class;

  public java.lang.String[] _ids () {
    return __ids;
  }

  private static java.lang.String[] __ids = {
    "IDL:primativeAnyTest/pat:1.0"
  };

  /**
   * <pre>
   *   long testPrimativeAny (in any inPrimativeAny, inout any inoutPrimativeAny,
                         out any outPrimativeAny);
   * </pre>
   */
  public int testPrimativeAny (org.omg.CORBA.Any inPrimativeAny, 
                               org.omg.CORBA.AnyHolder inoutPrimativeAny, 
                               org.omg.CORBA.AnyHolder outPrimativeAny) {

    while (true) {
      if (!_is_local()) {
        org.omg.CORBA.portable.OutputStream _output = null;
        org.omg.CORBA.portable.InputStream  _input  = null;
        int _result;
        try {
          _output = this._request("testPrimativeAny", true);
          _output.write_any((org.omg.CORBA.Any)inPrimativeAny);
          _output.write_any((org.omg.CORBA.Any)inoutPrimativeAny.value);
          _input = this._invoke(_output);
          _result = _input.read_long();
          inoutPrimativeAny.value = _input.read_any();
          outPrimativeAny.value = _input.read_any();
          return _result;
        }
        catch (org.omg.CORBA.portable.ApplicationException _exception) {
          final org.omg.CORBA.portable.InputStream in = _exception.getInputStream();
          java.lang.String _exception_id = _exception.getId();
          throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _exception_id);
        }
        catch (org.omg.CORBA.portable.RemarshalException _exception) {
          continue;
        }
        finally {
          this._releaseReply(_input);
        }
      } else {
        final org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("testPrimativeAny", _opsClass);
        if (_so == null) {
          continue;
        }
        final primativeAnyTest.patOperations _self = (primativeAnyTest.patOperations)_so.servant;
        try {
          return _self.testPrimativeAny(inPrimativeAny, inoutPrimativeAny, outPrimativeAny);
        }
        finally {
          _servant_postinvoke(_so);
        }
      }
    }
  }

}
