package Ensembl.artemis;

/** stream-based skeleton class */

public abstract class DBPOA
	extends org.omg.PortableServer.Servant
	implements org.omg.CORBA.portable.InvokeHandler, Ensembl.artemis.DBOperations
{
	static private final java.util.Hashtable m_opsHash = new java.util.Hashtable();
	static
	{
		m_opsHash.put ( "getFeatureDefinitionList", new java.lang.Integer(0));
		m_opsHash.put ( "getallEntryNames", new java.lang.Integer(1));
		m_opsHash.put ( "getEntry", new java.lang.Integer(2));
	}
	private String[] ids = {"IDL:Ensembl/artemis/DB:1.0"};
	public Ensembl.artemis.DB _this()
	{
		return Ensembl.artemis.DBHelper.narrow(_this_object());
	}
	public Ensembl.artemis.DB _this(org.omg.CORBA.ORB orb)
	{
		return Ensembl.artemis.DBHelper.narrow(_this_object(orb));
	}
	public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler)
		throws org.omg.CORBA.SystemException
	{
		org.omg.CORBA.portable.OutputStream _out = null;
		// do something
		// quick lookup of operation
		java.lang.Integer opsIndex = (java.lang.Integer)m_opsHash.get ( method );
		if ( null == opsIndex )
			throw new org.omg.CORBA.BAD_OPERATION(method + " not found");
		switch ( opsIndex.intValue() )
		{
			case 0: // getFeatureDefinitionList
			{
				_out = handler.createReply();
				Ensembl.artemis.FeatureDefinitionListHelper.write(_out,getFeatureDefinitionList());
				break;
			}
			case 1: // getallEntryNames
			{
				_out = handler.createReply();
				Ensembl.artemis.EntryNameListHelper.write(_out,getallEntryNames());
				break;
			}
			case 2: // getEntry
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				_out = handler.createReply();
				Ensembl.artemis.EntryHelper.write(_out,getEntry(_arg0));
			}
			catch(Ensembl.artemis.NoEntry _ex0)
			{
				_out = handler.createExceptionReply();
				Ensembl.artemis.NoEntryHelper.write(_out, _ex0);
			}
				break;
			}
		}
		return _out;
	}

	public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] obj_id)
	{
		return ids;
	}
}
