cdox.data
Interface DataSource

All Known Implementing Classes:
FileSource, VideoFileSource

public interface DataSource

This interface is meant to provide easy access to a database, a specific file format or any other data source that provides information about a CD.

The CDox program will use this classes typically the following way: it gets the various description strings for all classes/plugins and displays them to the user (in the case that he wants to fill in the values for the type of his CD automatically), if their data type matches the current CD type. If the user chooses to configure a data source (and the data source can be configured at all), the configuration dialog of the source is shown. The user can also decide to perform the retrieval of the data, in which case there is created a data object, normally by giving search information to it. That object is then used to retrieve the data.

Version:
May 22nd 2002
Author:
Rutger Bezema, Andreas Schmitz

Method Summary
 java.lang.Class getDataType()
          Returns the class of data which this source provides.
 java.lang.String getDescription()
          Returns a short description for this source.
 boolean hasConfigurationDialog()
          Used to determine whether there is a configuration dialog for this source.
 Data retrieveData()
          This method will be invoked to get the data.
 void showConfigurationDialog(java.awt.Frame parent)
          Shows a configuration dialog where some options can be configured concerning this source.
 

Method Detail

getDescription

public java.lang.String getDescription()
Returns a short description for this source. This could be the String "CDDB Database" for a CDDB query source and should be a String that tells the user roughly what it can do.

Returns:
the string.

getDataType

public java.lang.Class getDataType()
Returns the class of data which this source provides. This is needed to determine the CD type which suits the produced data.

Returns:
the class.

hasConfigurationDialog

public boolean hasConfigurationDialog()
Used to determine whether there is a configuration dialog for this source.

Returns:
true, if there is one.

showConfigurationDialog

public void showConfigurationDialog(java.awt.Frame parent)
Shows a configuration dialog where some options can be configured concerning this source. This is no must for some sources, although quite useful. For example, a CDDB source could show a dialog with the server to use, which port etc. The configured options should be saved (for example in the preferences) by the implementing classes.

Parameters:
parent - the parent frame.

retrieveData

public Data retrieveData()
This method will be invoked to get the data. The showConfigurationDialog() method will be invoked before this method, if the hasConfigurationDialog() method returns true. If there has been a dialog, the data could also have been retrieved there, but it must be returned here. If this method returns null, it is assumed that either something went wrong in the retrieval process or the user has cancelled the dialog, so that the original data is not overwritten.

Returns:
the data that is hopefully found.