package org.dbxml.core.corba.db;

/**
 *	Generated from IDL definition of interface "Collection"
 *	@author JacORB IDL compiler 
 */

public abstract class CollectionPOA
	extends org.omg.PortableServer.Servant
	implements org.omg.CORBA.portable.InvokeHandler, org.dbxml.core.corba.db.CollectionOperations
{
	static private final java.util.Hashtable m_opsHash = new java.util.Hashtable();
	static
	{
		m_opsHash.put ( "getName", new java.lang.Integer(0));
		m_opsHash.put ( "listCollections", new java.lang.Integer(1));
		m_opsHash.put ( "getDocument", new java.lang.Integer(2));
		m_opsHash.put ( "invokeXMLObject", new java.lang.Integer(3));
		m_opsHash.put ( "getCollectionManager", new java.lang.Integer(4));
		m_opsHash.put ( "getCollection", new java.lang.Integer(5));
		m_opsHash.put ( "getDocumentCount", new java.lang.Integer(6));
		m_opsHash.put ( "remove", new java.lang.Integer(7));
		m_opsHash.put ( "listDocuments", new java.lang.Integer(8));
		m_opsHash.put ( "createNewOID", new java.lang.Integer(9));
		m_opsHash.put ( "insertDocument", new java.lang.Integer(10));
		m_opsHash.put ( "getParentCollection", new java.lang.Integer(11));
		m_opsHash.put ( "getCanonicalName", new java.lang.Integer(12));
		m_opsHash.put ( "getDocuments", new java.lang.Integer(13));
		m_opsHash.put ( "queryCollection", new java.lang.Integer(14));
		m_opsHash.put ( "removeDocument", new java.lang.Integer(15));
		m_opsHash.put ( "setDocument", new java.lang.Integer(16));
		m_opsHash.put ( "queryDocument", new java.lang.Integer(17));
	}
	private String[] ids = {"IDL:org/dbxml/core/corba/db/Collection:1.0","IDL:org/dbxml/core/corba/db/ServantManagement:1.0","IDL:omg.org/CORBA/Object:1.0"};
	public org.dbxml.core.corba.db.Collection _this()
	{
		return org.dbxml.core.corba.db.CollectionHelper.narrow(_this_object());
	}
	public org.dbxml.core.corba.db.Collection _this(org.omg.CORBA.ORB orb)
	{
		return org.dbxml.core.corba.db.CollectionHelper.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: // getName
			{
			try
			{
				_out = handler.createReply();
				_out.write_string(getName());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 1: // listCollections
			{
			try
			{
				_out = handler.createReply();
				org.dbxml.core.corba.db.NamesHelper.write(_out,listCollections());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 2: // getDocument
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				long _arg1=_input.read_longlong();
				_out = handler.createReply();
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_out,getDocument(_arg0,_arg1));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 3: // invokeXMLObject
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				_out = handler.createReply();
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_out,invokeXMLObject(_arg0));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 4: // getCollectionManager
			{
			try
			{
				_out = handler.createReply();
				org.dbxml.core.corba.db.CollectionManagerHelper.write(_out,getCollectionManager());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 5: // getCollection
			{
			try
			{
				java.lang.String _arg0=org.dbxml.core.corba.db.NameHelper.read(_input);
				_out = handler.createReply();
				org.dbxml.core.corba.db.CollectionHelper.write(_out,getCollection(_arg0));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 6: // getDocumentCount
			{
			try
			{
				_out = handler.createReply();
				_out.write_long(getDocumentCount());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 7: // remove
			{
				_out = handler.createReply();
				remove();
				break;
			}
			case 8: // listDocuments
			{
			try
			{
				_out = handler.createReply();
				org.dbxml.core.corba.db.NamesHelper.write(_out,listDocuments());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 9: // createNewOID
			{
			try
			{
				_out = handler.createReply();
				_out.write_string(createNewOID());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 10: // insertDocument
			{
			try
			{
				java.lang.String _arg0=org.dbxml.core.corba.db.NameHelper.read(_input);
				org.dbxml.core.corba.db.EncodedBuffer _arg1=org.dbxml.core.corba.db.EncodedBufferHelper.read(_input);
				_out = handler.createReply();
				_out.write_string(insertDocument(_arg0,_arg1));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 11: // getParentCollection
			{
			try
			{
				_out = handler.createReply();
				org.dbxml.core.corba.db.CollectionHelper.write(_out,getParentCollection());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 12: // getCanonicalName
			{
			try
			{
				_out = handler.createReply();
				_out.write_string(getCanonicalName());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 13: // getDocuments
			{
			try
			{
				_out = handler.createReply();
				org.dbxml.core.corba.db.DocumentSetHelper.write(_out,getDocuments());
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 14: // queryCollection
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				java.lang.String _arg1=org.dbxml.core.corba.db.ValueHelper.read(_input);
				org.dbxml.core.corba.db.NamedVal[] _arg2=org.dbxml.core.corba.db.NamedValsHelper.read(_input);
				long _arg3=_input.read_longlong();
				_out = handler.createReply();
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_out,queryCollection(_arg0,_arg1,_arg2,_arg3));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 15: // removeDocument
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				_out = handler.createReply();
				removeDocument(_arg0);
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 16: // setDocument
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				org.dbxml.core.corba.db.EncodedBuffer _arg1=org.dbxml.core.corba.db.EncodedBufferHelper.read(_input);
				_out = handler.createReply();
				setDocument(_arg0,_arg1);
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
			case 17: // queryDocument
			{
			try
			{
				java.lang.String _arg0=_input.read_string();
				java.lang.String _arg1=org.dbxml.core.corba.db.ValueHelper.read(_input);
				org.dbxml.core.corba.db.NamedVal[] _arg2=org.dbxml.core.corba.db.NamedValsHelper.read(_input);
				java.lang.String _arg3=_input.read_string();
				long _arg4=_input.read_longlong();
				_out = handler.createReply();
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_out,queryDocument(_arg0,_arg1,_arg2,_arg3,_arg4));
			}
			catch(org.dbxml.core.corba.db.APIException _ex0)
			{
				_out = handler.createExceptionReply();
				org.dbxml.core.corba.db.APIExceptionHelper.write(_out, _ex0);
			}
				break;
			}
		}
		return _out;
	}

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