Class ItemStoreConnectionStrategy
java.lang.Object
org.tasktide.itemstore.strategies.ItemStoreConnectionStrategy
Strategy to hold evaluation logic around whether or not
to allow the opening/closing of
ItemStore to take
that bloat out these classes using ThrowableItemStoreOperation-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancloseConnection(DbTarget target, ItemStore itemStore) Handle to evaluate opening connection against configuredItemStorestatic <R> RconnectionOperation(DbTarget target, ItemStore itemStore, ThrowableItemStoreOperation<R> operation) Encase aThrowableItemStoreOperationaround standardized connection handlingstatic <R> RconnectionOperationUnchecked(DbTarget target, ItemStore itemStore, ItemStoreOperation<R> operation) Encase aItemStoreOperationaround standardized connection handlingstatic booleanopenConnection(DbTarget target, ItemStore itemStore) Handle to evaluate opening connection against configuredItemStore
-
Constructor Details
-
ItemStoreConnectionStrategy
public ItemStoreConnectionStrategy()
-
-
Method Details
-
openConnection
public static boolean openConnection(DbTarget target, ItemStore itemStore) throws ItemStoreUncheckedException Handle to evaluate opening connection against configuredItemStore- Parameters:
target-itemStore-- Returns:
- boolean
- Throws:
ItemStoreUncheckedException
-
closeConnection
public static boolean closeConnection(DbTarget target, ItemStore itemStore) throws ItemStoreUncheckedException Handle to evaluate opening connection against configuredItemStore- Parameters:
target-itemStore-- Returns:
- boolean
- Throws:
ItemStoreUncheckedException
-
connectionOperation
public static <R> R connectionOperation(DbTarget target, ItemStore itemStore, ThrowableItemStoreOperation<R> operation) throws ItemStoreCheckedException Encase aThrowableItemStoreOperationaround standardized connection handling- Type Parameters:
R-- Parameters:
target-itemStore-operation-- Returns:
- R
- Throws:
ItemStoreCheckedException
-
connectionOperationUnchecked
public static <R> R connectionOperationUnchecked(DbTarget target, ItemStore itemStore, ItemStoreOperation<R> operation) throws ItemStoreUncheckedException Encase aItemStoreOperationaround standardized connection handling- Type Parameters:
R-- Parameters:
target-itemStore-operation-- Returns:
- R
- Throws:
ItemStoreUncheckedException
-