ca.spaz.cron.datasource
Class Datasources

java.lang.Object
  extended by ca.spaz.cron.datasource.Datasources

public class Datasources
extends java.lang.Object

A class for managing datasources.

Author:
Chris Rose

Method Summary
 void closeAll()
          Closes all data sources in the application.
 java.util.List getDatasources()
          Retrieve a list of all functional data sources in the application.
 java.util.List getDatasources(boolean includeUnAvailable)
          Retrieve a list of data sources available in the application.
 java.util.List getFoodGroups()
          Retrieve a list of the Food Groups consisting of the union of all food groups in the various supported data sources.
static Datasources getInstance()
           
 ILocalFoodDatasource getMutableDataSource()
          Retrieve the unique instance of the user data source.
 java.util.List getSources()
          Retrieve a list of the Sources listed in the food data sources.
static void initialize(ProgressListener pl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final Datasources getInstance()

initialize

public static final void initialize(ProgressListener pl)

getMutableDataSource

public ILocalFoodDatasource getMutableDataSource()
Retrieve the unique instance of the user data source. This data source must accept writing.

Returns:
an ILocalFoodDatasource instance for this run of the application.

getDatasources

public java.util.List getDatasources()
Retrieve a list of all functional data sources in the application. This list will not contain any Datasources that have indicated that they are not available.

Returns:
a List of IFoodDatasource instances consisting of only those for which isAvailable() returns true.

closeAll

public void closeAll()
Closes all data sources in the application.


getFoodGroups

public java.util.List getFoodGroups()
Retrieve a list of the Food Groups consisting of the union of all food groups in the various supported data sources.

Returns:
The food groups available in the application.

getSources

public java.util.List getSources()
Retrieve a list of the Sources listed in the food data sources.

Returns:
a list of sources.

getDatasources

public java.util.List getDatasources(boolean includeUnAvailable)
Retrieve a list of data sources available in the application.

Parameters:
includeUnAvailable - Set this to true if the datasources list should include data sources that indicate that they are unavailable.
Returns:
A List of IFoodDatasource objects representing all loaded datasources. if includeUnAvailable is true, this list will include Datasources that are not operational.


Copyright © 2005 Spaz. All Rights Reserved.