package nsdb;

public class _EmblWriterStub
	extends org.omg.CORBA.portable.ObjectImpl
	implements nsdb.EmblWriter
{
	private String[] ids = {"IDL:nsdb/EmblWriter:1.0","IDL:nsdb/Embl:1.0"};
	public String[] _ids()
	{
		return ids;
	}

	public final static java.lang.Class _opsClass = nsdb.EmblWriterOperations.class;
	public nsdb.ServerInfo getServerInfo()
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getServerInfo", true);
				_is = _invoke(_os);
				nsdb.ServerInfo _result = nsdb.ServerInfoHelper.read(_is);
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getServerInfo", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			EmblWriterOperations _localServant = (EmblWriterOperations)_so.servant;
			nsdb.ServerInfo _result;			try
			{
			_result = _localServant.getServerInfo();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public nsdb.EmblSeq getEmblSeq(java.lang.String bio_seq_id) throws type.NoResult,nsdb.EmblPackage.Superceded
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getEmblSeq", true);
				_os.write_string(bio_seq_id);
				_is = _invoke(_os);
				nsdb.EmblSeq _result = nsdb.EmblSeqHelper.read(_is);
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:type/NoResult:1.0"))
				{
					throw type.NoResultHelper.read(_ax.getInputStream());
				}
				else if( _id.equals("IDL:nsdb/Embl/Superceded:1.0"))
				{
					throw nsdb.EmblPackage.SupercededHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getEmblSeq", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			EmblWriterOperations _localServant = (EmblWriterOperations)_so.servant;
			nsdb.EmblSeq _result;			try
			{
			_result = _localServant.getEmblSeq(bio_seq_id);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public nsdb.EmblSeqWriter getEmblSeqWriter(java.lang.String sequence_id) throws type.NoResult
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getEmblSeqWriter", true);
				_os.write_string(sequence_id);
				_is = _invoke(_os);
				nsdb.EmblSeqWriter _result = nsdb.EmblSeqWriterHelper.read(_is);
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:type/NoResult:1.0"))
				{
					throw type.NoResultHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getEmblSeqWriter", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			EmblWriterOperations _localServant = (EmblWriterOperations)_so.servant;
			nsdb.EmblSeqWriter _result;			try
			{
			_result = _localServant.getEmblSeqWriter(sequence_id);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

}
