package nsdb;


/**
* nsdb/_NucFeatureStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from corba/nsdb.idl
* Friday, March 2, 2007 1:07:21 PM GMT
*/


/**
       * Nucleotide Sequence Feature interface. Features are <I>owned</I> by a
       * sequence and contain information about that (and maybe other) sequence.
       * The relation between the feature and the sequence is defined by it's
       * location.
       * @see Location
       */
public class _NucFeatureStub extends org.omg.CORBA.portable.ObjectImpl implements nsdb.NucFeature
{


  /**
  	 * Retrieve sequence of qualifiers.
  	 * @raises type::NoResult if no qualifiers are associated with
  	 *    the feature.
  	 */
  public nsdb.NucFeaturePackage.Qualifier[] getQualifiers () throws type.NoResult
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getQualifiers", true);
                $in = _invoke ($out);
                nsdb.NucFeaturePackage.Qualifier $result[] = nsdb.NucFeaturePackage.QualifierListHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:type/NoResult:1.0"))
                    throw type.NoResultHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return getQualifiers (        );
            } finally {
                _releaseReply ($in);
            }
  } // getQualifiers


  /**
  	 * retrieve qualifier of a certain type.
  	 * To find out which qualifier/feature combinations are valid, a client should
  	 * query the NucFeatureMeta server.
  	 * @raises type::NoResult if no qualifier of this type is associated with
  	 *   the feature
  	 * @raises type::InvalidRelation if the requested qualifier cannot be
  	 *   associated to the current feature type
  	 * @see metafeature::NucFeatureMeta
  	 */
  public nsdb.NucFeaturePackage.Qualifier getQualifier (String qualifier_name) throws type.NoResult, type.InvalidRelation
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getQualifier", true);
                $out.write_string (qualifier_name);
                $in = _invoke ($out);
                nsdb.NucFeaturePackage.Qualifier $result = nsdb.NucFeaturePackage.QualifierHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:type/NoResult:1.0"))
                    throw type.NoResultHelper.read ($in);
                else if (_id.equals ("IDL:type/InvalidRelation:1.0"))
                    throw type.InvalidRelationHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return getQualifier (qualifier_name        );
            } finally {
                _releaseReply ($in);
            }
  } // getQualifier


  /**
  	 * If the location of the feature references multiple sequences, get a 
  	 * sequence of all sequences referenced
  	 * This method is equivalent to retrieving the feature location, and looping
  	 *  through all location nodes to find the referenced sequences, converting 
  	 * the accession numbers into DbXref's.
  	 */
  public type.DbXref[] getNucSeqs ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getNucSeqs", true);
                $in = _invoke ($out);
                type.DbXref $result[] = type.DbXrefListHelper.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 getNucSeqs (        );
            } finally {
                _releaseReply ($in);
            }
  } // getNucSeqs


  /**
  	 * retrieve location of feature.
  	 * @raises type::NoResult if no location is associated with the feature.
  	 */
  public nsdb.FeatureLocation getLocation () throws type.NoResult
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getLocation", true);
                $in = _invoke ($out);
                nsdb.FeatureLocation $result = nsdb.FeatureLocationHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                if (_id.equals ("IDL:type/NoResult:1.0"))
                    throw type.NoResultHelper.read ($in);
                else
                    throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return getLocation (        );
            } finally {
                _releaseReply ($in);
            }
  } // getLocation


  /**
  	 * feature identifier.
  	 */
  public String getFeatureId ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getFeatureId", true);
                $in = _invoke ($out);
                String $result = $in.read_string ();
                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 getFeatureId (        );
            } finally {
                _releaseReply ($in);
            }
  } // getFeatureId


  /**
  	 * Feature types are defined by a key.
  	 */
  public String getKey ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getKey", true);
                $in = _invoke ($out);
                String $result = $in.read_string ();
                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 getKey (        );
            } finally {
                _releaseReply ($in);
            }
  } // getKey


  /**
  	 * return current version of the feature. returns 0 if 
  	 * no versioning is implemented.
  	 */
  public int getFeatureVersion ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("getFeatureVersion", true);
                $in = _invoke ($out);
                int $result = $in.read_ulong ();
                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 getFeatureVersion (        );
            } finally {
                _releaseReply ($in);
            }
  } // getFeatureVersion

  // Type-specific CORBA::Object operations
  private static String[] __ids = {
    "IDL:nsdb/NucFeature:1.0", 
    "IDL:seqdb/Feature: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 _NucFeatureStub
