package org.omg.CosTransactions;

import org.omg.CORBA.portable.ObjectImpl;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.ServantObject;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.RemarshalException;
import org.omg.CORBA.UNKNOWN;

/**
 * org.omg.CosTransactions.RecoveryCoordinator Client Stub generated by the Idl2Java Compiler 3.1 of Jonathan
 */



public class _RecoveryCoordinatorStub extends ObjectImpl implements RecoveryCoordinator {
	private static String[] _ids = { org.omg.CosTransactions.RecoveryCoordinatorHelper.id()};
	public _RecoveryCoordinatorStub() {}
	public org.omg.CosTransactions.Status replay_completion(org.omg.CosTransactions.Resource r) throws org.omg.CosTransactions.NotPrepared	{
		Delegate _d = _get_delegate();
		if (_d.is_local(this)) {
			ServantObject _servant = _d.servant_preinvoke(this,"replay_completion",RecoveryCoordinatorOperations.class);
			if (_servant != null) {
				try {
					return ((RecoveryCoordinatorOperations) _servant.servant).replay_completion(r);
				} finally {
					_d.servant_postinvoke(this,_servant);
				}
			}
		}
		OutputStream _ostream = _d.request(this,"replay_completion",true);
		// argument .... marshalling
		_ostream.write_Object(r);
		//reply
		try {
			InputStream _istream = _d.invoke(this,_ostream);
			org.omg.CosTransactions.Status _ret;
			_ret =  org.omg.CosTransactions.StatusHelper.read(_istream);
			_d.releaseReply(this,_istream);
			return _ret;
		} catch (ApplicationException _e) {
			InputStream _istream = _e.getInputStream();
			String _id = _istream.read_string();
			if (_id.equals("IDL:omg.org/CosTransactions/NotPrepared:1.0")) {
				org.omg.CosTransactions.NotPrepared _user_excep;
				_user_excep =  org.omg.CosTransactions.NotPreparedHelper.read(_istream);
				_d.releaseReply(this,_istream);
				throw _user_excep;
			}
			_d.releaseReply(this,_istream);
			throw new org.omg.CORBA.UNKNOWN("Unknown exception identifier");
		} catch (RemarshalException _e) {
			return replay_completion(r);
		}
	
}

	public String[] _ids() {
		return _ids;
	}
}
