com.zphinx.spine.start.helpers
Class DataSourceServiceLocator

java.lang.Object
  extended by com.zphinx.spine.start.helpers.DataSourceServiceLocator

public class DataSourceServiceLocator
extends Object

DataSourceServiceLocator serves as a service locator used to fetch datasources as defined in the initialization configuration file.

Version:
$1.0

Copyright ©Zphinx Software Solutions

Author:
David Ladapo

Method Summary
 void createDataSource(String key, Map map, DataSourceBuilder sourceBuilder)
          Creates a dataSource using the specified map properties, the DataSourceBuilder and the associated key.
 DataSource getDataSource()
          Gets the default dataSource
 DataSource getDataSource(String key)
          Gets the dataSource known by the specified key
static DataSourceServiceLocator getInstance()
          Gets the only instance of this object
 DataSourceBuilder initiateBuilder(Map map)
          Creates a DataSourceBuilder using the map
 void setDataSource(DataSource dataSource2)
          Sets a default dataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DataSourceServiceLocator getInstance()
Gets the only instance of this object

Returns:
the only instance of this object

getDataSource

public DataSource getDataSource()
Gets the default dataSource

Returns:
the dataSource

getDataSource

public DataSource getDataSource(String key)
Gets the dataSource known by the specified key

Returns:
the dataSource

createDataSource

public void createDataSource(String key,
                             Map map,
                             DataSourceBuilder sourceBuilder)
Creates a dataSource using the specified map properties, the DataSourceBuilder and the associated key. It also has the effect of setting the default datasource to the newly created dataSource if it is non null

Parameters:
map - A map containing the dataSource initialization properties
key - The key by which this datasource is known to the system
sourceBuilder - The DataSourceBuilder instance used in the creation process

initiateBuilder

public DataSourceBuilder initiateBuilder(Map map)
Creates a DataSourceBuilder using the map

Parameters:
map - The map containing all the parameters needed to initiate a dataSource
Returns:
The appropriate DataSourceBuilder

setDataSource

public void setDataSource(DataSource dataSource2)
Sets a default dataSource

Parameters:
dataSource2 - The dataSource to set as default dataSource