org.biojava.bio.seq.distributed
Class DistributedSequenceDB

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.seq.db.AbstractSequenceDB
          extended by org.biojava.bio.seq.distributed.DistributedSequenceDB
All Implemented Interfaces:
SequenceDB, SequenceDBLite, Changeable

public class DistributedSequenceDB
extends AbstractSequenceDB
implements SequenceDB

Sequence database from the meta-DAS system.

Since:
1.2 Once you've made one of these and populated it with a few DistDataSource instances, you should be able to prety much forget about it and use it directly as a normal SequenceDB implementation. DataSources can be added and removed while the object is live.
Author:
Thomas Down, Matthew Pocock

Field Summary
static ChangeType DATASOURCE
           
static ChangeType DATASOURCE_SELECTION
           
 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
 
Constructor Summary
DistributedSequenceDB()
           
 
Method Summary
 void addDataSource(DistDataSource dds)
          Add a distributed data source.
 void addSequence(Sequence seq)
          Adds a sequence to the database.
protected  ChangeSupport getChangeSupport()
           
 Set getDataSources()
          Get the current set of all currently registered data sources.
 String getName()
          Get the name of this sequence database.
 Sequence getSequence(String id)
          Retrieve a single sequence by its id.
protected  boolean hasChangeSupport()
           
 Set ids()
          Get an immutable set of all of the IDs in the database.
 void removeDataSource(DistDataSource dds)
          Remove a distributed data source.
 void removeSequence(String id)
          Remove the sequence associated with an ID from the database.
 
Methods inherited from class org.biojava.bio.seq.db.AbstractSequenceDB
filter, sequenceIterator
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter, sequenceIterator
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Field Detail

DATASOURCE

public static final ChangeType DATASOURCE

DATASOURCE_SELECTION

public static final ChangeType DATASOURCE_SELECTION
Constructor Detail

DistributedSequenceDB

public DistributedSequenceDB()
Method Detail

hasChangeSupport

protected boolean hasChangeSupport()

getChangeSupport

protected ChangeSupport getChangeSupport()

getDataSources

public Set getDataSources()
Get the current set of all currently registered data sources.

The returned Set is totaly independant of any future changes made to the distributed sequence DB.

Returns:
a new Set containing all DistDataSource instances registered at the time

addDataSource

public void addDataSource(DistDataSource dds)
                   throws ChangeVetoException
Add a distributed data source.

Parameters:
dds - the DistDataSource to add
Throws:
ChangeVetoException - if the data source could not be added

removeDataSource

public void removeDataSource(DistDataSource dds)
                      throws ChangeVetoException
Remove a distributed data source.

Parameters:
dds - the DistributedDataSource to remove
Throws:
ChangeVetoException - if the data source could not be removed

getName

public 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
Overrides:
addSequence in class AbstractSequenceDB
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(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
Overrides:
removeSequence in class AbstractSequenceDB
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(String id)
                     throws IllegalIDException,
                            BioException
Description copied from interface: SequenceDBLite
Retrieve a single sequence by its id.

Specified by:
getSequence in interface SequenceDBLite
Parameters:
id - the id to retrieve by
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

ids

public Set ids()
Description copied from interface: SequenceDB
Get an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.

Specified by:
ids in interface SequenceDB
Returns:
a Set of ids - at the moment, strings