org.biojava.bio.seq.db.biofetch
Class BioFetchSequenceDB

java.lang.Object
  extended byorg.biojava.utils.Unchangeable
      extended byorg.biojava.bio.seq.db.biofetch.BioFetchSequenceDB
All Implemented Interfaces:
Changeable, SequenceDBLite

public class BioFetchSequenceDB
extends Unchangeable
implements SequenceDBLite

Simple SequenceDB implementation backed by a BioFetch (HTTP) server.

Since:
1.3
Author:
Thomas Down, Matthew Pocock, Greg Cox, Keith James

Field Summary
 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
 
Constructor Summary
BioFetchSequenceDB(java.lang.String location, java.lang.String dbName)
          Construct a BioFetchSequenceDB which connects to the specified BioFetch server.
 
Method Summary
 void addSequence(Sequence seq)
          Adds a sequence to the database.
 java.lang.String getName()
          Get the name of this sequence database.
 Sequence getSequence(java.lang.String id)
          Retrieve a single sequence by its id.
 void removeSequence(java.lang.String id)
          Remove the sequence associated with an ID from the database.
 
Methods inherited from class org.biojava.utils.Unchangeable
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

BioFetchSequenceDB

public BioFetchSequenceDB(java.lang.String location,
                          java.lang.String dbName)
Construct a BioFetchSequenceDB which connects to the specified BioFetch server.

Parameters:
location - The base URL of the server.
dbName - The database name to use.
Method Detail

getName

public java.lang.String getName()
Description copied from interface: SequenceDBLite
Get the name of this sequence database.

Specified by:
getName in interface SequenceDBLite
Returns:
the name of the sequence database, which may be null.

addSequence

public void addSequence(Sequence seq)
                 throws ChangeVetoException
Description copied from interface: SequenceDBLite
Adds a sequence to the database.

Specified by:
addSequence in interface SequenceDBLite
Parameters:
seq - the Sequence to add
Throws:
ChangeVetoException - if either the database does not allow sequences to be added or the modification was vetoed

removeSequence

public void removeSequence(java.lang.String id)
                    throws ChangeVetoException
Description copied from interface: SequenceDBLite
Remove the sequence associated with an ID from the database.

Specified by:
removeSequence in interface SequenceDBLite
Parameters:
id - the ID of the sequence to remove
Throws:
ChangeVetoException - if either the database does not allow sequences to be removed or the modification was vetoed

getSequence

public Sequence getSequence(java.lang.String id)
                     throws BioException,
                            IllegalIDException
Description copied from interface: SequenceDBLite
Retrieve a single sequence by its id.

Specified by:
getSequence in interface SequenceDBLite
Returns:
the Sequence with that id
Throws:
IllegalIDException - if the database doesn't know about the id
BioException - if there was a failure in retrieving the sequence