package Ensembl.artemis;

public class _DBStub
	extends org.omg.CORBA.portable.ObjectImpl
	implements Ensembl.artemis.DB
{
	private String[] ids = {"IDL:Ensembl/artemis/DB:1.0"};
	public String[] _ids()
	{
		return ids;
	}

	public final static java.lang.Class _opsClass = Ensembl.artemis.DBOperations.class;
	public Ensembl.artemis.FeatureDefinition[] getFeatureDefinitionList()
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getFeatureDefinitionList", true);
				_is = _invoke(_os);
				Ensembl.artemis.FeatureDefinition[] _result = Ensembl.artemis.FeatureDefinitionListHelper.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( "getFeatureDefinitionList", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			DBOperations _localServant = (DBOperations)_so.servant;
			Ensembl.artemis.FeatureDefinition[] _result;			try
			{
			_result = _localServant.getFeatureDefinitionList();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public java.lang.String[] getallEntryNames()
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getallEntryNames", true);
				_is = _invoke(_os);
				java.lang.String[] _result = Ensembl.artemis.EntryNameListHelper.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( "getallEntryNames", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			DBOperations _localServant = (DBOperations)_so.servant;
			java.lang.String[] _result;			try
			{
			_result = _localServant.getallEntryNames();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public Ensembl.artemis.Entry getEntry(java.lang.String entryname) throws Ensembl.artemis.NoEntry
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getEntry", true);
				_os.write_string(entryname);
				_is = _invoke(_os);
				Ensembl.artemis.Entry _result = Ensembl.artemis.EntryHelper.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:Ensembl/artemis/NoEntry:1.0"))
				{
					throw Ensembl.artemis.NoEntryHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getEntry", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			DBOperations _localServant = (DBOperations)_so.servant;
			Ensembl.artemis.Entry _result;			try
			{
			_result = _localServant.getEntry(entryname);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

}
