Class TransactionAdapter


  • @ProtoAdapter(InfinispanTransaction.class)
    public class TransactionAdapter
    extends Object
    An Infinispan ProtoStream adapter for marshalling a InfinispanTransaction instance. This class defines a factory for creating InfinispanTransaction instances when hydrating a transaction record from the protocol buffer datastore as well as field handlers to extract values from a given transaction instance for serializing the instance to a protocol buffer stream.
    Author:
    Chris Cranford
    • Constructor Detail

      • TransactionAdapter

        public TransactionAdapter()
    • Method Detail

      • factory

        @ProtoFactory
        public InfinispanTransaction factory​(String transactionId,
                                             String scn,
                                             String changeTime,
                                             int numberOfEvents,
                                             String userName)
        A ProtoStream factory that creates a InfinispanTransaction instance from field values.
        Parameters:
        transactionId - the transaction identifier
        scn - the starting system change number of the transaction
        changeTime - the starting time of the transaction
        numberOfEvents - the number of events in the transaction
        userName - the user name
        Returns:
        the constructed Transaction instance
      • getTransactionId

        @ProtoField(number=1,
                    required=true)
        public String getTransactionId​(InfinispanTransaction transaction)
        A ProtoStream handler to extract the transactionId field from the InfinispanTransaction.
        Parameters:
        transaction - the transaction instance, must not be null
        Returns:
        the transaction identifier, never null
      • getScn

        @ProtoField(number=2,
                    required=true)
        public String getScn​(InfinispanTransaction transaction)
        A ProtoStream handler to extract the startScn field from the InfinispanTransaction.
        Parameters:
        transaction - the transaction instance, must not be null
        Returns:
        the starting system change number, never null
      • getChangeTime

        @ProtoField(number=3,
                    required=true)
        public String getChangeTime​(InfinispanTransaction transaction)
        A ProtoStream handler to extract the changeTime field from the InfinispanTransaction.
        Parameters:
        transaction - the transaction instance, must not be null
        Returns:
        the starting time of the transaction, never null
      • getNumberOfEvents

        @ProtoField(number=4,
                    defaultValue="0")
        public int getNumberOfEvents​(InfinispanTransaction transaction)
        A ProtoStream handler to extract the eventIds field from the InfinispanTransaction.
        Parameters:
        transaction - the transaction instance, must not be null
        Returns:
        the number of events in the transaction
      • getUserName

        @ProtoField(number=5)
        public String getUserName​(InfinispanTransaction transaction)
        A ProtoStream handler to extract the userName field from the InfinispanTransaction.
        Parameters:
        transaction - the transaction instance, must not be null
        Returns:
        the username associated with the transaction