Class HasEntry

java.lang.Object
org.jpos.transaction.participant.HasEntry
All Implemented Interfaces:
Configurable, GroupSelector, TransactionConstants, TransactionParticipant

public class HasEntry extends Object implements GroupSelector, Configurable
HasEntry is a general purpose GroupSelector that can be used to verify that a given object is available in the context. It checks the Context for the given entry ('name' property) and returns the content of the 'yes' or 'no' properties as the group list. If "yes" or "no" is not specified, it returns the constant UNKNOWN
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Configuration property whose value is returned when the context entry is absent.
    static final String
    Default selector returned when neither YES nor NO is configured.
    static final String
    Configuration property whose value is returned when the context entry is present.

    Fields inherited from interface TransactionConstants

    ABORTED, FAIL, NO_JOIN, PAUSE, PREPARED, READONLY, RETRY
    Modifier and Type
    Field
    Description
    static final int
    Transaction has been aborted.
    static final int
    Shortcut for a read-only, non-joining abort (READONLY | NO_JOIN).
    static final int
    This participant does not join the transaction
    static final int
    Transaction is paused.
    static final int
    Transaction has been prepared successfully.
    static final int
    Context has not been modified (no need to persist a snapshot)
    static final int
    Transaction should be retried.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor; no instance state to initialise.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    abort(long id, Serializable o)
    Called by TransactionManager upon transaction commit.
    void
    commit(long id, Serializable o)
    Called by TransactionManager upon transaction commit.
    int
    prepare(long id, Serializable o)
    Called by TransactionManager in preparation for a transaction
    select(long id, Serializable ser)
    Selects the transaction group to execute.
    void
    Configures this object with the supplied Configuration.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • HasEntry

      public HasEntry()
      Default constructor; no instance state to initialise.
  • Method Details

    • prepare

      public int prepare(long id, Serializable o)
      Description copied from interface: TransactionParticipant
      Called by TransactionManager in preparation for a transaction
      Specified by:
      prepare in interface TransactionParticipant
      Parameters:
      id - the Transaction identifier
      o - transaction context
      Returns:
      PREPARED or ABORTED (| NO_JOIN | READONLY)
    • select

      public String select(long id, Serializable ser)
      Description copied from interface: GroupSelector
      Selects the transaction group to execute.
      Specified by:
      select in interface GroupSelector
      Parameters:
      id - transaction id
      ser - transaction context
      Returns:
      group name or null for no-action
    • commit

      public void commit(long id, Serializable o)
      Description copied from interface: TransactionParticipant
      Called by TransactionManager upon transaction commit. Warning: implementation should be able to handle multiple calls with the same transaction id (rare crash recovery)
      Specified by:
      commit in interface TransactionParticipant
      Parameters:
      id - the Transaction identifier
      o - transaction context
    • abort

      public void abort(long id, Serializable o)
      Description copied from interface: TransactionParticipant
      Called by TransactionManager upon transaction commit. Warning: implementation should be able to handle multiple calls with the same transaction id (rare crash recovery)
      Specified by:
      abort in interface TransactionParticipant
      Parameters:
      id - the Transaction identifier
      o - transaction context
    • setConfiguration

      public void setConfiguration(Configuration cfg)
      Description copied from interface: Configurable
      Configures this object with the supplied Configuration.
      Specified by:
      setConfiguration in interface Configurable
      Parameters:
      cfg - Configuration object