package DB;

/**
 * Generated by the JacORB IDL compiler.
 */
public class _ManagerStub
	extends org.omg.CORBA.portable.ObjectImpl
	implements DB.Manager
{
	private String[] ids = {"IDL:DB/Manager:1.0","IDL:omg.org/CORBA/Object:1.0"};
	public String[] _ids()
	{
		return ids;
	}

	public final static java.lang.Class _opsClass = DB.ManagerOperations.class;
	public void shutdownServer()
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "shutdownServer", false);
				_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( "shutdownServer", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			ManagerOperations _localServant = (ManagerOperations)_so.servant;
			try
			{
			_localServant.shutdownServer();
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return;
		}

		}

	}

	public DB.Connection getConnection(java.lang.String url, java.lang.String user, java.lang.String password, DB.WarningsHolder warns) throws DB.Exception
	{
		while(true)
		{
		if(! this._is_local())
		{
			org.omg.CORBA.portable.InputStream _is = null;
			try
			{
				org.omg.CORBA.portable.OutputStream _os = _request( "getConnection", true);
				_os.write_string(url);
				_os.write_string(user);
				_os.write_string(password);
				_is = _invoke(_os);
				DB.Connection _result = DB.ConnectionHelper.read(_is);
				warns._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:DB/Exception:1.0"))
				{
					throw DB.ExceptionHelper.read(_ax.getInputStream());
				}
				else 
					throw new RuntimeException("Unexpected exception " + _id );
			}
			finally
			{
				this._releaseReply(_is);
			}
		}
		else
		{
			org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke( "getConnection", _opsClass );
			if( _so == null )
				throw new org.omg.CORBA.UNKNOWN("local invocations not supported!");
			ManagerOperations _localServant = (ManagerOperations)_so.servant;
			DB.Connection _result;			try
			{
			_result = _localServant.getConnection(url,user,password,warns);
			}
			finally
			{
				_servant_postinvoke(_so);
			}
			return _result;
		}

		}

	}

}
