Class DataSourceUtil
- java.lang.Object
-
- com.broadleafcommerce.common.jpa.data.DataSourceUtil
-
public class DataSourceUtil extends Object
Utility for creating proxiedDataSourceinstances that also expose theRoutableDataSourceinterface for participation in a composite, routingRoutingJpaDataSourceinstance. Such a composite datasource is capable of delegating data source duty to one or more backing data sources at runtime based onDataRouteContextThreadLocal state. This state is meant to identify the desired backing datasource for the current flow while still allowing a common data repository implementation for multiple flows.- Author:
- Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description DataSourceUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RoutableDataSourcecreateRoutableInstance(DataSource original, String key, int order, Class<?>... supportingClasses)Create aRoutableDataSourceproxy wrapping aDataSource.static RoutableDataSourcecreateRoutableInstance(DataSource original, String key, Class<?>... supportingClasses)Create aRoutableDataSourceproxy wrapping aDataSource.
-
-
-
Method Detail
-
createRoutableInstance
public static RoutableDataSource createRoutableInstance(DataSource original, String key, Class<?>... supportingClasses)
Create aRoutableDataSourceproxy wrapping aDataSource.- Parameters:
original- The originalDataSource.key- The lookup key for the route.supportingClasses- AnyDataRouteSupportingextensions that this route supports.- Returns:
- The proxied data source.
-
createRoutableInstance
public static RoutableDataSource createRoutableInstance(DataSource original, String key, int order, Class<?>... supportingClasses)
Create aRoutableDataSourceproxy wrapping aDataSource.- Parameters:
original- The originalDataSource.key- The lookup key for the route.order- The order in which the routable datasources will be reviewed for matches inRoutingJpaDataSource.supportingClasses- AnyDataRouteSupportingextensions that this route supports.- Returns:
- The proxied data source.
-
-