Class 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 Detail

      • connection

        protected final java.sql.Connection connection
      • 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
    • Constructor Detail

      • JDBCStorageDelegate

        protected JDBCStorageDelegate​(java.sql.Connection connection,
                                      io.vlingo.symbio.store.DataFormat format,
                                      java.lang.String originatorId,
                                      boolean createTables,
                                      io.vlingo.actors.Logger logger)
    • Method Detail

      • appendExpressionFor

        public <A,​E> A appendExpressionFor​(io.vlingo.symbio.Entry<E> entry)
                                          throws java.lang.Exception
        Specified by:
        appendExpressionFor in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • appendIdentityExpression

        public <A> A appendIdentityExpression()
        Specified by:
        appendIdentityExpression in interface io.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 interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • beginRead

        public void beginRead()
                       throws java.lang.Exception
        Specified by:
        beginRead in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • beginWrite

        public void beginWrite()
                        throws java.lang.Exception
        Specified by:
        beginWrite in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • close

        public void close()
        Specified by:
        close in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
      • complete

        public void complete()
                      throws java.lang.Exception
        Specified by:
        complete in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • connection

        public <C> C connection()
        Specified by:
        connection in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
      • confirmDispatched

        public void confirmDispatched​(java.lang.String dispatchId)
        Specified by:
        confirmDispatched in interface io.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 interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • fail

        public void fail()
        Specified by:
        fail in interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
      • originatorId

        public java.lang.String originatorId()
        Specified by:
        originatorId in interface io.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 interface io.vlingo.symbio.store.state.StateStore.StorageDelegate
        Throws:
        java.lang.Exception
      • session

        public <S> S session()
                      throws java.lang.Exception
        Specified by:
        session in interface io.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 interface io.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 interface io.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
      • 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)