Class JDBCStorageDelegate<T>
- java.lang.Object
-
- io.vlingo.symbio.store.state.jdbc.JDBCStorageDelegate<T>
-
- All Implemented Interfaces:
io.vlingo.symbio.store.state.StateStore.StorageDelegate
- Direct Known Subclasses:
HSQLDBStorageDelegate
,PostgresStorageDelegate
public abstract class JDBCStorageDelegate<T> extends java.lang.Object implements io.vlingo.symbio.store.state.StateStore.StorageDelegate
-
-
Field Summary
Fields Modifier and Type Field Description protected java.sql.Connection
connection
protected JDBCDispatchableCachedStatements<T>
dispatchableCachedStatements
protected io.vlingo.symbio.store.DataFormat
format
protected io.vlingo.actors.Logger
logger
protected Mode
mode
protected java.lang.String
originatorId
protected java.util.Map<java.lang.String,CachedStatement<T>>
readStatements
protected java.util.Map<java.lang.String,CachedStatement<T>>
writeStatements
-
Constructor Summary
Constructors Modifier Constructor Description protected
JDBCStorageDelegate(java.sql.Connection connection, io.vlingo.symbio.store.DataFormat format, java.lang.String originatorId, boolean createTables, io.vlingo.actors.Logger logger)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <S extends io.vlingo.symbio.State<?>>
java.util.Collection<io.vlingo.symbio.store.state.StateStore.Dispatchable<S>>allUnconfirmedDispatchableStates()
<A,E>
AappendExpressionFor(io.vlingo.symbio.Entry<E> entry)
<A> A
appendIdentityExpression()
void
beginRead()
void
beginWrite()
protected abstract byte[]
binaryDataFrom(java.sql.ResultSet resultSet, int columnIndex)
protected abstract <D> D
binaryDataTypeObject()
void
close()
void
complete()
void
confirmDispatched(java.lang.String dispatchId)
<C> C
connection()
protected abstract JDBCDispatchableCachedStatements<T>
dispatchableCachedStatements()
protected abstract java.lang.String
dispatchableIdIndexCreateExpression()
protected abstract java.lang.String
dispatchableOriginatorIdIndexCreateExpression()
protected abstract java.lang.String
dispatchableTableCreateExpression()
protected abstract java.lang.String
dispatchableTableName()
<W,S>
WdispatchableWriteExpressionFor(java.lang.String dispatchId, io.vlingo.symbio.State<S> state)
protected abstract java.lang.String
entryTableCreateExpression()
protected abstract java.lang.String
entryTableName()
void
fail()
boolean
isClosed()
java.lang.String
originatorId()
protected abstract java.lang.String
readExpression(java.lang.String storeName, java.lang.String id)
<R> R
readExpressionFor(java.lang.String storeName, java.lang.String id)
<S> S
session()
protected abstract <E> void
setBinaryObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.Entry<E> entry)
protected abstract <S> void
setBinaryObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.State<S> state)
protected abstract <E> void
setTextObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.Entry<E> entry)
protected abstract <S> void
setTextObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.State<S> state)
<S,R>
SstateFrom(R result, java.lang.String id)
protected abstract java.lang.String
stateStoreTableCreateExpression(java.lang.String storeName)
protected abstract java.lang.String
tableNameFor(java.lang.String storeName)
protected abstract java.lang.String
textDataFrom(java.sql.ResultSet resultSet, int columnIndex)
protected abstract java.lang.String
writeExpression(java.lang.String storeName)
<W,S>
WwriteExpressionFor(java.lang.String storeName, io.vlingo.symbio.State<S> state)
-
-
-
Field Detail
-
connection
protected final java.sql.Connection connection
-
dispatchableCachedStatements
protected final JDBCDispatchableCachedStatements<T> dispatchableCachedStatements
-
format
protected final io.vlingo.symbio.store.DataFormat format
-
logger
protected final io.vlingo.actors.Logger logger
-
mode
protected Mode mode
-
originatorId
protected final java.lang.String originatorId
-
readStatements
protected final java.util.Map<java.lang.String,CachedStatement<T>> readStatements
-
writeStatements
protected final java.util.Map<java.lang.String,CachedStatement<T>> writeStatements
-
-
Method Detail
-
appendExpressionFor
public <A,E> A appendExpressionFor(io.vlingo.symbio.Entry<E> entry) throws java.lang.Exception
- Specified by:
appendExpressionFor
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
appendIdentityExpression
public <A> A appendIdentityExpression()
- Specified by:
appendIdentityExpression
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
allUnconfirmedDispatchableStates
public <S extends io.vlingo.symbio.State<?>> java.util.Collection<io.vlingo.symbio.store.state.StateStore.Dispatchable<S>> allUnconfirmedDispatchableStates() throws java.lang.Exception
- Specified by:
allUnconfirmedDispatchableStates
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
beginRead
public void beginRead() throws java.lang.Exception
- Specified by:
beginRead
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
beginWrite
public void beginWrite() throws java.lang.Exception
- Specified by:
beginWrite
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
close
public void close()
- Specified by:
close
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
complete
public void complete() throws java.lang.Exception
- Specified by:
complete
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
connection
public <C> C connection()
- Specified by:
connection
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
confirmDispatched
public void confirmDispatched(java.lang.String dispatchId)
- Specified by:
confirmDispatched
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
dispatchableWriteExpressionFor
public <W,S> W dispatchableWriteExpressionFor(java.lang.String dispatchId, io.vlingo.symbio.State<S> state) throws java.lang.Exception
- Specified by:
dispatchableWriteExpressionFor
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
fail
public void fail()
- Specified by:
fail
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
originatorId
public java.lang.String originatorId()
- Specified by:
originatorId
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
-
readExpressionFor
public <R> R readExpressionFor(java.lang.String storeName, java.lang.String id) throws java.lang.Exception
- Specified by:
readExpressionFor
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
session
public <S> S session() throws java.lang.Exception
- Specified by:
session
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
stateFrom
public <S,R> S stateFrom(R result, java.lang.String id) throws java.lang.Exception
- Specified by:
stateFrom
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
writeExpressionFor
public <W,S> W writeExpressionFor(java.lang.String storeName, io.vlingo.symbio.State<S> state) throws java.lang.Exception
- Specified by:
writeExpressionFor
in interfaceio.vlingo.symbio.store.state.StateStore.StorageDelegate
- Throws:
java.lang.Exception
-
binaryDataFrom
protected abstract byte[] binaryDataFrom(java.sql.ResultSet resultSet, int columnIndex) throws java.lang.Exception
- Throws:
java.lang.Exception
-
binaryDataTypeObject
protected abstract <D> D binaryDataTypeObject() throws java.lang.Exception
- Throws:
java.lang.Exception
-
dispatchableCachedStatements
protected abstract JDBCDispatchableCachedStatements<T> dispatchableCachedStatements()
-
dispatchableIdIndexCreateExpression
protected abstract java.lang.String dispatchableIdIndexCreateExpression()
-
dispatchableOriginatorIdIndexCreateExpression
protected abstract java.lang.String dispatchableOriginatorIdIndexCreateExpression()
-
dispatchableTableCreateExpression
protected abstract java.lang.String dispatchableTableCreateExpression()
-
dispatchableTableName
protected abstract java.lang.String dispatchableTableName()
-
entryTableCreateExpression
protected abstract java.lang.String entryTableCreateExpression()
-
entryTableName
protected abstract java.lang.String entryTableName()
-
readExpression
protected abstract java.lang.String readExpression(java.lang.String storeName, java.lang.String id)
-
setBinaryObject
protected abstract <S> void setBinaryObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.State<S> state) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setBinaryObject
protected abstract <E> void setBinaryObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.Entry<E> entry) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setTextObject
protected abstract <S> void setTextObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.State<S> state) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setTextObject
protected abstract <E> void setTextObject(CachedStatement<T> cached, int columnIndex, io.vlingo.symbio.Entry<E> entry) throws java.lang.Exception
- Throws:
java.lang.Exception
-
stateStoreTableCreateExpression
protected abstract java.lang.String stateStoreTableCreateExpression(java.lang.String storeName)
-
tableNameFor
protected abstract java.lang.String tableNameFor(java.lang.String storeName)
-
textDataFrom
protected abstract java.lang.String textDataFrom(java.sql.ResultSet resultSet, int columnIndex) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeExpression
protected abstract java.lang.String writeExpression(java.lang.String storeName)
-
-