org.biojava.utils.candy
Interface CandyFinder

All Superinterfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public interface CandyFinder
extends java.beans.PropertyChangeListener

This interface is a main entry point to a set of controlled vocabularies.

The implementation is supposed to behave as a Java bean (usually an invisible bean unless it implements some additional GUI methods which are not defined in this interface).

Version:
$Id: CandyFinder.java,v 1.2 2002/02/14 16:27:56 mrp Exp $
Author:
Martin Senger

Field Summary
static java.lang.String DEFAULT_FINDER_NAME
          A default name of this (and any) finder.
static java.lang.String PROP_VOCABULARY
           A property name.
 
Method Summary
 void connect()
           It creates a connection to an object representing a vocabulary finder, or/and it makes all necessary initialization steps needed for further communication.
 void disconnect()
          It closes connection with the finder object.
 CandyVocabulary[] getAllVocabularies()
          It returns all available vocabularies.
 java.lang.String[] getAllVocabularyNames()
           It returns names of all vocabularies known to this vocabulary finder.
 java.lang.String getFinderName()
          It returns a name of this vocabulary finder.
 int getNumCount()
          It returns the number of available vocabularies.
 CandyVocabulary getVocabularyByName(java.lang.String name)
          It returns a selected vocabulary.
 boolean isReady()
          It checks if a vocabulary finder object is available.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

DEFAULT_FINDER_NAME

public static final java.lang.String DEFAULT_FINDER_NAME
A default name of this (and any) finder. It is used when no other name was given by the finder implementation.

See Also:
Constant Field Values

PROP_VOCABULARY

public static final java.lang.String PROP_VOCABULARY

A property name.

Its value is of type CandyVocabulary. It this property is set a given vocabulary becomes part of this finder.

See Also:
Constant Field Values
Method Detail

connect

public void connect()
             throws NestedException

It creates a connection to an object representing a vocabulary finder, or/and it makes all necessary initialization steps needed for further communication.

However, there should be no need to call this method explicitly, the other methods should do it automatically before they need to use the finder.

Throws:
NestedException - if the connection/initialization cannot be established

isReady

public boolean isReady()
It checks if a vocabulary finder object is available. The semantic of availabledepends on the implementation.


disconnect

public void disconnect()
It closes connection with the finder object. Implementations may choose to use this method for freeing resources.


getAllVocabularyNames

public java.lang.String[] getAllVocabularyNames()
                                         throws NestedException

It returns names of all vocabularies known to this vocabulary finder. Any of the returned names can be later used in the method getVocabularyByName.

Returns:
a list of available vocabulary names
Throws:
NestedException - if the finder fails to communicate with its vocabularies

getVocabularyByName

public CandyVocabulary getVocabularyByName(java.lang.String name)
                                    throws NestedException
It returns a selected vocabulary.

Parameters:
name - a name of a vocabulary to be returned
Returns:
a selected vocabulary
Throws:
NestedException - when the vocabulary cannot be found (likely the given name is wrong)
See Also:
getAllVocabularyNames()

getAllVocabularies

public CandyVocabulary[] getAllVocabularies()
                                     throws NestedException
It returns all available vocabularies.

Returns:
all available vocabularies
Throws:
NestedException - if the finder fails to communicate with its vocabularies

getNumCount

public int getNumCount()
                throws NestedException
It returns the number of available vocabularies.

Throws:
NestedException - if the finder fails to communicate with its vocabularies

getFinderName

public java.lang.String getFinderName()
                               throws NestedException
It returns a name of this vocabulary finder.

Throws:
NestedException - if the finder fails to return its name