00001 #ifndef IT_BUS_TRANSACTION_PARTICIPANT_
00002 #define IT_BUS_TRANSACTION_PARTICIPANT_
00003
00004
00005
00006 #include <it_bus/ref_counted_base.h>
00007 #include <it_bus/types.h>
00008 #include <it_bus/var.h>
00009
00010 namespace IT_Bus
00011 {
00012 class TransactionManager;
00013
00025 class IT_BUS_API TransactionParticipant : public virtual RefCountedBase
00026 {
00027 public:
00028 virtual ~TransactionParticipant();
00029
00042 enum VoteOutcome {
00043 VoteCommit,
00044 VoteRollback,
00045 VoteReadOnly
00046 };
00047
00052 virtual void
00053 commit_one_phase()=0;
00054
00062 virtual VoteOutcome
00063 prepare()=0;
00064
00069 virtual void
00070 commit()=0;
00071
00077 virtual void
00078 rollback()=0;
00079
00092 virtual void
00093 set_manager(
00094 TransactionManager* tx_manager
00095 )=0;
00096
00120 virtual String
00121 preferred_transaction_manager()=0;
00122
00123 protected:
00124
00125 TransactionParticipant();
00126
00127 private:
00128 TransactionParticipant(const TransactionParticipant&);
00129 TransactionParticipant& operator=(const TransactionParticipant&);
00130 };
00131 typedef Var<TransactionParticipant> TransactionParticipant_var;
00132 typedef TransactionParticipant* TransactionParticipant_ptr;
00133 }
00134
00135 #endif