package FoamXServer.HostBrowser;


/**
* FoamXServer/HostBrowser/_IHostBrowserStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from FoamX.idl
* 22 June 2005 14:41:58 o'clock BST
*/


// ---------------------------------------------------------------------
public class _IHostBrowserStub extends org.omg.CORBA.portable.ObjectImpl implements FoamXServer.HostBrowser.IHostBrowser
{

  public FoamXServer.HostDescriptor[] hosts ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_hosts", true);
                $in = _invoke ($out);
                FoamXServer.HostDescriptor $result[] = FoamXServer.HostDescriptorListHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return hosts (        );
            } finally {
                _releaseReply ($in);
            }
  } // hosts

  public void refreshHostList () throws FoamXServer.FoamXError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("refreshHostList", true);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                refreshHostList (        );
            } finally {
                _releaseReply ($in);
            }
  } // refreshHostList

  public boolean isHostAlive (String hostName) throws FoamXServer.FoamXError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("isHostAlive", true);
                $out.write_string (hostName);
                $in = _invoke ($out);
                boolean $result = $in.read_boolean ();
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return isHostAlive (hostName        );
            } finally {
                _releaseReply ($in);
            }
  } // isHostAlive

  public void hostIsAlive (String hostName) throws FoamXServer.FoamXError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("hostIsAlive", true);
                $out.write_string (hostName);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                hostIsAlive (hostName        );
            } finally {
                _releaseReply ($in);
            }
  } // hostIsAlive

  public void hostIsDead (String hostName) throws FoamXServer.FoamXError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("hostIsDead", true);
                $out.write_string (hostName);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                hostIsDead (hostName        );
            } finally {
                _releaseReply ($in);
            }
  } // hostIsDead

  public void openCaseBrowser (String hostName) throws FoamXServer.FoamXError, FoamXServer.FoamXSYSError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("openCaseBrowser", true);
                $out.write_string (hostName);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/FoamXSYSError:1.0"))
                    throw FoamXServer.FoamXSYSErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                openCaseBrowser (hostName        );
            } finally {
                _releaseReply ($in);
            }
  } // openCaseBrowser

  public boolean getCaseBrowserReference (String hostName, FoamXServer.CaseBrowser.ICaseBrowserHolder browserObj) throws FoamXServer.FoamXError, FoamXServer.FoamXSYSError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getCaseBrowserReference", true);
                $out.write_string (hostName);
                $in = _invoke ($out);
                boolean $result = $in.read_boolean ();
                browserObj.value = FoamXServer.CaseBrowser.ICaseBrowserHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/FoamXSYSError:1.0"))
                    throw FoamXServer.FoamXSYSErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return getCaseBrowserReference (hostName, browserObj        );
            } finally {
                _releaseReply ($in);
            }
  } // getCaseBrowserReference


  // Validation.
  public void validate () throws FoamXServer.FoamXError, FoamXServer.FoamXIOError, FoamXServer.ValidationError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("validate", true);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/FoamXIOError:1.0"))
                    throw FoamXServer.FoamXIOErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/ValidationError:1.0"))
                    throw FoamXServer.ValidationErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                validate (        );
            } finally {
                _releaseReply ($in);
            }
  } // validate


  // Persistence.
  public void save () throws FoamXServer.FoamXError, FoamXServer.FoamXIOError, FoamXServer.ValidationError
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("save", true);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:FoamXServer/FoamXError:1.0"))
                    throw FoamXServer.FoamXErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/FoamXIOError:1.0"))
                    throw FoamXServer.FoamXIOErrorHelper.read ($in);
                else if (_id.equals ("IDL:FoamXServer/ValidationError:1.0"))
                    throw FoamXServer.ValidationErrorHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                save (        );
            } finally {
                _releaseReply ($in);
            }
  } // save


  // Lifetime management.
  public void close ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("close", false);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                close (        );
            } finally {
                _releaseReply ($in);
            }
  } // close

  // Type-specific CORBA::Object operations
  private static String[] __ids = {
    "IDL:FoamXServer/HostBrowser/IHostBrowser:1.0"};

  public String[] _ids ()
  {
    return (String[])__ids.clone ();
  }

  private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
  {
     String str = s.readUTF ();
     String[] args = null;
     java.util.Properties props = null;
     org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
     org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
     _set_delegate (delegate);
  }

  private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
  {
     String[] args = null;
     java.util.Properties props = null;
     String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
     s.writeUTF (str);
  }
} // class _IHostBrowserStub
