package org.dbxml.core.corba.db;

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

public class _CollectionStub
	extends org.omg.CORBA.portable.ObjectImpl
	implements org.dbxml.core.corba.db.Collection
{
	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 String[] _ids()
	{
		return ids;
	}

	public final static java.lang.Class _opsClass = org.dbxml.core.corba.db.CollectionOperations.class;
	public java.lang.String getName() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getName", true);
				_is = _invoke(_os);
				java.lang.String _result = _is.read_string();
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getName", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String _result;			try
			{
			_result = _localServant.getName();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public java.lang.String[] listCollections() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "listCollections", true);
				_is = _invoke(_os);
				java.lang.String[] _result = org.dbxml.core.corba.db.NamesHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "listCollections", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String[] _result;			try
			{
			_result = _localServant.listCollections();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.EncodedBuffer getDocument(java.lang.String id, long stamp) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getDocument", true);
				_os.write_string(id);
				_os.write_longlong(stamp);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.EncodedBuffer _result = org.dbxml.core.corba.db.EncodedBufferHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getDocument", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.EncodedBuffer _result;			try
			{
			_result = _localServant.getDocument(id,stamp);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.EncodedBuffer invokeXMLObject(java.lang.String uri) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "invokeXMLObject", true);
				_os.write_string(uri);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.EncodedBuffer _result = org.dbxml.core.corba.db.EncodedBufferHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "invokeXMLObject", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.EncodedBuffer _result;			try
			{
			_result = _localServant.invokeXMLObject(uri);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.CollectionManager getCollectionManager() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getCollectionManager", true);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.CollectionManager _result = org.dbxml.core.corba.db.CollectionManagerHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getCollectionManager", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.CollectionManager _result;			try
			{
			_result = _localServant.getCollectionManager();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.Collection getCollection(java.lang.String path) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getCollection", true);
				org.dbxml.core.corba.db.NameHelper.write(_os,path);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.Collection _result = org.dbxml.core.corba.db.CollectionHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getCollection", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.Collection _result;			try
			{
			_result = _localServant.getCollection(path);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public int getDocumentCount() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getDocumentCount", true);
				_is = _invoke(_os);
				int _result = _is.read_long();
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getDocumentCount", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			int _result;			try
			{
			_result = _localServant.getDocumentCount();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public void remove()
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "remove", true);
				_is = _invoke(_os);
				return;
			}
			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( "remove", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			try
			{
			_localServant.remove();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return;
		}

		}

	}

	public java.lang.String[] listDocuments() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "listDocuments", true);
				_is = _invoke(_os);
				java.lang.String[] _result = org.dbxml.core.corba.db.NamesHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "listDocuments", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String[] _result;			try
			{
			_result = _localServant.listDocuments();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public java.lang.String createNewOID() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "createNewOID", true);
				_is = _invoke(_os);
				java.lang.String _result = _is.read_string();
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "createNewOID", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String _result;			try
			{
			_result = _localServant.createNewOID();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public java.lang.String insertDocument(java.lang.String nam, org.dbxml.core.corba.db.EncodedBuffer doc) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "insertDocument", true);
				org.dbxml.core.corba.db.NameHelper.write(_os,nam);
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_os,doc);
				_is = _invoke(_os);
				java.lang.String _result = _is.read_string();
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "insertDocument", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String _result;			try
			{
			_result = _localServant.insertDocument(nam,doc);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.Collection getParentCollection() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getParentCollection", true);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.Collection _result = org.dbxml.core.corba.db.CollectionHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getParentCollection", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.Collection _result;			try
			{
			_result = _localServant.getParentCollection();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public java.lang.String getCanonicalName() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getCanonicalName", true);
				_is = _invoke(_os);
				java.lang.String _result = _is.read_string();
				return _result;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getCanonicalName", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			java.lang.String _result;			try
			{
			_result = _localServant.getCanonicalName();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.DocumentSet getDocuments() throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getDocuments", true);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.DocumentSet _result = org.dbxml.core.corba.db.DocumentSetHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getDocuments", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.DocumentSet _result;			try
			{
			_result = _localServant.getDocuments();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public org.dbxml.core.corba.db.EncodedBuffer queryCollection(java.lang.String style, java.lang.String query, org.dbxml.core.corba.db.NamedVal[] namespaces, long stamp) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "queryCollection", true);
				_os.write_string(style);
				org.dbxml.core.corba.db.ValueHelper.write(_os,query);
				org.dbxml.core.corba.db.NamedValsHelper.write(_os,namespaces);
				_os.write_longlong(stamp);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.EncodedBuffer _result = org.dbxml.core.corba.db.EncodedBufferHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "queryCollection", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.EncodedBuffer _result;			try
			{
			_result = _localServant.queryCollection(style,query,namespaces,stamp);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

	public void removeDocument(java.lang.String id) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "removeDocument", true);
				_os.write_string(id);
				_is = _invoke(_os);
				return;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "removeDocument", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			try
			{
			_localServant.removeDocument(id);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return;
		}

		}

	}

	public void setDocument(java.lang.String id, org.dbxml.core.corba.db.EncodedBuffer doc) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "setDocument", true);
				_os.write_string(id);
				org.dbxml.core.corba.db.EncodedBufferHelper.write(_os,doc);
				_is = _invoke(_os);
				return;
			}
			catch( org.omg.CORBA.portable.RemarshalException _rx ){}
			catch( org.omg.CORBA.portable.ApplicationException _ax )
			{
				String _id = _ax.getId();
				if( _id.equals("IDL:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "setDocument", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			try
			{
			_localServant.setDocument(id,doc);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return;
		}

		}

	}

	public org.dbxml.core.corba.db.EncodedBuffer queryDocument(java.lang.String style, java.lang.String query, org.dbxml.core.corba.db.NamedVal[] namespaces, java.lang.String id, long stamp) throws org.dbxml.core.corba.db.APIException
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "queryDocument", true);
				_os.write_string(style);
				org.dbxml.core.corba.db.ValueHelper.write(_os,query);
				org.dbxml.core.corba.db.NamedValsHelper.write(_os,namespaces);
				_os.write_string(id);
				_os.write_longlong(stamp);
				_is = _invoke(_os);
				org.dbxml.core.corba.db.EncodedBuffer _result = org.dbxml.core.corba.db.EncodedBufferHelper.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:org/dbxml/core/corba/db/APIException:1.0"))
				{
					throw org.dbxml.core.corba.db.APIExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "queryDocument", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			CollectionOperations _localServant = (CollectionOperations)_so.servant;
			org.dbxml.core.corba.db.EncodedBuffer _result;			try
			{
			_result = _localServant.queryDocument(style,query,namespaces,id,stamp);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

}
