public abstract class AbstractDataSourceFactory<T extends DataSource> extends Object
Constructor and Description |
---|
AbstractDataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
protected DataSource |
callConstructor(Class<? extends T> clazz,
Properties configProperties)
Perform call to the
DataSource constructor. |
DataSource |
create(Class<? extends T> clazz,
Properties dsProperties) |
DataSource |
create(Properties dsProperties)
Create new instance of
DataSource fully configured with properties. |
Class<? extends T> |
getDsClass() |
protected DataSource |
instantiateDataSource(Properties configProperties)
Instantiate a concrete dataSource instance depending on the
property value |
protected boolean |
isResolvedProperty(Properties dsProperties,
String key)
Check if a property has been resolved. i.e. the property does not contain the
special spring placeholder resolver character '$').
|
void |
setDsClass(Class<? extends T> dsClass) |
public DataSource create(Class<? extends T> clazz, Properties dsProperties) throws Exception
Exception
public DataSource create(Properties dsProperties) throws Exception
DataSource
fully configured with properties.
All given properties will be set configured but the process ignore unresolved properties that will
the be set to DataSource default values.dsProperties
- configuration propertiesException
protected boolean isResolvedProperty(Properties dsProperties, String key)
dsProperties
- properties map containing property to checkkey
- key identifier of the property to checkprotected DataSource callConstructor(Class<? extends T> clazz, Properties configProperties) throws Exception
DataSource
constructor.
This method calls by default no-args constructor but can be overridden to use a constructor
with args instead.clazz
- class to instantiate. Cannot be nullconfigProperties
- properties list to configure new DataSource
. by default, these
properties are not used because default no-arg constructor is called but are
available in case of specific override. Cannot be nullDataSource
instanceNoSuchMethodException
- if the specified constructor was not foundIllegalAccessException
- if the specified constructor cannot be called due to access restrictionsInvocationTargetException
- if the underlying constructor throws an exception.InstantiationException
- if the class that declares the underlying constructor represents an abstract classException
protected DataSource instantiateDataSource(Properties configProperties) throws Exception
property
valueconfigProperties
- configuration properties. Cannot be nullDataSource
instanceException
Copyright © 2009–2014. All rights reserved.