Package rife.database
Class Datasources
java.lang.Object
rife.database.Datasources
- All Implemented Interfaces:
AutoCloseable
Contains a collection of
Datasource instances.- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Cleans up all connections that have been reserved by this datasource.voidclose()getDatasource(String name) Retrieves theDatasourcethat corresponds to a provided name.getDatasourceForSelector(NameSelector selector, String fallbackName) Retrieves theDatasourcethat corresponds an automatically selected name, or a fallback datasource of none could be found that matches the selected name.Retrieves a collection of all theDatasourcenames that are known by thisDatasourcesinstance.static Datasourcesinstance()Returns the shared singleton instance of theDatasourcesclass.voidsetDatasource(String name, Datasource datasource) Stores aDatasourcewith a provided name to be able to reference it later.
-
Constructor Details
-
Datasources
Creates a new emptyDatasourcesinstance.- Throws:
DatasourcesException- Since:
- 1.0
-
-
Method Details
-
instance
Returns the shared singleton instance of theDatasourcesclass.- Returns:
- the singleton
Datasourcesinstance - Since:
- 1.0
-
getDatasource
Retrieves theDatasourcethat corresponds to a provided name.- Parameters:
name- aStringthat identifies theDatasourcethat has to be retrieved- Returns:
- the requested
Datasourceinstance; ornullif name isn't known - Since:
- 1.0
-
getDatasourceForSelector
Retrieves theDatasourcethat corresponds an automatically selected name, or a fallback datasource of none could be found that matches the selected name.- Parameters:
selector- aNameSelectorthat will automatically select a name based on the current environmentfallbackName- aStringthat identifies the fallbackDatasourcethat has to be used- Returns:
- the requested
Datasourceinstance; ornullif noDatasourcecould be found - Since:
- 1.0
-
setDatasource
Stores aDatasourcewith a provided name to be able to reference it later.- Parameters:
name- aStringthat identifies theDatasourcedatasource- theDatasourceinstance that has to be stored- Since:
- 1.0
-
getDatasourceNames
Retrieves a collection of all theDatasourcenames that are known by thisDatasourcesinstance.- Returns:
- the requested
Collection - Since:
- 1.0
-
cleanup
Cleans up all connections that have been reserved by this datasource.- Throws:
DatabaseException- when an error occurred during the cleanup- Since:
- 1.0
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
DatabaseException
-