public abstract class AbstractDataSource<T extends DataSource> extends Object implements DataSource<T>
DataSource.Parameter<T>
Modifier and Type | Field and Description |
---|---|
protected ConnectionConfiguration |
connConfig |
protected Map<String,DataSource.Parameter> |
params |
Constructor and Description |
---|
AbstractDataSource() |
Modifier and Type | Method and Description |
---|---|
DataSource.Parameter |
getDefaultParameter(String name) |
String |
getName() |
<P> DataSource.Parameter<P> |
getParameter(DataSource.Parameter<P> template) |
DataSource.Parameter |
getParameter(String name) |
DataSource.Parameter[] |
getParameters() |
<P> P |
getParameterValue(DataSource.Parameter<P> template) |
<P> P |
getParameterValue(DataSource.Parameter<P> template,
P defaultValue) |
void |
init(Class dbClass)
Initialize DataSource.
|
void |
init(String qualifiedName,
String simpleName,
String path)
Initialize DataSource.
|
boolean |
isParameterRequired(DataSource.Parameter p) |
void |
putParameter(DataSource.Parameter param) |
<P> void |
putParameter(DataSource.Parameter<P> param,
P value) |
void |
putParameterValue(String name,
Object value) |
void |
putParameterValue(String name,
Object defaultValue,
boolean overrideWithSystemProperty)
Use default or get new parameters and set them for connecting to
databases.
|
protected static void |
rankParams(DataSource.Parameter... params)
ranks the
params in descending order |
void |
setName(String name)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearCaches, getDefaultParameters, getMetaData
protected final Map<String,DataSource.Parameter> params
protected ConnectionConfiguration connConfig
public void init(Class dbClass)
dbClass
- of the specific JDBCDataSource implementationpublic void init(String qualifiedName, String simpleName, String path)
qualifiedName
- of the specific JDBCDataSource implementationsimpleName
- simple name of the specific JDBCDataSource implementationpath
- default path to db config property file@Deprecated public void setName(String name)
public String getName()
getName
in interface DataSource<T extends DataSource>
public void putParameterValue(String name, Object defaultValue, boolean overrideWithSystemProperty)
name
- of the parameterdefaultValue
- value of the parameteroverrideWithSystemProperty
- if true it will be checked whether there is the system
argument "XDEV_DB_DBPROPERTYFILE" set or there is a property
file in the default location (same folder like the class who
is calling this methode)public <P> void putParameter(DataSource.Parameter<P> param, P value)
public void putParameter(DataSource.Parameter param)
putParameter
in interface DataSource<T extends DataSource>
public DataSource.Parameter getParameter(String name)
getParameter
in interface DataSource<T extends DataSource>
public DataSource.Parameter[] getParameters()
getParameters
in interface DataSource<T extends DataSource>
public <P> DataSource.Parameter<P> getParameter(DataSource.Parameter<P> template)
public <P> P getParameterValue(DataSource.Parameter<P> template)
getParameterValue
in interface DataSource<T extends DataSource>
public <P> P getParameterValue(DataSource.Parameter<P> template, P defaultValue)
getParameterValue
in interface DataSource<T extends DataSource>
public boolean isParameterRequired(DataSource.Parameter p)
isParameterRequired
in interface DataSource<T extends DataSource>
true
if the parameter p
is required,
depending on the other parameters' values, false
otherwisepublic DataSource.Parameter getDefaultParameter(String name)
getDefaultParameter
in interface DataSource<T extends DataSource>
protected static void rankParams(DataSource.Parameter... params)
params
in descending orderparams
- Copyright © 2003–2021 XDEV Software. All rights reserved.